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/selinux-python/
Date: Sun, 31 Oct 2021 02:55:13
Message-Id: 1635648625.5855eccb1934700fe374623f4fee1b0801a6d3f5.sam@gentoo
1 commit: 5855eccb1934700fe374623f4fee1b0801a6d3f5
2 Author: Jonathan Davies <jpds <AT> protonmail <DOT> com>
3 AuthorDate: Sun Oct 24 11:53:59 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 31 02:50:25 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5855eccb
7
8 sys-apps/selinux-python: Version updated to 3.3, with changes:
9
10 * Dropped optional-networkx.patch - applied upstream.
11
12 Signed-off-by: Jonathan Davies <jpds <AT> protonmail.com>
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 sys-apps/selinux-python/Manifest | 1 +
16 sys-apps/selinux-python/selinux-python-3.3.ebuild | 111 ++++++++++++++++++++++
17 2 files changed, 112 insertions(+)
18
19 diff --git a/sys-apps/selinux-python/Manifest b/sys-apps/selinux-python/Manifest
20 index ef17a3d066a..ab68bfe1578 100644
21 --- a/sys-apps/selinux-python/Manifest
22 +++ b/sys-apps/selinux-python/Manifest
23 @@ -1,2 +1,3 @@
24 DIST selinux-python-3.1.tar.gz 2100549 BLAKE2B c5d207bad60c379259e3bfc8f029f76d4572818cdd41a263498ed4434a70eaf7ff51af7772cfb27de0e9e4af03bcf9906ab0f6a59e88de10e81cbe0e8c5928b8 SHA512 5dd98f77ae8ea8bac6a89ec7def76e12496b9a9f8c9612c4cc1dac7a8e8c60380a00c857426bfefbcb4273706addd2594e9b467f69408ef284f082a09d45bd49
25 DIST selinux-python-3.2.tar.gz 2101106 BLAKE2B b4b185a7468de68eb2146011a9bc82ffb7db9878517833c1e8dfa23279aec3dfbf46a27b70b17c1e317a2c939bcf6d1748638fd4a078325b853de34ae3c51a6f SHA512 2c3483e27c4ad6942e23e39897e0eccf61b95d685ace62315678cb49739d300d4ca4a7a51fa7a9aacaa98737446a70923855d15827eb6275ffd6999be0b2a755
26 +DIST selinux-python-3.3.tar.gz 2101584 BLAKE2B 603aafbf316b744098bd34c79bf384d55624c086fd75147675a4a0715df3d61710a99d490f30b78d59a2c2a85fcc4db91772c24644a963b31e1a0d305c4bc83e SHA512 a69948a8b139a309f18632440e4204f49832a94b8b6be50e162d3dacb16698effeb1a77c44462e8cc7dc3dd600b887b9ab2fef618c31d3e0fe0de216a6aaebe3
27
28 diff --git a/sys-apps/selinux-python/selinux-python-3.3.ebuild b/sys-apps/selinux-python/selinux-python-3.3.ebuild
29 new file mode 100644
30 index 00000000000..8e1f90984a8
31 --- /dev/null
32 +++ b/sys-apps/selinux-python/selinux-python-3.3.ebuild
33 @@ -0,0 +1,111 @@
34 +# Copyright 1999-2021 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +PYTHON_COMPAT=( python3_{7..9} )
39 +PYTHON_REQ_USE="xml"
40 +
41 +inherit python-r1 toolchain-funcs
42 +
43 +IUSE="test"
44 +RESTRICT="!test? ( test )"
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 + S="${WORKDIR}/${P}/${PN#selinux-}"
54 +else
55 + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${PV}/${P}.tar.gz"
56 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
57 +fi
58 +
59 +LICENSE="GPL-2"
60 +SLOT="0"
61 +
62 +RDEPEND=">=sys-libs/libselinux-${PV}:=[python]
63 + >=sys-libs/libsemanage-${PV}:=[python(+)]
64 + >=sys-libs/libsepol-${PV}:=
65 + >=app-admin/setools-4.2.0[${PYTHON_USEDEP}]
66 + >=sys-process/audit-1.5.1[python,${PYTHON_USEDEP}]
67 + ${PYTHON_DEPS}"
68 +DEPEND="${RDEPEND}"
69 +BDEPEND="
70 + test? (
71 + ${RDEPEND}
72 + >=sys-apps/secilc-${PV}
73 + )"
74 +
75 +src_prepare() {
76 + default
77 + sed -i 's/-Werror//g' "${S}"/*/Makefile || die "Failed to remove Werror"
78 +
79 + python_copy_sources
80 +}
81 +
82 +src_compile() {
83 + building() {
84 + emake -C "${BUILD_DIR}" \
85 + CC="$(tc-getCC)" \
86 + LIBDIR="\$(PREFIX)/$(get_libdir)"
87 + }
88 + python_foreach_impl building
89 +}
90 +
91 +src_test() {
92 + testing() {
93 + # The different subprojects have some interproject dependencies:
94 + # - audit2allow depens on sepolgen
95 + # - chcat depends on semanage
96 + # and maybe others.
97 + # Add all the modules of the individual subprojects to the
98 + # PYTHONPATH, so they get actually found and used. In
99 + # particular, already installed versions on the system are not
100 + # used.
101 + for dir in audit2allow chcat semanage sepolgen/src sepolicy ; do
102 + PYTHONPATH="${BUILD_DIR}/${dir}:${PYTHONPATH}"
103 + done
104 + PYTHONPATH=${PYTHONPATH} \
105 + emake -C "${BUILD_DIR}" \
106 + test
107 + }
108 + python_foreach_impl testing
109 +}
110 +
111 +src_install() {
112 + installation() {
113 + emake -C "${BUILD_DIR}" \
114 + DESTDIR="${D}" \
115 + LIBDIR="\$(PREFIX)/$(get_libdir)" \
116 + install
117 + python_optimize
118 + }
119 + python_foreach_impl installation
120 +
121 + # Set version-specific scripts
122 + for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do
123 + python_replicate_script "${ED}/usr/bin/${pyscript}"
124 + done
125 + for pyscript in semanage; do
126 + python_replicate_script "${ED}/usr/sbin/${pyscript}"
127 + done
128 +
129 + # Create sepolgen.conf with different devel location definition
130 + if [[ -f /etc/selinux/config ]];
131 + then
132 + local selinuxtype=$(awk -F'=' '/^SELINUXTYPE/ {print $2}' /etc/selinux/config);
133 + mkdir -p "${D}"/etc/selinux || die "Failed to create selinux directory";
134 + echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
135 + else
136 + local selinuxtype="${POLICY_TYPES%% *}";
137 + if [[ -n "${selinuxtype}" ]];
138 + then
139 + echo "SELINUX_DEVEL_PATH=/usr/share/selinux/${selinuxtype}/include:/usr/share/selinux/${selinuxtype}" > "${D}"/etc/selinux/sepolgen.conf;
140 + else
141 + echo "SELINUX_DEVEL_PATH=/usr/share/selinux/strict/include:/usr/share/selinux/strict" > "${D}"/etc/selinux/sepolgen.conf;
142 + fi
143 + fi
144 +}