Gentoo Archives: gentoo-dev

From: David Michael <fedora.dm0@×××××.com>
To: gentoo-dev@l.g.o
Cc: selinux@g.o
Subject: [gentoo-dev] [PATCH v2 2/2] selinux-policy-2.eclass: drop EAPI 5
Date: Tue, 03 Nov 2020 14:31:01
Message-Id: 87mtzyikcl.fsf@gmail.com
1 Signed-off-by: David Michael <fedora.dm0@×××××.com>
2 ---
3
4 Changes since v1:
5 - Dropped unnecessary EAPI default value
6 - Fixed eapply array awareness
7
8 eclass/selinux-policy-2.eclass | 47 +++++++++-------------------------
9 1 file changed, 12 insertions(+), 35 deletions(-)
10
11 diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
12 index 3ba310e49de..5def86fbef9 100644
13 --- a/eclass/selinux-policy-2.eclass
14 +++ b/eclass/selinux-policy-2.eclass
15 @@ -7,7 +7,7 @@
16 # @ECLASS: selinux-policy-2.eclass
17 # @MAINTAINER:
18 # selinux@g.o
19 -# @SUPPORTED_EAPIS: 5 6 7
20 +# @SUPPORTED_EAPIS: 6 7
21 # @BLURB: This eclass supports the deployment of the various SELinux modules in sec-policy
22 # @DESCRIPTION:
23 # The selinux-policy-2.eclass supports deployment of the various SELinux modules
24 @@ -75,8 +75,8 @@
25 : ${SELINUX_GIT_BRANCH:="master"};
26
27 case "${EAPI:-0}" in
28 - 0|1|2|3|4) die "EAPI<5 is not supported";;
29 - 5|6|7) : ;;
30 + 0|1|2|3|4|5) die "EAPI<6 is not supported";;
31 + 6|7) : ;;
32 *) die "unknown EAPI" ;;
33 esac
34
35 @@ -87,10 +87,6 @@ case ${BASEPOL} in
36 EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
37 esac
38
39 -if [[ ${EAPI:-0} == 5 ]]; then
40 - inherit eutils
41 -fi
42 -
43 IUSE=""
44
45 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
46 @@ -117,7 +113,7 @@ else
47 RDEPEND=">=sys-apps/policycoreutils-2.0.82
48 >=sec-policy/selinux-base-policy-${PV}"
49 fi
50 -if [[ ${EAPI:-0} == [56] ]]; then
51 +if [[ ${EAPI} == 6 ]]; then
52 DEPEND="${RDEPEND}
53 sys-devel/m4
54 >=sys-apps/checkpolicy-2.0.21"
55 @@ -162,25 +158,13 @@ selinux-policy-2_src_prepare() {
56 # Patch the sources with the base patchbundle
57 if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; then
58 cd "${S}"
59 - if [[ ${EAPI:-0} == 5 ]]; then
60 - EPATCH_MULTI_MSG="Applying SELinux policy updates ... " \
61 - EPATCH_SUFFIX="patch" \
62 - EPATCH_SOURCE="${WORKDIR}" \
63 - EPATCH_FORCE="yes" \
64 - epatch
65 - else
66 - einfo "Applying SELinux policy updates ... "
67 - eapply -p0 "${WORKDIR}/0001-full-patch-against-stable-release.patch"
68 - fi
69 + einfo "Applying SELinux policy updates ... "
70 + eapply -p0 "${WORKDIR}/0001-full-patch-against-stable-release.patch"
71 fi
72
73 - # Call in epatch_user. We do this early on as we start moving
74 + # Call in eapply_user. We do this early on as we start moving
75 # files left and right hereafter.
76 - if [[ ${EAPI:-0} == 5 ]]; then
77 - epatch_user
78 - else
79 - eapply_user
80 - fi
81 + eapply_user
82
83 # Copy additional files to the 3rd_party/ location
84 if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] ||
85 @@ -195,17 +179,10 @@ selinux-policy-2_src_prepare() {
86
87 # Apply the additional patches refered to by the module ebuild.
88 # But first some magic to differentiate between bash arrays and strings
89 - if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]] ||
90 - [[ -n ${POLICY_PATCH} ]]; then
91 - cd "${S}/refpolicy/policy/modules"
92 - for POLPATCH in ${POLICY_PATCH[@]};
93 - do
94 - if [[ ${EAPI:-0} == 5 ]]; then
95 - epatch "${POLPATCH}"
96 - else
97 - eapply "${POLPATCH}"
98 - fi
99 - done
100 + if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]]; then
101 + [[ -n ${POLICY_PATCH[*]} ]] && eapply -d "${S}/refpolicy/policy/modules" "${POLICY_PATCH[@]}"
102 + else
103 + [[ -n ${POLICY_PATCH} ]] && eapply -d "${S}/refpolicy/policy/modules" ${POLICY_PATCH}
104 fi
105
106 # Collect only those files needed for this particular module
107 --
108 2.26.2