/[gentoo-x86]/sys-apps/policycoreutils/policycoreutils-9999.ebuild
Gentoo

Contents of /sys-apps/policycoreutils/policycoreutils-9999.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Jul 23 05:15:17 2015 UTC (3 years, 1 month ago) by perfinion
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +8 -1 lines
Rebuild policy store in postinst(), there are some changes to the format

(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 0x7EF137EC935B0EAF)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-apps/policycoreutils/policycoreutils-9999.ebuild,v 1.3 2015/07/17 08:03:06 perfinion Exp $
4
5 EAPI="5"
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7 PYTHON_REQ_USE="xml"
8
9 inherit multilib python-r1 toolchain-funcs eutils bash-completion-r1
10
11 MY_P="${P//_/-}"
12
13 MY_RELEASEDATE="20150202"
14 EXTRAS_VER="1.34"
15 SEMNG_VER="${PV}"
16 SELNX_VER="${PV}"
17 SEPOL_VER="${PV}"
18
19 IUSE="audit pam dbus"
20
21 DESCRIPTION="SELinux core utilities"
22 HOMEPAGE="https://github.com/SELinuxProject/selinux/wiki"
23
24 if [[ ${PV} == 9999 ]] ; then
25 inherit git-r3
26 EGIT_REPO_URI="https://github.com/SELinuxProject/selinux.git"
27 SRC_URI="http://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
28 S1="${WORKDIR}/${MY_P}/${PN}"
29 S2="${WORKDIR}/policycoreutils-extra"
30 S="${S1}"
31 else
32 SRC_URI="https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${MY_RELEASEDATE}/${MY_P}.tar.gz
33 http://dev.gentoo.org/~perfinion/distfiles/policycoreutils-extra-${EXTRAS_VER}.tar.bz2"
34 KEYWORDS="~amd64 ~x86"
35 S1="${WORKDIR}/${MY_P}"
36 S2="${WORKDIR}/policycoreutils-extra"
37 S="${S1}"
38 fi
39
40 LICENSE="GPL-2"
41 SLOT="0"
42
43 DEPEND=">=sys-libs/libselinux-${SELNX_VER}:=[python]
44 >=sys-libs/glibc-2.4
45 >=sys-libs/libcap-1.10-r10:=
46 >=sys-libs/libsemanage-${SEMNG_VER}:=[python]
47 sys-libs/libcap-ng:=
48 >=sys-libs/libsepol-${SEPOL_VER}:=
49 sys-devel/gettext
50 dev-python/ipy[${PYTHON_USEDEP}]
51 dbus? (
52 sys-apps/dbus
53 dev-libs/dbus-glib:=
54 )
55 audit? ( >=sys-process/audit-1.5.1 )
56 pam? ( sys-libs/pam:= )
57 ${PYTHON_DEPS}"
58
59 ### libcgroup -> seunshare
60 ### dbus -> restorecond
61
62 # pax-utils for scanelf used by rlpkg
63 RDEPEND="${DEPEND}
64 dev-python/sepolgen
65 app-misc/pax-utils
66 !<sys-apps/openrc-0.14"
67
68 src_unpack() {
69 # Override default one because we need the SRC_URI ones even in case of 9999 ebuilds
70 if [[ ${PV} == 9999 ]] ; then
71 git-r3_src_unpack
72 fi
73 if [ -n ${A} ] ; then
74 S="${S2}"
75 unpack ${A};
76 fi
77 }
78
79 src_prepare() {
80 S="${S1}"
81 cd "${S}" || die "Failed to switch to ${S}"
82 if [[ ${PV} != 9999 ]] ; then
83 # If needed for live ebuilds please use /etc/portage/patches
84 epatch "${FILESDIR}/0010-remove-sesandbox-support.patch"
85 epatch "${FILESDIR}/0020-disable-autodetection-of-pam-and-audit.patch"
86 epatch "${FILESDIR}/0030-make-inotify-check-use-flag-triggered.patch"
87 epatch "${FILESDIR}/0040-reverse-access-check-in-run_init.patch"
88 epatch "${FILESDIR}/0070-remove-symlink-attempt-fails-with-gentoo-sandbox-approach.patch"
89 epatch "${FILESDIR}/0110-build-mcstrans-bug-472912.patch"
90 epatch "${FILESDIR}/0120-build-failure-for-mcscolor-for-CONTEXT__CONTAINS.patch"
91 fi
92
93 # rlpkg is more useful than fixfiles
94 sed -i -e '/^all/s/fixfiles//' "${S}/scripts/Makefile" \
95 || die "fixfiles sed 1 failed"
96 sed -i -e '/fixfiles/d' "${S}/scripts/Makefile" \
97 || die "fixfiles sed 2 failed"
98
99 epatch_user
100
101 sed -i 's/-Werror//g' "${S1}"/*/Makefile || die "Failed to remove Werror"
102
103 python_copy_sources
104 # Our extra code is outside the regular directory, so set it to the extra
105 # directory. We really should optimize this as it is ugly, but the extra
106 # code is needed for Gentoo at the same time that policycoreutils is present
107 # (so we cannot use an additional package for now).
108 S="${S2}"
109 python_copy_sources
110 }
111
112 src_compile() {
113 building() {
114 emake -C "${BUILD_DIR}" \
115 AUDIT_LOG_PRIVS="y" \
116 AUDITH="$(usex audit)" \
117 PAMH="$(usex pam)" \
118 INOTIFYH="$(usex dbus)" \
119 SESANDBOX="n" \
120 CC="$(tc-getCC)" \
121 PYLIBVER="${EPYTHON}" \
122 LIBDIR="\$(PREFIX)/$(get_libdir)"
123 }
124 S="${S1}" # Regular policycoreutils
125 python_foreach_impl building
126 S="${S2}" # Extra set
127 python_foreach_impl building
128 }
129
130 src_install() {
131 # Python scripts are present in many places. There are no extension modules.
132 installation-policycoreutils() {
133 einfo "Installing policycoreutils"
134 emake -C "${BUILD_DIR}" DESTDIR="${D}" \
135 AUDITH="$(usex audit)" \
136 PAMH="$(usex pam)" \
137 INOTIFYH="$(usex dbus)" \
138 SESANDBOX="n" \
139 AUDIT_LOG_PRIV="y" \
140 PYLIBVER="${EPYTHON}" \
141 LIBDIR="\$(PREFIX)/$(get_libdir)" \
142 install
143 python_optimize
144 }
145
146 installation-extras() {
147 einfo "Installing policycoreutils-extra"
148 emake -C "${BUILD_DIR}" DESTDIR="${D}" INOTIFYH="$(usex dbus)" SHLIBDIR="${D}$(get_libdir)/rc" install
149 python_optimize
150 }
151
152 S="${S1}" # policycoreutils
153 python_foreach_impl installation-policycoreutils
154 S="${S2}" # extras
155 python_foreach_impl installation-extras
156 S="${S1}" # back for later
157
158 # remove redhat-style init script
159 rm -fR "${D}/etc/rc.d" || die
160
161 # compatibility symlinks
162 dosym /sbin/setfiles /usr/sbin/setfiles
163 bashcomp_alias setsebool getsebool
164
165 # location for policy definitions
166 dodir /var/lib/selinux
167 keepdir /var/lib/selinux
168
169 # Set version-specific scripts
170 for pyscript in audit2allow sepolgen-ifgen sepolicy chcat; do
171 python_replicate_script "${ED}/usr/bin/${pyscript}"
172 done
173 for pyscript in semanage rlpkg; do
174 python_replicate_script "${ED}/usr/sbin/${pyscript}"
175 done
176
177 dodir /usr/share/doc/${PF}/mcstrans/examples
178 cp -dR "${S1}"/mcstrans/share/examples/* "${D}/usr/share/doc/${PF}/mcstrans/examples" || die
179 }
180
181 pkg_postinst() {
182 # The selinux_gentoo init script is no longer needed with recent OpenRC
183 elog "The selinux_gentoo init script has been removed in this version as it is not required after OpenRC 0.13."
184
185 for POLICY_TYPE in ${POLICY_TYPES} ; do
186 # There have been some changes to the policy store, rebuilding now.
187 # https://marc.info/?l=selinux&m=143757277819717&w=2
188 einfo "Rebuilding store ${POLICY_TYPE} (without re-loading)."
189 semodule -s "${POLICY_TYPE}" -n -B || die "Failed to rebuild policy store ${POLICY_TYPE}"
190 done
191 }

  ViewVC Help
Powered by ViewVC 1.1.20