From 04ebb2bd99b378aeffdf11ca8710c951af24e93e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 30 Sep 2018 07:18:27 -0700 Subject: [PATCH] install-qa-check.d: Support QA{,_STRICT}_INSTALL_PATHS variables (bug 670902) The QA_INSTALL_PATHS variable exempts paths from "unexpected paths" warnings generated by metadata/install-qa-check.d/08gentoo-paths. If the QA_STRICT_INSTALL_PATHS variable is set then any exemptions in QA_INSTALL_PATHS are ignored. Bug: https://bugs.gentoo.org/670902 Signed-off-by: Zac Medico --- metadata/install-qa-check.d/08gentoo-paths | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/metadata/install-qa-check.d/08gentoo-paths b/metadata/install-qa-check.d/08gentoo-paths index 3ee887df08f..a3289b112dd 100644 --- a/metadata/install-qa-check.d/08gentoo-paths +++ b/metadata/install-qa-check.d/08gentoo-paths @@ -60,6 +60,27 @@ gentoo_path_check() { ${shopt_save} + if [[ ${#bad_paths[@]} -gt 0 && ${QA_INSTALL_PATHS} && + ${QA_STRICT_INSTALL_PATHS-unset} == unset ]]; then + local filtered_paths=() + local grep_args=() + local qa_install_paths + if [[ $(declare -p QA_INSTALL_PATHS) == "declare -a "* ]]; then + qa_install_paths=( "${QA_INSTALL_PATHS[@]}" ) + else + set -f + qa_install_paths=( ${QA_INSTALL_PATHS} ) + set +f + fi + for x in "${qa_install_paths[@]}"; do + grep_args+=( -e "^/${x#/}\$" ) + done + while read -r -d ''; do + [[ ${REPLY} ]] && filtered_paths+=( "${REPLY}" ) + done < <(printf -- '%s\0' "${bad_paths[@]}" | grep -zv "${grep_args[@]}") + bad_paths=( "${filtered_paths[@]}" ) + fi + # report # ------ if [[ -n ${bad_paths[@]} ]]; then -- 2.18.1