Skip to content

Instantly share code, notes, and snippets.

@krnowak
Created June 29, 2022 15:10
Show Gist options
  • Save krnowak/ecd07fefaf129c0d51df7518f288b822 to your computer and use it in GitHub Desktop.
Save krnowak/ecd07fefaf129c0d51df7518f288b822 to your computer and use it in GitHub Desktop.
From a9499b22aa17f81e58add2c0ae88a650a2a573d7 Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <knowak@microsoft.com>
Date: Wed, 29 Jun 2022 17:05:23 +0200
Subject: [PATCH] eclass/selinux-policy-2: fix POLICY_PATCH applying
eapply as implemented in portage has some heuristics to find out where
the parameters that should be passed to patch utility end and actual
diff/patch files begin. It first tries to find -- which is the
explicit way of separating parameters from input files. Since there's
none, it tries to find a first non-option. And it finds the refpolicy
directory as a first non-option, while it is supposed to be a value of
the -d parameter. The said directory is then treated as an input
directory, which is expected to contain at least one patch or diff
file. Since there's none, eapply fails.
Help eapply's heuristics by explicitly delimiting the parameters from
input files with --.
---
eclass/selinux-policy-2.eclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 81d982f74..22fa50289 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -180,9 +180,9 @@ selinux-policy-2_src_prepare() {
# Apply the additional patches refered to by the module ebuild.
# But first some magic to differentiate between bash arrays and strings
if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]]; then
- [[ -n ${POLICY_PATCH[*]} ]] && eapply -d "${S}/refpolicy/policy/modules" "${POLICY_PATCH[@]}"
+ [[ -n ${POLICY_PATCH[*]} ]] && eapply -d "${S}/refpolicy/policy/modules" -- "${POLICY_PATCH[@]}"
else
- [[ -n ${POLICY_PATCH} ]] && eapply -d "${S}/refpolicy/policy/modules" ${POLICY_PATCH}
+ [[ -n ${POLICY_PATCH} ]] && eapply -d "${S}/refpolicy/policy/modules" -- ${POLICY_PATCH}
fi
# Collect only those files needed for this particular module
--
2.25.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment