commit:     1fb2a83490c464447b178fb12e86268156d37c86
Author:     Milkey Mouse <milkeymouse <AT> meme <DOT> institute>
AuthorDate: Fri Apr 27 20:53:26 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 22:04:14 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=1fb2a834

sys-libs/libapparmor: add new package

secure_getenv() is only available from glibc. Borrow a patch from Alpine Linux
that adds a standalone version.

Package-Manager: Portage-2.3.31, Repoman-2.3.9
Manifest-Sign-Key: C6EF5A02F5647987

 sys-libs/libapparmor/Manifest                      |  21 +++
 .../files/libapparmor-2.10-symbol_visibility.patch |  13 ++
 .../files/libapparmor-2.12-secure_getenv.patch     | 154 +++++++++++++++++++++
 sys-libs/libapparmor/libapparmor-2.11.1.ebuild     |  96 +++++++++++++
 sys-libs/libapparmor/libapparmor-2.12.0.ebuild     |  96 +++++++++++++
 sys-libs/libapparmor/metadata.xml                  |  14 ++
 6 files changed, 394 insertions(+)

diff --git a/sys-libs/libapparmor/Manifest b/sys-libs/libapparmor/Manifest
new file mode 100644
index 0000000..6a84fad
--- /dev/null
+++ b/sys-libs/libapparmor/Manifest
@@ -0,0 +1,21 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+DIST apparmor-2.11.1.tar.gz 5017646 BLAKE2B 
ee0176c87b2800eb562c136ff324f08e444c412117c4593ff97c4b0e4c63db2aea0721c6ed38f3c733e3c95024165f329e520acf838c4798a8285b8dedf0d51e
 SHA512 
f088157cc116987e56c0e02127497b1ec6241f3d761ec3b53211fa188f5f02c9408d6b903f2d275328ede88ebfd1393e00aad9f68cbe78fa9ab3711ba0f9c00c
+DIST apparmor-2.12.tar.gz 7258450 BLAKE2B 
c1d4e01d836c5f567ddb7c5ecf36dde6efccf1e59ae219824129fd5c92162a3fed7ebdc492f181ae132b07db068660078a9631543d40fd20ab0b44cd4c646d4c
 SHA512 
d85fd47c66333fe5658ee5e977b32142697f6e36c575550712ee2ace2ad0fbf2aa59c8fd3b82ad8821c0190adf8cc150cf623ea09a84d5b32bde050a03dd6e9a
+-----BEGIN PGP SIGNATURE-----
+
+iQIzBAEBCAAdFiEE8JaD5QHaZGPThRiKxu9aAvVkeYcFAlrjjcYACgkQxu9aAvVk
+eYcGMQ/+M6Og6CkCvCW6PBUwYty2EBMAmJc0OctvlxXYhmjJiu9dgvUQz/pZw8xs
+MD8Kj2sw+NzwTFwxLsH4CIkSv+oGyDsR8sSPHhYIwI7gA/pxk3i0uK+F3J9EAHFv
+cEIqlO12IJ26IHP1UOML4Y6UXAgCNIX5DcpUtcipK2o00azsOPVzfcvpBYQXYTmD
+pI2/gRweFtL72MWXBdAzZCl7u6swq7XZg7p14uXYuz6MnQP/THLqxOmhDRUVvfr1
+sEAsmPZj9Tsm9PGtUm9wZnduxJMyr6I9JFGN4DTRJIuYfymuzRZ2JTe2sAvRd2Jb
+Y8nRR9tsMImqeocQPq7tnMul6ktoMi3LCeHY9OmVWw+ywmSJ0cesLItMIXZg3NsY
+N2ja/PqflNblywm+z9T9K89rNfLZakJgNOXesBQwOhFApFIG2dHdWlkbaivUJyyq
+cQU1y8UNQzqM0CapgE4KLMGK+g+DvQkGRg4lDOVawbmnaHmQ9cDZPyyz/oni3GQa
+6CKg8UiiYjoJCJmeJNccdIgxBDvgTPF0xNNCxnHPyX45EU0qPf+Q5ZGSDsPLDO8C
+ZiqZcg4wt4wFpNU3iCwp7MbXtcbr0LOao0eIy6lX8NJ8suCZLMzG+cFJLRPCxI5Q
+nbYbzEW614arzb2++EvOf8gmVy7tNQ1KrAxEEg7lRjQMKGyjdn0=
+=lOpQ
+-----END PGP SIGNATURE-----

