Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/policycoreutils/
Date: Sun, 31 Oct 2021 02:55:10
Message-Id: 1635648622.e11c9d52b7dee58553322cddd4b77c3163b82181.sam@gentoo
1 commit: e11c9d52b7dee58553322cddd4b77c3163b82181
2 Author: Jonathan Davies <jpds <AT> protonmail <DOT> com>
3 AuthorDate: Sun Oct 24 11:49:42 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 31 02:50:22 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e11c9d52
7
8 sys-apps/policycoreutils: Version updated to 3.3.
9
10 Signed-off-by: Jonathan Davies <jpds <AT> protonmail.com>
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 sys-apps/policycoreutils/Manifest | 1 +
14 .../policycoreutils/policycoreutils-3.3.ebuild | 162 +++++++++++++++++++++
15 2 files changed, 163 insertions(+)
16
17 diff --git a/sys-apps/policycoreutils/Manifest b/sys-apps/policycoreutils/Manifest
18 index ffa4bcb42aa..ca90fbb5a9d 100644
19 --- a/sys-apps/policycoreutils/Manifest
20 +++ b/sys-apps/policycoreutils/Manifest
21 @@ -1,3 +1,4 @@
22 DIST policycoreutils-3.1.tar.gz 2817914 BLAKE2B ef68bb5f9cf577164ead44803b6be2bd6401c9e923d2c775c7c8c47f0e803749feaec4247fec5cc1cb766314954402fd2506370bb397f746437ecfcf65b384f3 SHA512 0592f218563a99ba95d2cfd07fdc3761b61c1cc3c01a17ab89ad840169e1a7d4083521d5cacc72d1b76911d516bf592db7a3f90d9ef0cc11ceed007e4580e140
23 DIST policycoreutils-3.2.tar.gz 2817961 BLAKE2B 747cbd7b84ffa9153067340f8f1dc5a652eaf85b037a6e10e116d3d0b31c8e7c9794bc6a46ae212848bef4887478ac167e359a387bebac49e0acd08b727808ce SHA512 d16781d2d61b8b78d6fc242f2b5c3a03f47ea524fb61655823b6b0f0327ff376c65fe7bdf7a53f5863c01e599cf4a7050f21fda0fe6a8f2c2c16f89b156a4346
24 +DIST policycoreutils-3.3.tar.gz 2818092 BLAKE2B 0ed9f128a774176ebadb71f448af8dee8c616a706314783b646869e7ea91892e358d5bb03e3aece3d0e6dc3203852e4e2925482727df1e5c71e075236ee43e5c SHA512 db658990355f99a8e43f53d20cc67bf9e557b0a7837d1927c80f325b7f93ad47876382278a980b818484d6e31712a9b03e279f947ebc88c4be60a9f395607f98
25 DIST policycoreutils-extra-1.37.tar.bz2 8809 BLAKE2B a7f6122c2e27f54b018174e962bd7f4c14af04e09bbb5300bde6967ea7f2dc5cd03b5787919a4e7f5288bcbc6747922962b5bd3b588ab1e3a035fbff4910d8f5 SHA512 0a85cd7cf279256b5e1927f9dfdd89626a1c8b77b0aeb62b496e7e8d1dccbaa315e39f9308fb2df7270f0bc1c10787b19990e7365cad74b47b61e30394c8b23f
26
27 diff --git a/sys-apps/policycoreutils/policycoreutils-3.3.ebuild b/sys-apps/policycoreutils/policycoreutils-3.3.ebuild
28 new file mode 100644
29 index 00000000000..c8fe18af66f
30 --- /dev/null
31 +++ b/sys-apps/policycoreutils/policycoreutils-3.3.ebuild
32 @@ -0,0 +1,162 @@
33 +# Copyright 1999-2021 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI="7"
37 +PYTHON_COMPAT=( python{3_7,3_8,3_9} )
38 +PYTHON_REQ_USE="xml"
39 +
40 +inherit multilib python-r1 toolchain-funcs bash-completion-r1
41 +
42 +EXTRAS_VER="1.37"
43 +
44 +IUSE="audit pam split-usr"
45 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
46 +
47 +DESCRIPTION="SELinux core utilities"
48 +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
49 +
50 +if [[ ${PV} == 9999 ]]; then
51 + inherit git-r3
52 + EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
53 + SRC_URI="https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
54 + S1="${WORKDIR}/${PN}"
55 + S2="${WORKDIR}/policycoreutils-extra"
56 + S="${S1}"
57 +else
58 + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${PV}/${P}.tar.gz
59 + https://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
60 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
61 + S1="${WORKDIR}/${P}"
62 + S2="${WORKDIR}/policycoreutils-extra"
63 + S="${S1}"
64 +fi
65 +
66 +LICENSE="GPL-2"
67 +SLOT="0"
68 +
69 +DEPEND=">=sys-libs/libselinux-${PV}:=[python,${PYTHON_USEDEP}]
70 + >=sys-libs/libsemanage-${PV}:=[python(+),${PYTHON_USEDEP}]
71 + >=sys-libs/libsepol-${PV}:=
72 + sys-libs/libcap-ng:=
73 + >=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
74 + audit? ( >=sys-process/audit-1.5.1[python,${PYTHON_USEDEP}] )
75 + pam? ( sys-libs/pam:= )
76 + ${PYTHON_DEPS}"
77 +
78 +# Avoid dependency loop in the cross-compile case, bug #755173
79 +# (Still exists in native)
80 +BDEPEND="sys-devel/gettext"
81 +
82 +# pax-utils for scanelf used by rlpkg
83 +RDEPEND="${DEPEND}
84 + app-misc/pax-utils"
85 +
86 +PDEPEND="sys-apps/semodule-utils
87 + sys-apps/selinux-python"
88 +
89 +src_unpack() {
90 + # Override default one because we need the SRC_URI ones even in case of 9999 ebuilds
91 + default
92 + if [[ ${PV} == 9999 ]] ; then
93 + git-r3_src_unpack
94 + fi
95 +}
96 +
97 +src_prepare() {
98 + S="${S1}"
99 + cd "${S}" || die "Failed to switch to ${S}"
100 + if [[ ${PV} != 9999 ]] ; then
101 + # If needed for live ebuilds please use /etc/portage/patches
102 + eapply "${FILESDIR}/policycoreutils-3.1-0001-newrole-not-suid.patch"
103 + fi
104 +
105 + # rlpkg is more useful than fixfiles
106 + sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \
107 + || die "fixfiles sed 1 failed"
108 + sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \
109 + || die "fixfiles sed 2 failed"
110 +
111 + eapply_user
112 +
113 + sed -i 's/-Werror//g' "${S1}"/*/Makefile || die "Failed to remove Werror"
114 +
115 + python_copy_sources
116 + # Our extra code is outside the regular directory, so set it to the extra
117 + # directory. We really should optimize this as it is ugly, but the extra
118 + # code is needed for Gentoo at the same time that policycoreutils is present
119 + # (so we cannot use an additional package for now).
120 + S="${S2}"
121 + python_copy_sources
122 +}
123 +
124 +src_compile() {
125 + building() {
126 + emake -C "${BUILD_DIR}" \
127 + AUDIT_LOG_PRIVS="y" \
128 + AUDITH="$(usex audit y n)" \
129 + PAMH="$(usex pam y n)" \
130 + SESANDBOX="n" \
131 + CC="$(tc-getCC)" \
132 + LIBDIR="\$(PREFIX)/$(get_libdir)"
133 + }
134 + S="${S1}" # Regular policycoreutils
135 + python_foreach_impl building
136 + S="${S2}" # Extra set
137 + python_foreach_impl building
138 +}
139 +
140 +src_install() {
141 + # Python scripts are present in many places. There are no extension modules.
142 + installation-policycoreutils() {
143 + einfo "Installing policycoreutils"
144 + emake -C "${BUILD_DIR}" DESTDIR="${D}" \
145 + AUDIT_LOG_PRIVS="y" \
146 + AUDITH="$(usex audit y n)" \
147 + PAMH="$(usex pam y n)" \
148 + SESANDBOX="n" \
149 + CC="$(tc-getCC)" \
150 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
151 + install
152 + python_optimize
153 + }
154 +
155 + installation-extras() {
156 + einfo "Installing policycoreutils-extra"
157 + emake -C "${BUILD_DIR}" \
158 + DESTDIR="${D}" \
159 + install
160 + python_optimize
161 + }
162 +
163 + S="${S1}" # policycoreutils
164 + python_foreach_impl installation-policycoreutils
165 + S="${S2}" # extras
166 + python_foreach_impl installation-extras
167 + S="${S1}" # back for later
168 +
169 + # remove redhat-style init script
170 + rm -fR "${D}/etc/rc.d" || die
171 +
172 + # compatibility symlinks
173 + use split-usr && dosym ../../sbin/setfiles /usr/sbin/setfiles
174 +
175 + bashcomp_alias setsebool getsebool
176 +
177 + # location for policy definitions
178 + dodir /var/lib/selinux
179 + keepdir /var/lib/selinux
180 +
181 + # Set version-specific scripts
182 + for pyscript in rlpkg; do
183 + python_replicate_script "${ED}/usr/sbin/${pyscript}"
184 + done
185 +}
186 +
187 +pkg_postinst() {
188 + for POLICY_TYPE in ${POLICY_TYPES} ; do
189 + # There have been some changes to the policy store, rebuilding now.
190 + # https://marc.info/?l=selinux&m=143757277819717&w=2
191 + einfo "Rebuilding store ${POLICY_TYPE} (without re-loading)."
192 + semodule -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}"
193 + done
194 +}