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/files/, sys-libs/libapparmor/
Date: Fri, 27 Apr 2018 21:56:39
Message-Id: 1524859350.2485547768696f2341cb011a596001deec0be271.blueness@gentoo
1 commit: 2485547768696f2341cb011a596001deec0be271
2 Author: g3ngr33n <gengreen <AT> gmx <DOT> com>
3 AuthorDate: Fri Apr 27 18:38:04 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 27 20:02:30 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=24855477
7
8 libapparmor
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11
12 sys-libs/libapparmor/Manifest | 4 +
13 .../libapparmor/files/libapparmor-2.12-musl.patch | 163 +++++++++++++++++++++
14 sys-libs/libapparmor/libapparmor-2.12.0.ebuild | 95 ++++++++++++
15 sys-libs/libapparmor/metadata.xml | 14 ++
16 4 files changed, 276 insertions(+)
17
18 diff --git a/sys-libs/libapparmor/Manifest b/sys-libs/libapparmor/Manifest
19 new file mode 100644
20 index 0000000..f81d0a1
21 --- /dev/null
22 +++ b/sys-libs/libapparmor/Manifest
23 @@ -0,0 +1,4 @@
24 +AUX libapparmor-2.12-musl.patch 3985 BLAKE2B 011f4fa5ef60156510918624bba6b88c5b4335b02cb078f5b8c79071c97bd5c2f1cd2091580d8770133ca22217e4c26cd9f96b9bc8a01b8f719a2e6ff85efabb SHA512 2498ac90882c36d63a54017486e0a750bcc5feff87bd265f6098366cd633315fce884c208fd9f431a9aca9c1c9b60f941b28c16aff0a82543d99605e8d7582a5
25 +DIST apparmor-2.12.tar.gz 7258450 BLAKE2B c1d4e01d836c5f567ddb7c5ecf36dde6efccf1e59ae219824129fd5c92162a3fed7ebdc492f181ae132b07db068660078a9631543d40fd20ab0b44cd4c646d4c SHA512 d85fd47c66333fe5658ee5e977b32142697f6e36c575550712ee2ace2ad0fbf2aa59c8fd3b82ad8821c0190adf8cc150cf623ea09a84d5b32bde050a03dd6e9a
26 +EBUILD libapparmor-2.12.0.ebuild 2117 BLAKE2B 89c78a072c2c03b9d1542ddf36e1ba9990ab53e6fcef9f54554e28fa2d7ded4bedf2c154767b529938bd326552d839a5f2e655c6d463e2691c291fc30b2553bc SHA512 45e04eafa5c3eb66d056779aa9d3a6f95d4abbe8fe1ced37bb0ac4c7219accad80a9af3811a31705ab1e9ff399f19fb038711297ba9f1a75bb06a7ca861cdc95
27 +MISC metadata.xml 409 BLAKE2B 63cb1726a015cf118e8ffcc8cf9d49795a75d367e36b0332fbf23faad8b3eed41e2ae090cc92757e12248d831e0ea1782b6f275ef02b7d2d2022bf2b79f69042 SHA512 a66647c5e40f2593017942c12786dc30995e7980fdb58c1de0b9ae34069434cb5a4c70b2bd268a239df82edfcc1e7288e8033bf57609f757a321639afd5e78b8
28
29 diff --git a/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch b/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch
30 new file mode 100644
31 index 0000000..d2bc594
32 --- /dev/null
33 +++ b/sys-libs/libapparmor/files/libapparmor-2.12-musl.patch
34 @@ -0,0 +1,163 @@
35 +--- a/configure.ac 2018-04-15 04:23:39.953481823 +0000
36 ++++ b/configure.ac 2018-04-15 04:33:34.474448938 +0000
37 +@@ -81,7 +81,7 @@
38 + AC_HEADER_STDC
39 + AC_CHECK_HEADERS(unistd.h stdint.h syslog.h)
40 +
41 +-AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv])
42 ++AC_CHECK_FUNCS([asprintf __secure_getenv secure_getenv scandirat])
43 +
44 + AM_PROG_CC_C_O
45 + AC_C_CONST
46 +--- a/src/Makefile.am
47 ++++ b/src/Makefile.am
48 +@@ -46,9 +46,9 @@
49 + 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" $< > $@
50 +
51 + lib_LTLIBRARIES = libapparmor.la
52 +-noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h
53 ++noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h secure_getenv.h scandirat.h private.h
54 +
55 +-libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c private.c features.c kernel_interface.c policy_cache.c
56 ++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
57 + libapparmor_la_LDFLAGS = -version-info $(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -dynamic -pthread \
58 + -Wl,--version-script=$(top_srcdir)/src/libapparmor.map
59 +
60 +--- a/src/private.c
61 ++++ b/src/private.c
62 +@@ -39,10 +39,14 @@
63 + #ifdef HAVE___SECURE_GETENV
64 + #define secure_getenv __secure_getenv
65 + #else
66 +- #error neither secure_getenv nor __secure_getenv is available
67 ++ #include "secure_getenv.h"
68 + #endif
69 + #endif
70 +
71 ++#ifndef HAVE_SCANDIRAT
72 ++#include "scandirat.h"
73 ++#endif
74 ++
75 + struct ignored_suffix_t {
76 + const char * text;
77 + int len;
78 +--- /dev/null
79 ++++ b/src/scandirat.c
80 +@@ -0,0 +1,62 @@
81 ++#include <dirent.h>
82 ++#include <string.h>
83 ++#include <stdlib.h>
84 ++#include <unistd.h>
85 ++#include <fcntl.h>
86 ++#include <inttypes.h>
87 ++#include <errno.h>
88 ++
89 ++#include "scandirat.h"
90 ++
91 ++#ifndef HAVE_SCANDIRAT
92 ++
93 ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
94 ++ int (*filter)(const struct dirent *),
95 ++ int (*compar)(const struct dirent **, const struct dirent **))
96 ++{
97 ++ int fd;
98 ++ DIR *d;
99 ++ struct dirent *de, **names=0, **tmp;
100 ++ size_t cnt=0, len=0;
101 ++ int old_errno = errno;
102 ++
103 ++
104 ++ fd = openat(dir_fd, dirp, O_RDONLY|O_CLOEXEC);
105 ++ if (fd == -1) return -1;
106 ++
107 ++ d = fdopendir(fd);
108 ++
109 ++ if (!d) {
110 ++ close(fd);
111 ++ return -1;
112 ++ }
113 ++
114 ++ while ((errno=0), (de = readdir(d))) {
115 ++ if (filter && !filter(de)) continue;
116 ++ if (cnt >= len) {
117 ++ len = 2*len+1;
118 ++ if (len > SIZE_MAX/sizeof *names) break;
119 ++ tmp = realloc(names, len * sizeof *names);
120 ++ if (!tmp) break;
121 ++ names = tmp;
122 ++ }
123 ++ names[cnt] = malloc(de->d_reclen);
124 ++ if (!names[cnt]) break;
125 ++ memcpy(names[cnt++], de, de->d_reclen);
126 ++ }
127 ++
128 ++ closedir(d);
129 ++
130 ++ if (errno) {
131 ++ if (names) while (cnt-->0) free(names[cnt]);
132 ++ free(names);
133 ++ return -1;
134 ++ }
135 ++ errno = old_errno;
136 ++
137 ++ if (compar) qsort(names, cnt, sizeof *names, (int (*)(const void *, const void *))compar);
138 ++ *namelist = names;
139 ++ return cnt;
140 ++}
141 ++
142 ++#endif
143 +--- /dev/null
144 ++++ b/src/scandirat.h
145 +@@ -0,0 +1,13 @@
146 ++#ifndef LIBAPPARMOR_SCANDIRAT_H
147 ++#define LIBAPPARMOR_SCANDIRAT_H
148 ++
149 ++#include <dirent.h>
150 ++
151 ++#ifndef HAVE_SCANDIRAT
152 ++int scandirat(int dir_fd, const char *dirp, struct dirent ***namelist,
153 ++ int (*filter)(const struct dirent *),
154 ++ int (*compar)(const struct dirent **, const struct dirent **));
155 ++#endif
156 ++
157 ++#endif
158 ++
159 +--- /dev/null
160 ++++ b/src/secure_getenv.c
161 +@@ -0,0 +1,15 @@
162 ++#include <stdlib.h>
163 ++#include <sys/auxv.h>
164 ++
165 ++#include "secure_getenv.h"
166 ++
167 ++#ifndef HAVE_SECURE_GETENV
168 ++char *secure_getenv(const char *name)
169 ++{
170 ++ if (!getauxval(AT_SECURE)) {
171 ++ return getenv(name);
172 ++ }
173 ++ return NULL;
174 ++}
175 ++#endif
176 ++
177 +--- /dev/null
178 ++++ b/src/secure_getenv.h
179 +@@ -0,0 +1,8 @@
180 ++#ifndef LIBAPPARMOR_SECURE_GETENV_H
181 ++#define LIBAPPARMOR_SECURE_GETENV_H
182 ++
183 ++#ifndef HAVE_SECURE_GETENV
184 ++char *secure_getenv(const char *name);
185 ++#endif
186 ++
187 ++#endif
188 +--- a/src/libapparmor.map
189 ++++ b/src/libapparmor.map
190 +@@ -94,6 +94,7 @@
191 + _aa_autoclose;
192 + _aa_autofclose;
193 + _aa_dirat_for_each;
194 ++ _aa_asprintf;
195 + local:
196 + *;
197 + };
198
199 diff --git a/sys-libs/libapparmor/libapparmor-2.12.0.ebuild b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
200 new file mode 100644
201 index 0000000..0c1038d
202 --- /dev/null
203 +++ b/sys-libs/libapparmor/libapparmor-2.12.0.ebuild
204 @@ -0,0 +1,95 @@
205 +# Copyright 1999-2018 Gentoo Foundation
206 +# Distributed under the terms of the GNU General Public License v2
207 +
208 +EAPI=5
209 +
210 +AUTOTOOLS_AUTORECONF=1
211 +DISTUTILS_OPTIONAL=1
212 +PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
213 +GENTOO_DEPEND_ON_PERL="no"
214 +
215 +inherit autotools-utils distutils-r1 perl-functions versionator
216 +
217 +MY_PV="$(get_version_component_range 1-2)"
218 +
219 +DESCRIPTION="Library to support AppArmor userspace utilities"
220 +HOMEPAGE="http://apparmor.net/"
221 +SRC_URI="https://launchpad.net/apparmor/${MY_PV}/${PV}/+download/apparmor-${MY_PV}.tar.gz"
222 +
223 +LICENSE="LGPL-2.1"
224 +SLOT="0"
225 +KEYWORDS="amd64 ~x86"
226 +IUSE="doc +perl +python static-libs"
227 +
228 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
229 +
230 +RDEPEND="perl? ( dev-lang/perl:= )
231 + python? ( ${PYTHON_DEPS} )"
232 +
233 +DEPEND="${RDEPEND}
234 + sys-devel/autoconf-archive
235 + sys-devel/bison
236 + sys-devel/flex
237 + doc? ( dev-lang/perl )
238 + perl? ( dev-lang/swig )
239 + python? ( dev-lang/swig )"
240 +
241 +S=${WORKDIR}/apparmor-${MY_PV}/libraries/${PN}
242 +
243 +PATCHES=( "${FILESDIR}/libapparmor-${MY_PV}-musl.patch" )
244 +
245 +RESTRICT="test"
246 +
247 +src_prepare() {
248 + autotools-utils_src_prepare
249 + use python && distutils-r1_src_prepare
250 +}
251 +
252 +src_configure() {
253 + local myeconfargs=(
254 + $(use_with perl) \
255 + $(use_with python)
256 + )
257 +
258 + autotools-utils_src_configure
259 +}
260 +
261 +src_compile() {
262 + autotools-utils_src_compile -C src
263 + autotools-utils_src_compile -C include
264 + use doc && autotools-utils_src_compile -C doc
265 + use perl && autotools-utils_src_compile -C swig/perl
266 +
267 + if use python ; then
268 + pushd "${BUILD_DIR}"/swig/python > /dev/null
269 + emake libapparmor_wrap.c
270 + distutils-r1_src_compile
271 + popd > /dev/null
272 + fi
273 +}
274 +
275 +src_install() {
276 + autotools-utils_src_install -C src
277 + autotools-utils_src_install -C include
278 + use doc && autotools-utils_src_install -C doc
279 +
280 + if use perl ; then
281 + autotools-utils_src_install -C swig/perl
282 + perl_set_version
283 + insinto "${VENDOR_ARCH}"
284 + doins "${BUILD_DIR}"/swig/perl/LibAppArmor.pm
285 +
286 + # bug 620886
287 + perl_delete_localpod
288 + perl_fix_packlist
289 + fi
290 +
291 + if use python ; then
292 + pushd "${BUILD_DIR}"/swig/python > /dev/null
293 + distutils-r1_src_install
294 +
295 + python_moduleinto LibAppArmor
296 + python_foreach_impl python_domodule LibAppArmor.py
297 + popd > /dev/null
298 + fi
299 +}
300
301 diff --git a/sys-libs/libapparmor/metadata.xml b/sys-libs/libapparmor/metadata.xml
302 new file mode 100644
303 index 0000000..42d1e8f
304 --- /dev/null
305 +++ b/sys-libs/libapparmor/metadata.xml
306 @@ -0,0 +1,14 @@
307 +<?xml version="1.0" encoding="UTF-8"?>
308 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
309 +<pkgmetadata>
310 + <maintainer type="person">
311 + <email>kensington@g.o</email>
312 + </maintainer>
313 + <maintainer type="project">
314 + <email>hardened@g.o</email>
315 + <name>Gentoo Hardened</name>
316 + </maintainer>
317 + <upstream>
318 + <remote-id type="launchpad">apparmor</remote-id>
319 + </upstream>
320 +</pkgmetadata>