1 |
The QA_INSTALL_PATHS variable exempts paths from "unexpected paths" |
2 |
warnings generated by metadata/install-qa-check.d/08gentoo-paths. |
3 |
If the QA_STRICT_INSTALL_PATHS variable is set then any exemptions |
4 |
in QA_INSTALL_PATHS are ignored. |
5 |
|
6 |
Since we probably don't want to whitelist /nix for all ebuilds, |
7 |
this patch will allow us to whitelist it with a setting like this |
8 |
in global scope of the nix ebuilds: |
9 |
|
10 |
QA_INSTALL_PATHS=( /nix ) |
11 |
|
12 |
Bug: https://bugs.gentoo.org/670902 |
13 |
Signed-off-by: Zac Medico <zmedico@g.o> |
14 |
--- |
15 |
metadata/install-qa-check.d/08gentoo-paths | 21 +++++++++++++++++++++ |
16 |
1 file changed, 21 insertions(+) |
17 |
|
18 |
diff --git a/metadata/install-qa-check.d/08gentoo-paths b/metadata/install-qa-check.d/08gentoo-paths |
19 |
index 3ee887df08f..a3289b112dd 100644 |
20 |
--- a/metadata/install-qa-check.d/08gentoo-paths |
21 |
+++ b/metadata/install-qa-check.d/08gentoo-paths |
22 |
@@ -60,6 +60,27 @@ gentoo_path_check() { |
23 |
|
24 |
${shopt_save} |
25 |
|
26 |
+ if [[ ${#bad_paths[@]} -gt 0 && ${QA_INSTALL_PATHS} && |
27 |
+ ${QA_STRICT_INSTALL_PATHS-unset} == unset ]]; then |
28 |
+ local filtered_paths=() |
29 |
+ local grep_args=() |
30 |
+ local qa_install_paths |
31 |
+ if [[ $(declare -p QA_INSTALL_PATHS) == "declare -a "* ]]; then |
32 |
+ qa_install_paths=( "${QA_INSTALL_PATHS[@]}" ) |
33 |
+ else |
34 |
+ set -f |
35 |
+ qa_install_paths=( ${QA_INSTALL_PATHS} ) |
36 |
+ set +f |
37 |
+ fi |
38 |
+ for x in "${qa_install_paths[@]}"; do |
39 |
+ grep_args+=( -e "^/${x#/}\$" ) |
40 |
+ done |
41 |
+ while read -r -d ''; do |
42 |
+ [[ ${REPLY} ]] && filtered_paths+=( "${REPLY}" ) |
43 |
+ done < <(printf -- '%s\0' "${bad_paths[@]}" | grep -zv "${grep_args[@]}") |
44 |
+ bad_paths=( "${filtered_paths[@]}" ) |
45 |
+ fi |
46 |
+ |
47 |
# report |
48 |
# ------ |
49 |
if [[ -n ${bad_paths[@]} ]]; then |
50 |
-- |
51 |
2.18.1 |