Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-libs/libapparmor/, sys-libs/libapparmor/files/
Date: Fri, 27 Apr 2018 22:05:07
Message-Id: 1524866654.1fb2a83490c464447b178fb12e86268156d37c86.blueness@gentoo
1 commit: 1fb2a83490c464447b178fb12e86268156d37c86
2 Author: Milkey Mouse <milkeymouse <AT> meme <DOT> institute>
3 AuthorDate: Fri Apr 27 20:53:26 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 27 22:04:14 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=1fb2a834
7
8 sys-libs/libapparmor: add new package
9
10 secure_getenv() is only available from glibc. Borrow a patch from Alpine Linux
11 that adds a standalone version.
12
13 Package-Manager: Portage-2.3.31, Repoman-2.3.9
14 Manifest-Sign-Key: C6EF5A02F5647987
15
16 sys-libs/libapparmor/Manifest | 21 +++
17 .../files/libapparmor-2.10-symbol_visibility.patch | 13 ++
18 .../files/libapparmor-2.12-secure_getenv.patch | 154 +++++++++++++++++++++
19 sys-libs/libapparmor/libapparmor-2.11.1.ebuild | 96 +++++++++++++
20 sys-libs/libapparmor/libapparmor-2.12.0.ebuild | 96 +++++++++++++
21 sys-libs/libapparmor/metadata.xml | 14 ++
22 6 files changed, 394 insertions(+)
23
24 diff --git a/sys-libs/libapparmor/Manifest b/sys-libs/libapparmor/Manifest
25 new file mode 100644
26 index 0000000..6a84fad
27 --- /dev/null
28 +++ b/sys-libs/libapparmor/Manifest
29 @@ -0,0 +1,21 @@
30 +-----BEGIN PGP SIGNED MESSAGE-----
31 +Hash: SHA256
32 +
33 +DIST apparmor-2.11.1.tar.gz 5017646 BLAKE2B ee0176c87b2800eb562c136ff324f08e444c412117c4593ff97c4b0e4c63db2aea0721c6ed38f3c733e3c95024165f329e520acf838c4798a8285b8dedf0d51e SHA512 f088157cc116987e56c0e02127497b1ec6241f3d761ec3b53211fa188f5f02c9408d6b903f2d275328ede88ebfd1393e00aad9f68cbe78fa9ab3711ba0f9c00c
34 +DIST apparmor-2.12.tar.gz 7258450 BLAKE2B c1d4e01d836c5f567ddb7c5ecf36dde6efccf1e59ae219824129fd5c92162a3fed7ebdc492f181ae132b07db068660078a9631543d40fd20ab0b44cd4c646d4c SHA512 d85fd47c66333fe5658ee5e977b32142697f6e36c575550712ee2ace2ad0fbf2aa59c8fd3b82ad8821c0190adf8cc150cf623ea09a84d5b32bde050a03dd6e9a
35 +-----BEGIN PGP SIGNATURE-----
36 +
37 +iQIzBAEBCAAdFiEE8JaD5QHaZGPThRiKxu9aAvVkeYcFAlrjjcYACgkQxu9aAvVk
38 +eYcGMQ/+M6Og6CkCvCW6PBUwYty2EBMAmJc0OctvlxXYhmjJiu9dgvUQz/pZw8xs
39 +MD8Kj2sw+NzwTFwxLsH4CIkSv+oGyDsR8sSPHhYIwI7gA/pxk3i0uK+F3J9EAHFv
40 +cEIqlO12IJ26IHP1UOML4Y6UXAgCNIX5DcpUtcipK2o00azsOPVzfcvpBYQXYTmD
41 +pI2/gRweFtL72MWXBdAzZCl7u6swq7XZg7p14uXYuz6MnQP/THLqxOmhDRUVvfr1
42 +sEAsmPZj9Tsm9PGtUm9wZnduxJMyr6I9JFGN4DTRJIuYfymuzRZ2JTe2sAvRd2Jb
43 +Y8nRR9tsMImqeocQPq7tnMul6ktoMi3LCeHY9OmVWw+ywmSJ0cesLItMIXZg3NsY
44 +N2ja/PqflNblywm+z9T9K89rNfLZakJgNOXesBQwOhFApFIG2dHdWlkbaivUJyyq
45 +cQU1y8UNQzqM0CapgE4KLMGK+g+DvQkGRg4lDOVawbmnaHmQ9cDZPyyz/oni3GQa
46 +6CKg8UiiYjoJCJmeJNccdIgxBDvgTPF0xNNCxnHPyX45EU0qPf+Q5ZGSDsPLDO8C
47 +ZiqZcg4wt4wFpNU3iCwp7MbXtcbr0LOao0eIy6lX8NJ8suCZLMzG+cFJLRPCxI5Q
48 +nbYbzEW614arzb2++EvOf8gmVy7tNQ1KrAxEEg7lRjQMKGyjdn0=
49 +=lOpQ
50 +-----END PGP SIGNATURE-----
51
52 diff --git a/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch b/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch
53 new file mode 100644
54 index 0000000..beaf355
55 --- /dev/null
56 +++ b/sys-libs/libapparmor/files/libapparmor-2.10-symbol_visibility.patch
57 @@ -0,0 +1,13 @@
58 +Adds an aditional symbol to allow dynamic linking.
59 +
60 +--- src/libapparmor.map
61 ++++ src/libapparmor.map
62 +@@ -94,6 +94,7 @@
63 + _aa_autoclose;
64 + _aa_autofclose;
65 + _aa_dirat_for_each;
66 ++ _aa_asprintf;
67 + local:
68 + *;
69 + };
70 +
71
72 diff --git a/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch b/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch
73 new file mode 100644
74 index 0000000..56c4096
75 --- /dev/null
76 +++ b/sys-libs/libapparmor/files/libapparmor-2.12-secure_getenv.patch
77 @@ -0,0 +1,154 @@
78 +--- a/libraries/libapparmor/configure.ac
79 ++++ b/libraries/libapparmor/configure.ac
80 +@@ -81,7 +81,7 @@ AM_CONDITIONAL(HAVE_RUBY, test x$with_ruby = xyes)
81 + AC_HEADER_STDC
82 + AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
83 +
84 +-AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv])
85 ++AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv scandirat])
86 +
87 + AM_PROG_CC_C_O
88 + AC_C_CONST
89 +--- a/libraries/libapparmor/src/Makefile.am
90 ++++ b/libraries/libapparmor/src/Makefile.am
91 +@@ -46,9 +46,9 @@ af_protos.h: /usr/include/netinet/in.h
92 + 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" $< > $@
93 +
94 + lib_LTLIBRARIES = libapparmor.la
95 +-noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h
96 ++noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h secure_getenv.h scandirat.h private.h
97 +
98 +-libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c private.c features.c kernel_interface.c policy_cache.c
99 ++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
100 + libapparmor_la_LDFLAGS = -version-info $(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -dynamic -pthread \
101 + -Wl,--version-script=$(top_srcdir)/src/libapparmor.map
102 +
103 +--- a/libraries/libapparmor/src/private.c
104 ++++ b/libraries/libapparmor/src/private.c
105 +@@ -39,10 +39,14 @@
106 + #ifdef HAVE___SECURE_GETENV
107 + #define secure_getenv __secure_getenv
108 + #else
109 +- #error neither secure_getenv nor __secure_getenv is available
110 ++ #include "secure_getenv.h"
111 + #endif
112 + #endif
113 +
114 ++#ifndef HAVE_SCANDIRAT
115 ++#include "scandirat.h"
116 ++#endif
117 ++
118 + struct ignored_suffix_t {
119 + const char * text;
120 + int len;
121 +--- /dev/null
122 ++++ b/libraries/libapparmor/src/scandirat.c
123 +@@ -0,0 +1,63 @@
124 ++#include <dirent.h>
125 ++#include <string.h>
126 ++#include <stdlib.h>
127 ++#include <unistd.h>
128 ++#include <fcntl.h>
129 ++#include <inttypes.h>
130 ++#include <errno.h>
131 ++
132 ++#include "scandirat.h"
133 ++
134 ++#ifndef HAVE_SCANDIRAT
135 ++
136 ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
137 ++ int (*filter)(const struct dirent *),
138 ++ int (*compar)(const struct dirent **, const struct dirent **))
139 ++{
140 ++ int fd;
141 ++ DIR *d;
142 ++ struct dirent *de, **names=0, **tmp;
143 ++ size_t cnt=0, len=0;
144 ++ int old_errno = errno;
145 ++
146 ++
147 ++ fd = openat(dir_fd, dirp, O_RDONLY|O_CLOEXEC);
148 ++ if (fd == -1) return -1;
149 ++
150 ++ d = fdopendir(fd);
151 ++
152 ++ if (!d) {
153 ++ close(fd);
154 ++ return -1;
155 ++ }
156 ++
157 ++ while ((errno=0), (de = readdir(d))) {
158 ++ if (filter && !filter(de)) continue;
159 ++ if (cnt >= len) {
160 ++ len = 2*len+1;
161 ++ if (len > SIZE_MAX/sizeof *names) break;
162 ++ tmp = realloc(names, len * sizeof *names);
163 ++ if (!tmp) break;
164 ++ names = tmp;
165 ++ }
166 ++ names[cnt] = malloc(de->d_reclen);
167 ++ if (!names[cnt]) break;
168 ++ memcpy(names[cnt++], de, de->d_reclen);
169 ++ }
170 ++
171 ++ closedir(d);
172 ++
173 ++ if (errno) {
174 ++ if (names) while (cnt-->0) free(names[cnt]);
175 ++ free(names);
176 ++ return -1;
177 ++ }
178 ++ errno = old_errno;
179 ++
180 ++ if (compar) qsort(names, cnt, sizeof *names, (int (*)(const void *, const void *))compar);
181 ++ *namelist = names;
182 ++ return cnt;
183 ++}
184 ++
185 ++#endif
186 ++
187 +--- /dev/null
188 ++++ b/libraries/libapparmor/src/scandirat.h
189 +@@ -0,0 +1,13 @@
190 ++#ifndef LIBAPPARMOR_SCANDIRAT_H
191 ++#define LIBAPPARMOR_SCANDIRAT_H
192 ++
193 ++#include <dirent.h>
194 ++
195 ++#ifndef HAVE_SCANDIRAT
196 ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
197 ++ int (*filter)(const struct dirent *),
198 ++ int (*compar)(const struct dirent **, const struct dirent **));
199 ++#endif
200 ++
201 ++#endif
202 ++
203 +--- /dev/null
204 ++++ b/libraries/libapparmor/src/secure_getenv.c
205 +@@ -0,0 +1,15 @@
206 ++#include <stdlib.h>
207 ++#include <sys/auxv.h>
208 ++
209 ++#include "secure_getenv.h"
210 ++
211 ++#ifndef HAVE_SECURE_GETENV
212 ++char *secure_getenv(const char *name)
213 ++{
214 ++ if (!getauxval(AT_SECURE)) {
215 ++ return getenv(name);
216 ++ }
217 ++ return NULL;
218 ++}
219 ++#endif
220 ++
221 +--- /dev/null
222 ++++ b/libraries/libapparmor/src/secure_getenv.h
223 +@@ -0,0 +1,8 @@
224 ++#ifndef LIBAPPARMOR_SECURE_GETENV_H
225 ++#define LIBAPPARMOR_SECURE_GETENV_H
226 ++
227 ++#ifndef HAVE_SECURE_GETENV
228 ++char *secure_getenv(const char *name);
229 ++#endif
230 ++
231 ++#endif
232
233 diff --git a/sys-libs/libapparmor/libapparmor-2.11.1.ebuild b/sys-libs/libapparmor/libapparmor-2.11.1.ebuild
234 new file mode 100644
235 index 0000000..f400c01
236 --- /dev/null
237 +++ b/sys-libs/libapparmor/libapparmor-2.11.1.ebuild
238 @@ -0,0 +1,96 @@
239 +# Copyright 1999-2018 Gentoo Foundation
240 +# Distributed under the terms of the GNU General Public License v2
241 +
242 +EAPI=5
243 +
244 +AUTOTOOLS_AUTORECONF=1
245 +DISTUTILS_OPTIONAL=1
246 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
247 +GENTOO_DEPEND_ON_PERL="no"
248 +
249 +inherit autotools-utils distutils-r1 perl-functions versionator
250 +
251 +MY_PV="$(get_version_component_range 1-2)"
252 +
253 +DESCRIPTION="Library to support AppArmor userspace utilities"
254 +HOMEPAGE="http://apparmor.net/"
255 +SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${PV}.tar.gz"
256 +
257 +LICENSE="LGPL-2.1"
258 +SLOT="0"
259 +KEYWORDS="~amd64 ~x86"
260 +IUSE="doc +perl +python static-libs"
261 +
262 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
263 +
264 +RDEPEND="perl? ( dev-lang/perl:= )
265 + python? ( ${PYTHON_DEPS} )"
266 +
267 +DEPEND="${RDEPEND}
268 + sys-devel/autoconf-archive
269 + sys-devel/bison
270 + sys-devel/flex
271 + doc? ( dev-lang/perl )
272 + perl? ( dev-lang/swig )
273 + python? ( dev-lang/swig )"
274 +
275 +S=${WORKDIR}/apparmor-${PV}/libraries/${PN}
276 +
277 +RESTRICT="test"
278 +
279 +src_prepare() {
280 + rm -r m4 || die "failed to remove bundled macros"
281 + epatch "${FILESDIR}"/${PN}-2.10-symbol_visibility.patch
282 + epatch "${FILESDIR}"/${PN}-2.12-secure_getenv.patch
283 + autotools-utils_src_prepare
284 + use python && distutils-r1_src_prepare
285 +}
286 +
287 +src_configure() {
288 + local myeconfargs=(
289 + $(use_with perl) \
290 + $(use_with python)
291 + )
292 +
293 + autotools-utils_src_configure
294 +}
295 +
296 +src_compile() {
297 + autotools-utils_src_compile -C src
298 + autotools-utils_src_compile -C include
299 + use doc && autotools-utils_src_compile -C doc
300 + use perl && autotools-utils_src_compile -C swig/perl
301 +
302 + if use python ; then
303 + pushd "${BUILD_DIR}"/swig/python > /dev/null
304 + emake libapparmor_wrap.c
305 + distutils-r1_src_compile
306 + popd > /dev/null
307 + fi
308 +}
309 +
310 +src_install() {
311 + autotools-utils_src_install -C src
312 + autotools-utils_src_install -C include
313 + use doc && autotools-utils_src_install -C doc
314 +
315 + if use perl ; then
316 + autotools-utils_src_install -C swig/perl
317 + perl_set_version
318 + insinto "${VENDOR_ARCH}"
319 + doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
320 +
321 + # bug 620886
322 + perl_delete_localpod
323 + perl_fix_packlist
324 + fi
325 +
326 + if use python ; then
327 + pushd "${BUILD_DIR}"/swig/python > /dev/null
328 + distutils-r1_src_install
329 +
330 + python_moduleinto LibAppArmor
331 + python_foreach_impl python_domodule LibAppArmor.py
332 + popd > /dev/null
333 + fi
334 +}
335
336 diff --git a/sys-libs/libapparmor/libapparmor-2.12.0.ebuild b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
337 new file mode 100644
338 index 0000000..fbd2034
339 --- /dev/null
340 +++ b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
341 @@ -0,0 +1,96 @@
342 +# Copyright 1999-2018 Gentoo Foundation
343 +# Distributed under the terms of the GNU General Public License v2
344 +
345 +EAPI=5
346 +
347 +AUTOTOOLS_AUTORECONF=1
348 +DISTUTILS_OPTIONAL=1
349 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
350 +GENTOO_DEPEND_ON_PERL="no"
351 +
352 +inherit autotools-utils distutils-r1 perl-functions versionator
353 +
354 +MY_PV="$(get_version_component_range 1-2)"
355 +
356 +DESCRIPTION="Library to support AppArmor userspace utilities"
357 +HOMEPAGE="http://apparmor.net/"
358 +SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${MY_PV}.tar.gz"
359 +
360 +LICENSE="LGPL-2.1"
361 +SLOT="0"
362 +KEYWORDS="amd64 ~x86"
363 +IUSE="doc +perl +python static-libs"
364 +
365 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
366 +
367 +RDEPEND="perl? ( dev-lang/perl:= )
368 + python? ( ${PYTHON_DEPS} )"
369 +
370 +DEPEND="${RDEPEND}
371 + sys-devel/autoconf-archive
372 + sys-devel/bison
373 + sys-devel/flex
374 + doc? ( dev-lang/perl )
375 + perl? ( dev-lang/swig )
376 + python? ( dev-lang/swig )"
377 +
378 +S=${WORKDIR}/apparmor-${MY_PV}/libraries/${PN}
379 +
380 +RESTRICT="test"
381 +
382 +src_prepare() {
383 + rm -r m4 || die "failed to remove bundled macros"
384 + epatch "${FILESDIR}"/${PN}-2.10-symbol_visibility.patch
385 + epatch "${FILESDIR}"/${PN}-2.12-secure_getenv.patch
386 + autotools-utils_src_prepare
387 + use python && distutils-r1_src_prepare
388 +}
389 +
390 +src_configure() {
391 + local myeconfargs=(
392 + $(use_with perl) \
393 + $(use_with python)
394 + )
395 +
396 + autotools-utils_src_configure
397 +}
398 +
399 +src_compile() {
400 + autotools-utils_src_compile -C src
401 + autotools-utils_src_compile -C include
402 + use doc && autotools-utils_src_compile -C doc
403 + use perl && autotools-utils_src_compile -C swig/perl
404 +
405 + if use python ; then
406 + pushd "${BUILD_DIR}"/swig/python > /dev/null
407 + emake libapparmor_wrap.c
408 + distutils-r1_src_compile
409 + popd > /dev/null
410 + fi
411 +}
412 +
413 +src_install() {
414 + autotools-utils_src_install -C src
415 + autotools-utils_src_install -C include
416 + use doc && autotools-utils_src_install -C doc
417 +
418 + if use perl ; then
419 + autotools-utils_src_install -C swig/perl
420 + perl_set_version
421 + insinto "${VENDOR_ARCH}"
422 + doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
423 +
424 + # bug 620886
425 + perl_delete_localpod
426 + perl_fix_packlist
427 + fi
428 +
429 + if use python ; then
430 + pushd "${BUILD_DIR}"/swig/python > /dev/null
431 + distutils-r1_src_install
432 +
433 + python_moduleinto LibAppArmor
434 + python_foreach_impl python_domodule LibAppArmor.py
435 + popd > /dev/null
436 + fi
437 +}
438
439 diff --git a/sys-libs/libapparmor/metadata.xml b/sys-libs/libapparmor/metadata.xml
440 new file mode 100644
441 index 0000000..42d1e8f
442 --- /dev/null
443 +++ b/sys-libs/libapparmor/metadata.xml
444 @@ -0,0 +1,14 @@
445 +<?xml version="1.0" encoding="UTF-8"?>
446 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
447 +<pkgmetadata>
448 + <maintainer type="person">
449 + <email>kensington@g.o</email>
450 + </maintainer>
451 + <maintainer type="project">
452 + <email>hardened@g.o</email>
453 + <name>Gentoo Hardened</name>
454 + </maintainer>
455 + <upstream>
456 + <remote-id type="launchpad">apparmor</remote-id>
457 + </upstream>
458 +</pkgmetadata>