Gentoo Archives: gentoo-commits

From: Ben Kohler <bkohler@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libsemanage/
Date: Thu, 02 Jul 2020 12:26:47
Message-Id: 1593692794.a79a655cab347b276fcd15c20bc83aaa0a4fe78b.bkohler@gentoo
1 commit: a79a655cab347b276fcd15c20bc83aaa0a4fe78b
2 Author: Ben Kohler <bkohler <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jul 2 12:26:21 2020 +0000
4 Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 2 12:26:34 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a79a655c
7
8 sys-libs/libsemanage: revbump for python fixes
9
10 A python_fix_shebang was needed. Also it's clear that this ebuild has
11 never really been tested with USE="-python", so python is no longer
12 optional.
13
14 With these fixes, the script run in pkg_postinst can be run with || die
15 again.
16
17 Bug: https://bugs.gentoo.org/642634
18 Package-Manager: Portage-2.3.103, Repoman-2.3.23
19 Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>
20
21 sys-libs/libsemanage/libsemanage-3.0-r1.ebuild | 138 +++++++++++++++++++++++++
22 1 file changed, 138 insertions(+)
23
24 diff --git a/sys-libs/libsemanage/libsemanage-3.0-r1.ebuild b/sys-libs/libsemanage/libsemanage-3.0-r1.ebuild
25 new file mode 100644
26 index 00000000000..dcff5645ff9
27 --- /dev/null
28 +++ b/sys-libs/libsemanage/libsemanage-3.0-r1.ebuild
29 @@ -0,0 +1,138 @@
30 +# Copyright 1999-2020 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI="6"
34 +PYTHON_COMPAT=( python{3_6,3_7,3_8} )
35 +
36 +inherit multilib python-r1 toolchain-funcs multilib-minimal
37 +
38 +MY_P="${P//_/-}"
39 +MY_RELEASEDATE="20191204"
40 +
41 +SEPOL_VER="${PV}"
42 +SELNX_VER="${PV}"
43 +
44 +DESCRIPTION="SELinux kernel and policy management library"
45 +HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
46 +
47 +if [[ ${PV} == 9999 ]]; then
48 + inherit git-r3
49 + EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
50 + S="${WORKDIR}/${MY_P}/${PN}"
51 +else
52 + SRC_URI="https://github.com/SELinuxProject/selinux/releases/download/${MY_RELEASEDATE}/${MY_P}.tar.gz"
53 + KEYWORDS="~amd64 ~arm ~arm64 ~mips ~x86"
54 + S="${WORKDIR}/${MY_P}"
55 +fi
56 +
57 +LICENSE="GPL-2"
58 +SLOT="0"
59 +IUSE=""
60 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
61 +
62 +RDEPEND=">=sys-libs/libsepol-${SEPOL_VER}[${MULTILIB_USEDEP}]
63 + >=sys-libs/libselinux-${SELNX_VER}[${MULTILIB_USEDEP}]
64 + >=sys-process/audit-2.2.2[${MULTILIB_USEDEP}]
65 + >=dev-libs/ustr-1.0.4-r2[${MULTILIB_USEDEP}]
66 + ${PYTHON_DEPS}"
67 +DEPEND="${RDEPEND}
68 + >=dev-lang/swig-2.0.4-r1
69 + sys-devel/bison
70 + sys-devel/flex
71 + virtual/pkgconfig"
72 +
73 +# tests are not meant to be run outside of the
74 +# full SELinux userland repo
75 +RESTRICT="test"
76 +
77 +src_prepare() {
78 + eapply_user
79 +
80 + echo >> "${S}/src/semanage.conf"
81 + echo "# Set this to true to save the linked policy." >> "${S}/src/semanage.conf"
82 + echo "# This is normally only useful for analysis" >> "${S}/src/semanage.conf"
83 + echo "# or debugging of policy." >> "${S}/src/semanage.conf"
84 + echo "save-linked=false" >> "${S}/src/semanage.conf"
85 + echo >> "${S}/src/semanage.conf"
86 + echo "# Set this to 0 to disable assertion checking." >> "${S}/src/semanage.conf"
87 + echo "# This should speed up building the kernel policy" >> "${S}/src/semanage.conf"
88 + echo "# from policy modules, but may leave you open to" >> "${S}/src/semanage.conf"
89 + echo "# dangerous rules which assertion checking" >> "${S}/src/semanage.conf"
90 + echo "# would catch." >> "${S}/src/semanage.conf"
91 + echo "expand-check=1" >> "${S}/src/semanage.conf"
92 + echo >> "${S}/src/semanage.conf"
93 + echo "# Modules in the module store can be compressed" >> "${S}/src/semanage.conf"
94 + echo "# with bzip2. Set this to the bzip2 blocksize" >> "${S}/src/semanage.conf"
95 + echo "# 1-9 when compressing. The higher the number," >> "${S}/src/semanage.conf"
96 + echo "# the more memory is traded off for disk space." >> "${S}/src/semanage.conf"
97 + echo "# Set to 0 to disable bzip2 compression." >> "${S}/src/semanage.conf"
98 + echo "bzip-blocksize=0" >> "${S}/src/semanage.conf"
99 + echo >> "${S}/src/semanage.conf"
100 + echo "# Reduce memory usage for bzip2 compression and" >> "${S}/src/semanage.conf"
101 + echo "# decompression of modules in the module store." >> "${S}/src/semanage.conf"
102 + echo "bzip-small=true" >> "${S}/src/semanage.conf"
103 +
104 + multilib_copy_sources
105 +}
106 +
107 +multilib_src_compile() {
108 + emake \
109 + AR="$(tc-getAR)" \
110 + CC="$(tc-getCC)" \
111 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
112 + all
113 +
114 + if multilib_is_native_abi; then
115 + building_py() {
116 + emake \
117 + AR="$(tc-getAR)" \
118 + CC="$(tc-getCC)" \
119 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
120 + "$@"
121 + }
122 + python_foreach_impl building_py swigify
123 + python_foreach_impl building_py pywrap
124 + fi
125 +}
126 +
127 +multilib_src_install() {
128 + emake \
129 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
130 + DESTDIR="${ED}" install
131 +
132 + if multilib_is_native_abi; then
133 + installation_py() {
134 + emake DESTDIR="${ED}" \
135 + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
136 + install-pywrap
137 + python_optimize # bug 531638
138 + }
139 + python_foreach_impl installation_py
140 + fi
141 +}
142 +
143 +multiib_src_install_all() {
144 + python_setup
145 + python_fix_shebang "${ED}"/usr/libexec/selinux/semanage_migrate_store
146 +}
147 +
148 +pkg_postinst() {
149 + # Migrate the SELinux semanage configuration store if not done already
150 + local selinuxtype=$(awk -F'=' '/SELINUXTYPE=/ {print $2}' "${EROOT}"/etc/selinux/config 2>/dev/null)
151 + if [ -n "${selinuxtype}" ] && [ ! -d "${EROOT}"/var/lib/selinux/${selinuxtype}/active ] ; then
152 + ewarn "Since the 2.4 SELinux userspace, the policy module store is moved"
153 + ewarn "from /etc/selinux to /var/lib/selinux. The migration will be run now."
154 + ewarn "If there are any issues, it can be done manually by running:"
155 + ewarn "/usr/libexec/selinux/semanage_migrate_store"
156 + ewarn "For more information, please see"
157 + ewarn "- https://github.com/SELinuxProject/selinux/wiki/Policy-Store-Migration"
158 + fi
159 +
160 + # Run the store migration without rebuilds
161 + for POLICY_TYPE in ${POLICY_TYPES} ; do
162 + if [ ! -d "${EROOT}/var/lib/selinux/${POLICY_TYPE}/active" ] ; then
163 + einfo "Migrating store ${POLICY_TYPE} (without policy rebuild)."
164 + "${EROOT}/usr/libexec/selinux/semanage_migrate_store" -n -s "${POLICY_TYPE}" || die "Failed to migrate store ${POLICY_TYPE}"
165 + fi
166 + done
167 +}