diff --git 
a/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch 
b/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch
new file mode 100644
index 0000000..beaf355
--- /dev/null
+++ b/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch
@@ -0,0 +1,13 @@
+Adds an aditional symbol to allow dynamic linking.
+
+--- src/libapparmor.map
++++ src/libapparmor.map
+@@ -94,6 +94,7 @@
+               _aa_autoclose;
+               _aa_autofclose;
+               _aa_dirat_for_each;
++              _aa_asprintf;
+       local:
+               *;
+ };
+

diff --git a/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch 
b/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch
new file mode 100644
index 0000000..56c4096
--- /dev/null
+++ b/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch
@@ -0,0 +1,154 @@
+--- a/libraries/libapparmor/configure.ac
++++ b/libraries/libapparmor/configure.ac
+@@ -81,7 +81,7 @@ AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes)
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
+ 
+-AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv])
++AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv scandirat])
+ 
+ AM_PROG_CC_C_O
+ AC_C_CONST
+--- a/libraries/libapparmor/src/Makefile.am
++++ b/libraries/libapparmor/src/Makefile.am
+@@ -46,9 +46,9 @@ af_protos.h: /usr/include/netinet/in.h
+        LC_ALL=C  sed  -n -e "/IPPROTO_MAX/d"  -e "s/^\#define[ 
\\t]\\+IPPROTO_\\([A-Z0-9_]\\+\\)\\(.*\\)$$/AA_GEN_PROTO_ENT(\\UIPPROTO_\\1, 
\"\\L\\1\")/p" $< > $@
+ 
+ lib_LTLIBRARIES = libapparmor.la
+-noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h
++noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h secure_getenv.h 
scandirat.h private.h
+ 
+-libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c 
private.c features.c kernel_interface.c policy_cache.c
++libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c 
secure_getenv.c scandirat.c private.c features.c kernel_interface.c 
policy_cache.c
+ libapparmor_la_LDFLAGS = -version-info 
$(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -dynamic -pthread 
\
+       -Wl,--version-script=$(top_srcdir)/src/libapparmor.map
+ 
+--- a/libraries/libapparmor/src/private.c
++++ b/libraries/libapparmor/src/private.c
+@@ -39,10 +39,14 @@
+  #ifdef HAVE___SECURE_GETENV
+   #define secure_getenv __secure_getenv
+  #else
+-  #error neither secure_getenv nor __secure_getenv is available
++  #include "secure_getenv.h"
+  #endif
+ #endif
+ 
++#ifndef HAVE_SCANDIRAT
++#include "scandirat.h"
++#endif
++
+ struct ignored_suffix_t {
+       const char * text;
+       int len;
+--- /dev/null
++++ b/libraries/libapparmor/src/scandirat.c
+@@ -0,0 +1,63 @@
++#include <dirent.h>
++#include <string.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <fcntl.h>
++#include <inttypes.h>
++#include <errno.h>
++
++#include "scandirat.h"
++
++#ifndef HAVE_SCANDIRAT
++
++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
++      int (*filter)(const struct dirent *),
++      int (*compar)(const struct dirent **, const struct dirent **))
++{
++      int fd;
++      DIR *d;
++      struct dirent *de, **names=0, **tmp;
++      size_t cnt=0, len=0;
++      int old_errno = errno;
++
++
++      fd = openat(dir_fd, dirp, O_RDONLY|O_CLOEXEC);
++      if (fd == -1) return -1;
++
++      d = fdopendir(fd);
++
++      if (!d) {
++              close(fd);
++              return -1;
++      }
++
++      while ((errno=0), (de = readdir(d))) {
++              if (filter && !filter(de)) continue;
++              if (cnt >= len) {
++                      len = 2*len+1;
++                      if (len > SIZE_MAX/sizeof *names) break;
++                      tmp = realloc(names, len * sizeof *names);
++                      if (!tmp) break;
++                      names = tmp;
++              }
++              names[cnt] = malloc(de->d_reclen);
++              if (!names[cnt]) break;
++              memcpy(names[cnt++], de, de->d_reclen);
++      }
++
++      closedir(d);
++
++      if (errno) {
++              if (names) while (cnt-->0) free(names[cnt]);
++              free(names);
++              return -1;
++      }
++      errno = old_errno;
++
++      if (compar) qsort(names, cnt, sizeof *names, (int (*)(const void *, 
const void *))compar);
++      *namelist = names;
++      return cnt;
++}
++
++#endif
++
+--- /dev/null
++++ b/libraries/libapparmor/src/scandirat.h
+@@ -0,0 +1,13 @@
++#ifndef LIBAPPARMOR_SCANDIRAT_H
++#define LIBAPPARMOR_SCANDIRAT_H
++
++#include <dirent.h>
++
++#ifndef HAVE_SCANDIRAT
++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
++      int (*filter)(const struct dirent *),
++      int (*compar)(const struct dirent **, const struct dirent **));
++#endif
++
++#endif
++
+--- /dev/null
++++ b/libraries/libapparmor/src/secure_getenv.c
+@@ -0,0 +1,15 @@
++#include <stdlib.h>
++#include <sys/auxv.h>
++
++#include "secure_getenv.h"
++
++#ifndef HAVE_SECURE_GETENV
++char *secure_getenv(const char *name)
++{
++      if (!getauxval(AT_SECURE)) {
++              return getenv(name);
++      }
++      return NULL;
++}
++#endif
++
+--- /dev/null
++++ b/libraries/libapparmor/src/secure_getenv.h
+@@ -0,0 +1,8 @@
++#ifndef LIBAPPARMOR_SECURE_GETENV_H
++#define LIBAPPARMOR_SECURE_GETENV_H
++
++#ifndef HAVE_SECURE_GETENV
++char *secure_getenv(const char *name);
++#endif
++
++#endif

diff --git a/sys-libs/libapparmor/libapparmor-2.11.1.ebuild 
b/sys-libs/libapparmor/libapparmor-2.11.1.ebuild
new file mode 100644
index 0000000..f400c01
--- /dev/null
+++ b/sys-libs/libapparmor/libapparmor-2.11.1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+GENTOO_DEPEND_ON_PERL="no"
+
+inherit autotools-utils distutils-r1 perl-functions versionator
+
+MY_PV="$(get_version_component_range 1-2)"
+
+DESCRIPTION="Library to support AppArmor userspace utilities"
+HOMEPAGE="http://apparmor.net/";
+SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${PV}.tar.gz";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc +perl +python static-libs"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="perl? ( dev-lang/perl:= )
+       python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+       sys-devel/autoconf-archive
+       sys-devel/bison
+       sys-devel/flex
+       doc? ( dev-lang/perl )
+       perl? ( dev-lang/swig )
+       python? ( dev-lang/swig )"
+
+S=${WORKDIR}/apparmor-${PV}/libraries/${PN}
+
+RESTRICT="test"
+
+src_prepare() {
+       rm -r m4 || die "failed to remove bundled macros"
+       epatch "${FILESDIR}"/${PN}-2.10-symbol_visibility.patch
+       epatch "${FILESDIR}"/${PN}-2.12-secure_getenv.patch
+       autotools-utils_src_prepare
+       use python && distutils-r1_src_prepare
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_with perl) \
+               $(use_with python)
+       )
+
+       autotools-utils_src_configure
+}
+
+src_compile() {
+       autotools-utils_src_compile -C src
+       autotools-utils_src_compile -C include
+       use doc && autotools-utils_src_compile -C doc
+       use perl && autotools-utils_src_compile -C swig/perl
+
+       if use python ; then
+               pushd "${BUILD_DIR}"/swig/python > /dev/null
+               emake libapparmor_wrap.c
+               distutils-r1_src_compile
+               popd > /dev/null
+       fi
+}
+
+src_install() {
+       autotools-utils_src_install -C src
+       autotools-utils_src_install -C include
+       use doc && autotools-utils_src_install -C doc
+
+       if use perl ; then
+               autotools-utils_src_install -C swig/perl
+               perl_set_version
+               insinto "${VENDOR_ARCH}"
+               doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
+
+               # bug 620886
+               perl_delete_localpod
+               perl_fix_packlist
+       fi
+
+       if use python ; then
+               pushd "${BUILD_DIR}"/swig/python > /dev/null
+               distutils-r1_src_install
+
+               python_moduleinto LibAppArmor
+               python_foreach_impl python_domodule LibAppArmor.py
+               popd > /dev/null
+       fi
+}

