commit: 891edf37f4b0b0ff42efdf7067237e1b1445a8b9
Author: Rahul Sandhu <nvraxn <AT> gmail <DOT> com>
AuthorDate: Thu Jan 8 00:18:50 2026 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 8 00:37:39 2026 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=891edf37
selinux-policy-2.eclass: refactor variables, formatting
Refactor the case statement by removing superfluous semicolons from the
ending of lines and placing each statement on a new line. Also, remove
an unnecessary trailing slash in S and remove statements setting IUSE
and SRC_URI to ""; that is a no-op.
Signed-off-by: Rahul Sandhu <nvraxn <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/selinux-policy-2.eclass | 56 ++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 29 deletions(-)
diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 6c345e2771a6..b80c9f4651e5 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -37,7 +37,7 @@ _SELINUX_POLICY_2_ECLASS=1
# This variable contains the version string of the selinux-base-policy package
# that this module build depends on. It is used to patch with the appropriate
# patch bundle(s) that are part of selinux-base-policy.
-: "${BASEPOL:=${PVR}}"
+: "${BASEPOL:="${PVR}"}"
# @ECLASS_VARIABLE: POLICY_PATCH
# @DESCRIPTION:
@@ -85,33 +85,33 @@ fi
: "${SELINUX_GIT_BRANCH:="master"}"
case ${BASEPOL} in
- 9999) inherit git-r3
- EGIT_REPO_URI="${SELINUX_GIT_REPO}";
- EGIT_BRANCH="${SELINUX_GIT_BRANCH}";
- EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
+ 9999)
+ inherit git-r3
+ EGIT_REPO_URI="${SELINUX_GIT_REPO}"
+ EGIT_BRANCH="${SELINUX_GIT_BRANCH}"
+ EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy"
+ ;;
esac
-if [[ ${EAPI} = 7 ]]; then
- IUSE=""
-else
+if [[ ${EAPI} != 7 ]]; then
# Build all policy types by default
IUSE="+selinux_policy_types_targeted +selinux_policy_types_strict
+selinux_policy_types_mcs +selinux_policy_types_mls"
REQUIRED_USE="|| ( selinux_policy_types_targeted
selinux_policy_types_strict selinux_policy_types_mcs selinux_policy_types_mls )"
fi
HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux"
-if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "9999" ]]; then
-
SRC_URI="https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_${PV/./_}/refpolicy-${PV}.tar.bz2
-
https://dev.gentoo.org/~perfinion/patches/selinux-base-policy/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2"
+if [[ -n ${BASEPOL} && "${BASEPOL}" != "9999" ]]; then
+ SRC_URI="
+
https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_${PV/./_}/refpolicy-${PV}.tar.bz2
+
https://dev.gentoo.org/~perfinion/patches/selinux-base-policy/patchbundle-selinux-base-policy-${BASEPOL}.tar.bz2
+ "
elif [[ "${BASEPOL}" != "9999" ]]; then
SRC_URI="https://github.com/SELinuxProject/refpolicy/releases/download/RELEASE_${PV/./_}/refpolicy-${PV}.tar.bz2"
-else
- SRC_URI=""
fi
LICENSE="GPL-2"
SLOT="0"
-S="${WORKDIR}/"
+S="${WORKDIR}"
# Modules should always depend on at least the first release of the
# selinux-base-policy for which they are generated.
@@ -122,22 +122,20 @@ else
fi
if [[ ${EAPI} = 7 ]]; then
- RDEPEND=">=sys-apps/policycoreutils-2.5
- >=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}"
+ RDEPEND="
+ >=sys-apps/policycoreutils-2.5
+ >=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}
+ "
else
- RDEPEND=">=sys-apps/policycoreutils-2.5
- selinux_policy_types_targeted? (
-
>=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}[selinux_policy_types_targeted]
- )
- selinux_policy_types_strict? (
-
>=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}[selinux_policy_types_strict]
- )
- selinux_policy_types_mcs? (
-
>=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}[selinux_policy_types_mcs]
- )
- selinux_policy_types_mls? (
-
>=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}[selinux_policy_types_mls]
- )"
+ RDEPEND=">=sys-apps/policycoreutils-2.5"
+ for _poltype in selinux_policy_types_{targeted,strict,mcs,mls}; do
+ RDEPEND+="
+ ${_poltype}? (
+
>=sec-policy/selinux-base-policy-${_BASE_POLICY_VERSION}[${_poltype}]
+ )
+ "
+ done
+ unset _poltype
fi
unset _BASE_POLICY_VERSION