1 |
commit: c5f5e2d2fdda488e4f0b7b5b4be32d7232762968 |
2 |
Author: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
3 |
AuthorDate: Tue May 1 13:38:47 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Tue May 1 13:38:47 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=c5f5e2d2 |
7 |
|
8 |
Adding support for python3, fix for seobject.py |
9 |
|
10 |
--- |
11 |
.../policycoreutils-2.1.10-r3.ebuild | 158 ++++++++++++++++++++ |
12 |
1 files changed, 158 insertions(+), 0 deletions(-) |
13 |
|
14 |
diff --git a/sys-apps/policycoreutils/policycoreutils-2.1.10-r3.ebuild b/sys-apps/policycoreutils/policycoreutils-2.1.10-r3.ebuild |
15 |
new file mode 100644 |
16 |
index 0000000..ee7ca71 |
17 |
--- /dev/null |
18 |
+++ b/sys-apps/policycoreutils/policycoreutils-2.1.10-r3.ebuild |
19 |
@@ -0,0 +1,158 @@ |
20 |
+# Copyright 1999-2012 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/policycoreutils/policycoreutils-2.1.10-r1.ebuild,v 1.1 2012/04/29 10:08:04 swift Exp $ |
23 |
+ |
24 |
+EAPI="4" |
25 |
+PYTHON_DEPEND="*" |
26 |
+PYTHON_USE_WITH="xml" |
27 |
+SUPPORT_PYTHON_ABIS="1" |
28 |
+RESTRICT_PYTHON_ABIS="*-jython" |
29 |
+ |
30 |
+inherit multilib python toolchain-funcs eutils |
31 |
+ |
32 |
+EXTRAS_VER="1.21" |
33 |
+SEMNG_VER="2.1.6" |
34 |
+SELNX_VER="2.1.9" |
35 |
+SEPOL_VER="2.1.4" |
36 |
+ |
37 |
+IUSE="audit pam dbus sesandbox" |
38 |
+ |
39 |
+DESCRIPTION="SELinux core utilities" |
40 |
+HOMEPAGE="http://userspace.selinuxproject.org" |
41 |
+SRC_URI="http://userspace.selinuxproject.org/releases/20120216/${P}.tar.gz |
42 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-sesandbox.patch.gz |
43 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-fix-makefile-pam-audit.patch.gz |
44 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-fix-seunshare.patch.gz |
45 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-fix-nodbus_or_libcg.patch.gz |
46 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-fix-rlpkg-python3.patch.gz |
47 |
+ http://dev.gentoo.org/~swift/patches/policycoreutils/policycoreutils-2.1.10-seobject-python3.patch.gz |
48 |
+ mirror://gentoo/policycoreutils-2.0.85-python3.tar.gz |
49 |
+ mirror://gentoo/policycoreutils-extra-${EXTRAS_VER}.tar.bz2" |
50 |
+ |
51 |
+LICENSE="GPL-2" |
52 |
+SLOT="0" |
53 |
+KEYWORDS="~amd64 ~x86" |
54 |
+ |
55 |
+COMMON_DEPS=">=sys-libs/libselinux-${SELNX_VER}[python] |
56 |
+ >=sys-libs/glibc-2.4 |
57 |
+ >=sys-libs/libcap-1.10-r10 |
58 |
+ >=sys-libs/libsemanage-${SEMNG_VER}[python] |
59 |
+ sys-libs/libcap-ng |
60 |
+ >=sys-libs/libsepol-${SEPOL_VER} |
61 |
+ sys-devel/gettext |
62 |
+ sesandbox? ( dev-libs/libcgroup ) |
63 |
+ dbus? ( |
64 |
+ sys-apps/dbus |
65 |
+ dev-libs/dbus-glib |
66 |
+ ) |
67 |
+ audit? ( >=sys-process/audit-1.5.1 ) |
68 |
+ pam? ( sys-libs/pam )" |
69 |
+ |
70 |
+### libcgroup -> seunshare |
71 |
+### dbus -> restorecond |
72 |
+ |
73 |
+# pax-utils for scanelf used by rlpkg |
74 |
+RDEPEND="${COMMON_DEPS} |
75 |
+ dev-python/sepolgen |
76 |
+ app-misc/pax-utils" |
77 |
+ |
78 |
+DEPEND="${COMMON_DEPS}" |
79 |
+ |
80 |
+S2=${WORKDIR}/policycoreutils-extra |
81 |
+ |
82 |
+src_prepare() { |
83 |
+ # rlpkg is more useful than fixfiles |
84 |
+ sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \ |
85 |
+ || die "fixfiles sed 1 failed" |
86 |
+ sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \ |
87 |
+ || die "fixfiles sed 2 failed" |
88 |
+ # We currently do not support MCS, so the sandbox code in policycoreutils |
89 |
+ # is not usable yet. However, work for MCS is on the way and a reported |
90 |
+ # vulnerability (bug #374897) might go by unnoticed if we ignore it now. |
91 |
+ # As such, we will |
92 |
+ # - prepare support for switching name from "sandbox" to "sesandbox" |
93 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-sesandbox.patch.gz" |
94 |
+ # Disable auto-detection of PAM and audit related stuff and override |
95 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-fix-makefile-pam-audit.patch.gz" |
96 |
+ # - Fix build failure on seunshare |
97 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-fix-seunshare.patch.gz" |
98 |
+ # - Make sandbox & dbus-depending stuff (restorecond) USE-triggered |
99 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-fix-nodbus_or_libcg.patch.gz" |
100 |
+ # Overwrite gl.po, id.po and et.po with valid PO file |
101 |
+ cp "${S}/po/sq.po" "${S}/po/gl.po" || die "failed to copy ${S}/po/sq.po to gl.po" |
102 |
+ cp "${S}/po/sq.po" "${S}/po/id.po" || die "failed to copy ${S}/po/sq.po to id.po" |
103 |
+ cp "${S}/po/sq.po" "${S}/po/et.po" || die "failed to copy ${S}/po/sq.po to et.po" |
104 |
+ # Fixed scripts for Python 3 support |
105 |
+ cp "${WORKDIR}/seobject.py" "${S}/semanage/seobject.py" || die "failed to copy seobject.py" |
106 |
+ cp "${WORKDIR}/semanage" "${S}/semanage/semanage" || die "failed to copy semanage" |
107 |
+ cp "${WORKDIR}/chcat" "${S}/scripts/chcat" || die "failed to copy chcat" |
108 |
+ cp "${WORKDIR}/audit2allow" "${S}/audit2allow/audit2allow" || die "failed to copy audit2allow" |
109 |
+ # Further patching for python3 support |
110 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-seobject-python3.patch.gz" |
111 |
+ # Fix rlpkg for python3 support |
112 |
+ cd "${S2}"; |
113 |
+ epatch "${DISTDIR}/policycoreutils-2.1.10-fix-rlpkg-python3.patch.gz" |
114 |
+} |
115 |
+ |
116 |
+src_compile() { |
117 |
+ local use_audit="n"; |
118 |
+ local use_pam="n"; |
119 |
+ local use_dbus="n"; |
120 |
+ local use_sesandbox="n"; |
121 |
+ |
122 |
+ use audit && use_audit="y"; |
123 |
+ use pam && use_pam="y"; |
124 |
+ use dbus && use_dbus="y"; |
125 |
+ use sesandbox && use_sesandbox="y"; |
126 |
+ |
127 |
+ python_copy_sources semanage sandbox |
128 |
+ building() { |
129 |
+ einfo "Compiling policycoreutils" |
130 |
+ emake -C "${S}" AUDIT_LOG_PRIVS="y" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" CC="$(tc-getCC)" PYLIBVER="python$(python_get_version)" || die |
131 |
+ einfo "Compiling policycoreutils-extra " |
132 |
+ emake -C "${S2}" AUDIT_LOG_PRIVS="y" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" CC="$(tc-getCC)" PYLIBVER="python$(python_get_version)" || die |
133 |
+ } |
134 |
+ python_execute_function -s --source-dir semanage building |
135 |
+} |
136 |
+ |
137 |
+src_install() { |
138 |
+ local use_audit="n"; |
139 |
+ local use_pam="n"; |
140 |
+ local use_dbus="n"; |
141 |
+ local use_sesandbox="n"; |
142 |
+ |
143 |
+ use audit && use_audit="y"; |
144 |
+ use pam && use_pam="y"; |
145 |
+ use dbus && use_dbus="y"; |
146 |
+ use sesandbox && use_sesandbox="y"; |
147 |
+ |
148 |
+ # Python scripts are present in many places. There are no extension modules. |
149 |
+ installation() { |
150 |
+ einfo "Installing policycoreutils" |
151 |
+ emake -C "${S}" DESTDIR="${T}/images/${PYTHON_ABI}" AUDITH="${use_audit}" PAMH="${use_pam}" INOTIFYH="${use_dbus}" SESANDBOX="${use_sesandbox}" AUDIT_LOG_PRIV="y" PYLIBVER="python$(python_get_version)" install || return 1 |
152 |
+ |
153 |
+ einfo "Installing policycoreutils-extra" |
154 |
+ emake -C "${S2}" DESTDIR="${T}/images/${PYTHON_ABI}" SHLIBDIR="${D}$(get_libdir)/rc" install || return 1 |
155 |
+ } |
156 |
+ python_execute_function installation |
157 |
+ python_merge_intermediate_installation_images "${T}/images" |
158 |
+ |
159 |
+ # remove redhat-style init script |
160 |
+ rm -fR "${D}/etc/rc.d" |
161 |
+ |
162 |
+ # compatibility symlinks |
163 |
+ dosym /sbin/setfiles /usr/sbin/setfiles |
164 |
+ dosym /$(get_libdir)/rc/runscript_selinux.so /$(get_libdir)/rcscripts/runscript_selinux.so |
165 |
+ |
166 |
+ # location for permissive definitions |
167 |
+ dodir /var/lib/selinux |
168 |
+ keepdir /var/lib/selinux |
169 |
+} |
170 |
+ |
171 |
+pkg_postinst() { |
172 |
+ python_mod_optimize seobject.py |
173 |
+} |
174 |
+ |
175 |
+pkg_postrm() { |
176 |
+ python_mod_cleanup seobject.py |
177 |
+} |