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-libs/libsemanage/
Date: Sun, 31 Oct 2021 02:55:09
Message-Id: 1635648620.fb9f5cb302f7af37b4d077be1227da0287cdb46e.sam@gentoo
1 commit: fb9f5cb302f7af37b4d077be1227da0287cdb46e
2 Author: Jonathan Davies <jpds <AT> protonmail <DOT> com>
3 AuthorDate: Sun Oct 24 11:46:28 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 31 02:50:20 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb9f5cb3
7
8 sys-libs/libsemanage: 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-libs/libsemanage/Manifest | 1 +
14 sys-libs/libsemanage/libsemanage-3.3.ebuild | 127 ++++++++++++++++++++++++++++
15 2 files changed, 128 insertions(+)
16
17 diff --git a/sys-libs/libsemanage/Manifest b/sys-libs/libsemanage/Manifest
18 index 72d9050a7a5..eea237e73a7 100644
19 --- a/sys-libs/libsemanage/Manifest
20 +++ b/sys-libs/libsemanage/Manifest
21 @@ -1,2 +1,3 @@
22 DIST libsemanage-3.1.tar.gz 179601 BLAKE2B 69450a4eda1f3728d339f65db1eec9940995fcea5208d17dca531ebc998aefbfec48fe91beffa3490e1502953aa550405fb696635d01b0eb8050c8f00f11106a SHA512 8609ca7d13b5c603677740f2b14558fea3922624af182d20d618237ba11fcf2559fab82fc68d1efa6ff118f064d426f005138521652c761de92cd66150102197
23 DIST libsemanage-3.2.tar.gz 178839 BLAKE2B c0925812d784923a7a239ba919fc0a0e1d84cb528cbf4a357fb7938d3c06ebd2f0b60cd3eba40b76bf7c2922a081b99b16b32dc16638aa1bfce32553e241fb9f SHA512 6ad670bb298b1bab506217b12a3fda5d2209f4387a11410f0c1b65f765ffb579b0d70795dee19048909e0b72ef904fc318be60d5a01f80ab12742ce07647a084
24 +DIST libsemanage-3.3.tar.gz 178890 BLAKE2B f1ff2d25f0c98e9794cb443365e6193db80a42104b645ef4edf783db2eb3d940d1f39cddfa59f9a86ba16957c77852159b3ced83c5d01ecb1811aa6255f8be83 SHA512 6026d9773c0886436ad801bc0c8beac888b6fb62034edeb863192dea4b6ef34a88e080758820fe635a20e048ac666beee505a0f946258f18571709cca5228aad
25
26 diff --git a/sys-libs/libsemanage/libsemanage-3.3.ebuild b/sys-libs/libsemanage/libsemanage-3.3.ebuild
27 new file mode 100644
28 index 00000000000..88db66d921c
29 --- /dev/null
30 +++ b/sys-libs/libsemanage/libsemanage-3.3.ebuild
31 @@ -0,0 +1,127 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +PYTHON_COMPAT=( python3_{7..9} )
37 +
38 +inherit python-r1 toolchain-funcs multilib-minimal
39 +
40 +MY_PV="${PV//_/-}"
41 +MY_P="${PN}-${MY_PV}"
42 +
43 +DESCRIPTION="SELinux kernel and policy management library"
44 +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
45 +
46 +if [[ ${PV} == 9999 ]]; then
47 + inherit git-r3
48 + EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
49 + S="${WORKDIR}/${P}/${PN}"
50 +else
51 + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_PV}/${MY_P}.tar.gz"
52 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~riscv ~x86"
53 + S="${WORKDIR}/${MY_P}"
54 +fi
55 +
56 +LICENSE="GPL-2"
57 +SLOT="0/2"
58 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
59 +
60 +RDEPEND=">=sys-libs/libsepol-${PV}:=[${MULTILIB_USEDEP}]
61 + >=sys-libs/libselinux-${PV}:=[${MULTILIB_USEDEP}]
62 + >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
63 + ${PYTHON_DEPS}"
64 +DEPEND="${RDEPEND}"
65 +BDEPEND=">=dev-lang/swig-2.0.4-r1
66 + sys-devel/bison
67 + sys-devel/flex
68 + virtual/pkgconfig"
69 +
70 +# tests are not meant to be run outside of the
71 +# full SELinux userland repo
72 +RESTRICT="test"
73 +
74 +src_prepare() {
75 + eapply_user
76 +
77 + echo >> "${S}/src/semanage.conf"
78 + echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
79 + echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
80 + echo "# or debugging of policy." >> "${S}/src/semanage.conf"
81 + echo "save-linked=false" >> "${S}/src/semanage.conf"
82 + echo >> "${S}/src/semanage.conf"
83 + echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
84 + echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
85 + echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
86 + echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
87 + echo "# would catch." >> "${S}/src/semanage.conf"
88 + echo "expand-check=1" >> "${S}/src/semanage.conf"
89 + echo >> "${S}/src/semanage.conf"
90 + echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
91 + echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
92 + echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
93 + echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
94 + echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
95 + echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
96 + echo >> "${S}/src/semanage.conf"
97 + echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
98 + echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
99 + echo "bzip-small=true" >> "${S}/src/semanage.conf"
100 +
101 + multilib_copy_sources
102 +}
103 +
104 +multilib_src_compile() {
105 + local -x CFLAGS="${CFLAGS} -fno-semantic-interposition"
106 +
107 + emake \
108 + AR="$(tc-getAR)" \
109 + CC="$(tc-getCC)" \
110 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
111 + all
112 +
113 + if multilib_is_native_abi; then
114 + building_py() {
115 + emake \
116 + AR="$(tc-getAR)" \
117 + CC="$(tc-getCC)" \
118 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
119 + "$@"
120 + }
121 + python_foreach_impl building_py swigify
122 + python_foreach_impl building_py pywrap
123 + fi
124 +}
125 +
126 +multilib_src_install() {
127 + emake \
128 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
129 + DESTDIR="${ED}" install
130 +
131 + if multilib_is_native_abi; then
132 + installation_py() {
133 + emake DESTDIR="${ED}" \
134 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
135 + install-pywrap
136 + python_optimize # bug 531638
137 + }
138 + python_foreach_impl installation_py
139 + fi
140 +}
141 +
142 +multiib_src_install_all() {
143 + python_setup
144 + python_fix_shebang "${ED}"/usr/libexec/selinux/semanage_migrate_store
145 +}
146 +
147 +pkg_postinst() {
148 + # Migrate the SELinux semanage configuration store if not done already
149 + local selinuxtype=$(awk -F'=' '/SELINUXTYPE=/ {print $2}' "${EROOT}"/etc/selinux/config 2>/dev/null)
150 + if [ -n "${selinuxtype}" ] && [ ! -d "${EROOT}"/var/lib/selinux/${selinuxtype}/active ] ; then
151 + ewarn "Since the 2.4 SELinux userspace, the policy module store is moved"
152 + ewarn "from /etc/selinux to /var/lib/selinux. The migration will be run now."
153 + ewarn "If there are any issues, it can be done manually by running:"
154 + ewarn "/usr/libexec/selinux/semanage_migrate_store"
155 + ewarn "For more information, please see"
156 + ewarn "- https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration"
157 + fi
158 +}