From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0C0FF138334 for ; Mon, 12 Nov 2018 20:33:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7D0D4E0AC9; Mon, 12 Nov 2018 20:33:55 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 28E80E0AB7 for ; Mon, 12 Nov 2018 20:33:55 +0000 (UTC) Received: from r6.ad.gaikai.biz (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 39CD3335CC8; Mon, 12 Nov 2018 20:33:53 +0000 (UTC) From: Zac Medico To: gentoo-dev@lists.gentoo.org Cc: qa@gentoo.org, mgorny@gentoo.org, slyfox@gentoo.org, Zac Medico Subject: [gentoo-dev] [PATCH] install-qa-check.d: Support QA{,_STRICT}_INSTALL_PATHS variables (bug 670902) Date: Mon, 12 Nov 2018 12:33:44 -0800 Message-Id: <20181112203344.611-1-zmedico@gentoo.org> X-Mailer: git-send-email 2.18.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 0b10a108-43c9-4e4e-92a1-b4f69572fbdb X-Archives-Hash: e24dc875c69ccb3ab5a58eefdbac31db 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. Since we probably don't want to whitelist /nix for all ebuilds, this patch will allow us to whitelist it with a setting like this in global scope of the nix ebuilds: QA_INSTALL_PATHS=( /nix ) 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