Re: [gentoo-dev] [PATCH 2/2] selinux-policy-2.eclass: drop EAPI 5

2020-11-03 Thread Ulrich Mueller
> On Tue, 03 Nov 2020, Ulrich Mueller wrote:

> Presumably it would also be cleaner to test if POLICY_PATCH is an array,
> and use '"${POLICY_PATCH[@]}"' if it is but '${POLICY_PATCH}' if it is
> not.

In fact you could use the same code as in default src_prepare:
https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-90001r2

Ulrich


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH 2/2] selinux-policy-2.eclass: drop EAPI 5

2020-11-03 Thread Ulrich Mueller
> On Mon, 02 Nov 2020, David Michael wrote:
 
>   for POLPATCH in ${POLICY_PATCH[@]};
>   do
> - if [[ ${EAPI:-0} == 5 ]]; then
> - epatch "${POLPATCH}"
> - else
> - eapply "${POLPATCH}"
> - fi
> + eapply "${POLPATCH}"
>   done

eapply can accept multiple parameters, so I think that a simple
'eapply ${POLICY_PATCH[@]}' would do the job.

Presumably it would also be cleaner to test if POLICY_PATCH is an array,
and use '"${POLICY_PATCH[@]}"' if it is but '${POLICY_PATCH}' if it is
not.

Ulrich


signature.asc
Description: PGP signature


[gentoo-dev] [PATCH 2/2] selinux-policy-2.eclass: drop EAPI 5

2020-11-02 Thread David Michael
Signed-off-by: David Michael 
---

Grepping through the ebuilds using this eclass shows that they're all on
EAPI 6.  A bunch of workarounds could be dropped along with EAPI 5, but
it isn't necessary to fix anything, so feel free to ignore this patch.

 eclass/selinux-policy-2.eclass | 38 --
 1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 3ba310e49de..ce7643ecf15 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -7,7 +7,7 @@
 # @ECLASS: selinux-policy-2.eclass
 # @MAINTAINER:
 # seli...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7
 # @BLURB: This eclass supports the deployment of the various SELinux modules 
in sec-policy
 # @DESCRIPTION:
 # The selinux-policy-2.eclass supports deployment of the various SELinux 
modules
@@ -75,8 +75,8 @@
 : ${SELINUX_GIT_BRANCH:="master"};
 
 case "${EAPI:-0}" in
-   0|1|2|3|4) die "EAPI<5 is not supported";;
-   5|6|7) : ;;
+   0|1|2|3|4|5) die "EAPI<6 is not supported";;
+   6|7) : ;;
*) die "unknown EAPI" ;;
 esac
 
@@ -87,10 +87,6 @@ case ${BASEPOL} in
EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
 esac
 
-if [[ ${EAPI:-0} == 5 ]]; then
-   inherit eutils
-fi
-
 IUSE=""
 
 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux;
@@ -117,7 +113,7 @@ else
RDEPEND=">=sys-apps/policycoreutils-2.0.82
>=sec-policy/selinux-base-policy-${PV}"
 fi
-if [[ ${EAPI:-0} == [56] ]]; then
+if [[ ${EAPI:-0} == 6 ]]; then
DEPEND="${RDEPEND}
sys-devel/m4
>=sys-apps/checkpolicy-2.0.21"
@@ -162,25 +158,13 @@ selinux-policy-2_src_prepare() {
# Patch the sources with the base patchbundle
if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "" ]]; then
cd "${S}"
-   if [[ ${EAPI:-0} == 5 ]]; then
-   EPATCH_MULTI_MSG="Applying SELinux policy updates ... " 
\
-   EPATCH_SUFFIX="patch" \
-   EPATCH_SOURCE="${WORKDIR}" \
-   EPATCH_FORCE="yes" \
-   epatch
-   else
-   einfo "Applying SELinux policy updates ... "
-   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
-   fi
+   einfo "Applying SELinux policy updates ... "
+   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
fi
 
-   # Call in epatch_user. We do this early on as we start moving
+   # Call in eapply_user. We do this early on as we start moving
# files left and right hereafter.
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch_user
-   else
-   eapply_user
-   fi
+   eapply_user
 
# Copy additional files to the 3rd_party/ location
if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] 
||
@@ -200,11 +184,7 @@ selinux-policy-2_src_prepare() {
cd "${S}/refpolicy/policy/modules"
for POLPATCH in ${POLICY_PATCH[@]};
do
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch "${POLPATCH}"
-   else
-   eapply "${POLPATCH}"
-   fi
+   eapply "${POLPATCH}"
done
fi
 
-- 
2.26.2