diff --git a/sys-libs/libapparmor/libapparmor-2.12.0.ebuild 
b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
new file mode 100644
index 0000000..fbd2034
--- /dev/null
+++ b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
+GENTOO_DEPEND_ON_PERL="no"
+
+inherit autotools-utils distutils-r1 perl-functions versionator
+
+MY_PV="$(get_version_component_range 1-2)"
+
+DESCRIPTION="Library to support AppArmor userspace utilities"
+HOMEPAGE="http://apparmor.net/";
+SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${MY_PV}.tar.gz";
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ~x86"
+IUSE="doc +perl +python static-libs"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="perl? ( dev-lang/perl:= )
+       python? ( ${PYTHON_DEPS} )"
+
+DEPEND="${RDEPEND}
+       sys-devel/autoconf-archive
+       sys-devel/bison
+       sys-devel/flex
+       doc? ( dev-lang/perl )
+       perl? ( dev-lang/swig )
+       python? ( dev-lang/swig )"
+
+S=${WORKDIR}/apparmor-${MY_PV}/libraries/${PN}
+
+RESTRICT="test"
+
+src_prepare() {
+       rm -r m4 || die "failed to remove bundled macros"
+       epatch "${FILESDIR}"/${PN}-2.10-symbol_visibility.patch
+       epatch "${FILESDIR}"/${PN}-2.12-secure_getenv.patch
+       autotools-utils_src_prepare
+       use python && distutils-r1_src_prepare
+}
+
+src_configure() {
+       local myeconfargs=(
+               $(use_with perl) \
+               $(use_with python)
+       )
+
+       autotools-utils_src_configure
+}
+
+src_compile() {
+       autotools-utils_src_compile -C src
+       autotools-utils_src_compile -C include
+       use doc && autotools-utils_src_compile -C doc
+       use perl && autotools-utils_src_compile -C swig/perl
+
+       if use python ; then
+               pushd "${BUILD_DIR}"/swig/python > /dev/null
+               emake libapparmor_wrap.c
+               distutils-r1_src_compile
+               popd > /dev/null
+       fi
+}
+
+src_install() {
+       autotools-utils_src_install -C src
+       autotools-utils_src_install -C include
+       use doc && autotools-utils_src_install -C doc
+
+       if use perl ; then
+               autotools-utils_src_install -C swig/perl
+               perl_set_version
+               insinto "${VENDOR_ARCH}"
+               doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
+
+               # bug 620886
+               perl_delete_localpod
+               perl_fix_packlist
+       fi
+
+       if use python ; then
+               pushd "${BUILD_DIR}"/swig/python > /dev/null
+               distutils-r1_src_install
+
+               python_moduleinto LibAppArmor
+               python_foreach_impl python_domodule LibAppArmor.py
+               popd > /dev/null
+       fi
+}

diff --git a/sys-libs/libapparmor/metadata.xml 
b/sys-libs/libapparmor/metadata.xml
new file mode 100644
index 0000000..42d1e8f
--- /dev/null
+++ b/sys-libs/libapparmor/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>kensing...@gentoo.org</email>
+       </maintainer>
+       <maintainer type="project">
+               <email>harde...@gentoo.org</email>
+               <name>Gentoo Hardened</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="launchpad">apparmor</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to