Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libcap/, sys-libs/libcap/files/
Date: Wed, 21 Nov 2018 10:22:43
Message-Id: 1542795709.59f6430683709e7a024158fc5bdb73c7552bbb9d.polynomial-c@gentoo
1 commit: 59f6430683709e7a024158fc5bdb73c7552bbb9d
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 21 10:21:49 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 21 10:21:49 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59f64306
7
8 sys-libs/libcap: Bump to version 2.26
9
10 Closes: https://bugs.gentoo.org/660608
11 Package-Manager: Portage-2.3.52, Repoman-2.3.12
12 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
13
14 sys-libs/libcap/Manifest | 1 +
15 sys-libs/libcap/files/libcap-2.26-no-perl.patch | 61 +++++++++++++++++++
16 sys-libs/libcap/libcap-2.26.ebuild | 78 +++++++++++++++++++++++++
17 3 files changed, 140 insertions(+)
18
19 diff --git a/sys-libs/libcap/Manifest b/sys-libs/libcap/Manifest
20 index cdffcfa42f2..d2c104bfab3 100644
21 --- a/sys-libs/libcap/Manifest
22 +++ b/sys-libs/libcap/Manifest
23 @@ -1 +1,2 @@
24 DIST libcap-2.25.tar.xz 63672 BLAKE2B 205790dea83f15b585e5151814ea520ab1545661d18fa57f36e8c8e597a7c0f0ff1d7b5ccffc36e313eb28606f1e71678233a06896e29cb28e5559b190dd47ed SHA512 c3ab491885292adc171cde542b96f1295e84132febb50112a46575c3bde3a3eb6fcf733f7a756b4b656e013c0abb5ed6571db24799f8c0b23d8f759f992864f9
25 +DIST libcap-2.26.tar.xz 67172 BLAKE2B 9d1952bd03e1bba5ffa225a5088b8d841c2007219bbb9524f979ac65e472bf932db496acf93984fa77fe42e71d45b85cd603ca461a071fb4742526dfbc5f66eb SHA512 1c2d59f007226405a924950b2c2090393527e06f0692a84e6463e33915a070df61a9070b8f30a624d5630ddd39290eac117e5d440577d1edd48510195b9d12f0
26
27 diff --git a/sys-libs/libcap/files/libcap-2.26-no-perl.patch b/sys-libs/libcap/files/libcap-2.26-no-perl.patch
28 new file mode 100644
29 index 00000000000..55ee34ee71f
30 --- /dev/null
31 +++ b/sys-libs/libcap/files/libcap-2.26-no-perl.patch
32 @@ -0,0 +1,61 @@
33 +From c15a25a61d64efe8f7b29c1e2d0a96885835ec59 Mon Sep 17 00:00:00 2001
34 +From: Mike Frysinger <vapier@g.o>
35 +Date: Wed, 21 Nov 2018 11:00:54 +0100
36 +Subject: [PATCH] use awk/sed instead of perl for creating header files
37 +
38 +More systems should have awk/sed than perl.
39 +
40 +Signed-off-by: Mike Frysinger <vapier@g.o>
41 +
42 +Forward ported from libcap-2.22 to libcap-2.26
43 +and incorporated the gperf-3.1 fix provided by Mike Gilbert
44 +<floppym@g.o>
45 +
46 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
47 +---
48 + libcap/Makefile | 21 +++++++++++++++++----
49 + 1 file changed, 17 insertions(+), 4 deletions(-)
50 +
51 +diff --git a/libcap/Makefile b/libcap/Makefile
52 +index 77b26c5..a3f0507 100644
53 +--- a/libcap/Makefile
54 ++++ b/libcap/Makefile
55 +@@ -18,6 +18,8 @@ MAJLIBNAME=$(LIBNAME).$(VERSION)
56 + MINLIBNAME=$(MAJLIBNAME).$(MINOR)
57 + GPERF_OUTPUT = _caps_output.gperf
58 + CFLAGS += -fPIC
59 ++AWK = awk
60 ++SED = sed
61 +
62 + all: $(MINLIBNAME) $(STALIBNAME) libcap.pc
63 +
64 +@@ -42,11 +44,22 @@ cap_names.h: _makenames
65 + ./_makenames > cap_names.h
66 +
67 + $(GPERF_OUTPUT): cap_names.list.h
68 +- perl -e 'print "struct __cap_token_s { const char *name; int index; };\n%{\nconst struct __cap_token_s *__cap_lookup_name(const char *, size_t);\n%}\n%%\n"; while ($$l = <>) { $$l =~ s/[\{\"]//g; $$l =~ s/\}.*// ; print $$l; }' < $< | gperf --ignore-case --language=ANSI-C --readonly --null-strings --global-table --hash-function-name=__cap_hash_name --lookup-function-name="__cap_lookup_name" -c -t -m20 $(INDENT) > $@
69 ++ (printf "%b" "struct __cap_token_s { const char *name; int index; };\n%%\n"; \
70 ++ $(SED) -e 's:["{}]::g' -e 's:,$$::' $<) | \
71 ++ gperf \
72 ++ --ignore-case \
73 ++ --language=ANSI-C \
74 ++ --includes \
75 ++ --readonly \
76 ++ --null-strings \
77 ++ --global-table \
78 ++ --hash-function-name=__cap_hash_name \
79 ++ --lookup-function-name="__cap_lookup_name" \
80 ++ -c -t -m20 $(INDENT) > $@
81 +
82 +-cap_names.list.h: Makefile $(KERNEL_HEADERS)/linux/capability.h
83 +- @echo "=> making $@ from $(KERNEL_HEADERS)/linux/capability.h"
84 +- perl -e 'while ($$l=<>) { if ($$l =~ /^\#define[ \t](CAP[_A-Z]+)[ \t]+([0-9]+)\s+$$/) { $$tok=$$1; $$val=$$2; $$tok =~ tr/A-Z/a-z/; print "{\"$$tok\",$$val},\n"; } }' $(KERNEL_HEADERS)/linux/capability.h | fgrep -v 0x > $@
85 ++cap_names.list.h: $(KERNEL_HEADERS)/linux/capability.h Makefile
86 ++ @echo "=> making $@ from $<"
87 ++ $(AWK) '($$0 ~ /^#define[[:space:]]+CAP[_A-Z]+[[:space:]]+[0-9]+[[:space:]]*$$/) { printf "{\"%s\",%s},\n", tolower($$2), $$3 }' $< > $@
88 +
89 + $(STALIBNAME): $(OBJS)
90 + $(AR) rcs $@ $^
91 +--
92 +2.20.0.rc0
93 +
94
95 diff --git a/sys-libs/libcap/libcap-2.26.ebuild b/sys-libs/libcap/libcap-2.26.ebuild
96 new file mode 100644
97 index 00000000000..3a944d5dc0c
98 --- /dev/null
99 +++ b/sys-libs/libcap/libcap-2.26.ebuild
100 @@ -0,0 +1,78 @@
101 +# Copyright 1999-2018 Gentoo Authors
102 +# Distributed under the terms of the GNU General Public License v2
103 +
104 +EAPI=6
105 +
106 +inherit multilib multilib-minimal toolchain-funcs pam
107 +
108 +DESCRIPTION="POSIX 1003.1e capabilities"
109 +HOMEPAGE="http://www.friedhoff.org/posixfilecaps.html"
110 +SRC_URI="mirror://kernel/linux/libs/security/linux-privs/libcap2/${P}.tar.xz"
111 +
112 +# it's available under either of the licenses
113 +LICENSE="|| ( GPL-2 BSD )"
114 +SLOT="0"
115 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux"
116 +IUSE="pam static-libs"
117 +
118 +# While the build system optionally uses gperf, we don't DEPEND on it because
119 +# the build automatically falls back when it's unavailable. #604802
120 +RDEPEND=">=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}]
121 + pam? ( virtual/pam )"
122 +DEPEND="${RDEPEND}
123 + sys-kernel/linux-headers"
124 +
125 +# Requires test suite being run as root (via sudo)
126 +RESTRICT="test"
127 +
128 +PATCHES=(
129 + "${FILESDIR}"/${PN}-2.25-build-system-fixes.patch
130 + "${FILESDIR}"/${PN}-2.26-no-perl.patch
131 + "${FILESDIR}"/${PN}-2.25-ignore-RAISE_SETFCAP-install-failures.patch
132 + "${FILESDIR}"/${PN}-2.21-include.patch
133 +)
134 +
135 +src_prepare() {
136 + default
137 + multilib_copy_sources
138 +}
139 +
140 +multilib_src_configure() {
141 + sed -i \
142 + -e "/^PAM_CAP/s:=.*:=$(multilib_native_usex pam yes no):" \
143 + -e '/^DYNAMIC/s:=.*:=yes:' \
144 + -e '/^lib_prefix=/s:=.*:=$(prefix):' \
145 + -e "/^lib=/s:=.*:=$(get_libdir):" \
146 + Make.Rules
147 +}
148 +
149 +multilib_src_compile() {
150 + tc-export AR CC RANLIB
151 + local BUILD_CC
152 + tc-export_build_env BUILD_CC
153 +
154 + default
155 +}
156 +
157 +multilib_src_install() {
158 + # no configure, needs explicit install line #444724#c3
159 + emake install DESTDIR="${ED}"
160 +
161 + gen_usr_ldscript -a cap
162 + if ! use static-libs ; then
163 + rm "${ED%/}"/usr/$(get_libdir)/libcap.a || die
164 + fi
165 +
166 + if [[ -d "${ED%/}"/usr/$(get_libdir)/security ]] ; then
167 + rm -r "${ED%/}"/usr/$(get_libdir)/security || die
168 + fi
169 +
170 + if multilib_is_native_abi && use pam; then
171 + dopammod pam_cap/pam_cap.so
172 + dopamsecurity '' pam_cap/capability.conf
173 + fi
174 +}
175 +
176 +multilib_src_install_all() {
177 + dodoc CHANGELOG README doc/capability.notes
178 +}