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 30954138334 for ; Sun, 23 Dec 2018 11:23:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 289ACE093D; Sun, 23 Dec 2018 11:23:54 +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 DE926E093D for ; Sun, 23 Dec 2018 11:23:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A00F9335C31 for ; Sun, 23 Dec 2018 11:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0D1E04F0 for ; Sun, 23 Dec 2018 11:23:50 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1545564181.39d040bc86ee75780549c28008ba8192e5c99ca8.grobian@gentoo> Subject: [gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/ X-VCS-Repository: proj/portage X-VCS-Files: bin/install-qa-check.d/05prefix X-VCS-Directories: bin/install-qa-check.d/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 39d040bc86ee75780549c28008ba8192e5c99ca8 X-VCS-Branch: prefix Date: Sun, 23 Dec 2018 11:23:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8d564e13-2ebb-4298-9817-4800910262e6 X-Archives-Hash: 4f7a4d0db4d3250b348e675b0ddc6044 commit: 39d040bc86ee75780549c28008ba8192e5c99ca8 Author: Michael Haubenwallner gentoo org> AuthorDate: Thu Jul 5 16:45:35 2018 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sun Dec 23 11:23:01 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=39d040bc install-qa-check.d/05prefix: support stacked-prefix feature Bug: https://bugs.gentoo.org/658572 Signed-off-by: Fabian Groffen gentoo.org> bin/install-qa-check.d/05prefix | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix index f702b77f0..03da3bbce 100644 --- a/bin/install-qa-check.d/05prefix +++ b/bin/install-qa-check.d/05prefix @@ -36,6 +36,19 @@ install_qa_check_prefix() { local WHITELIST=" /usr/bin/env " # shebang can be an absolutised path, bug #342929 local eprefix=$(canonicalize ${EPREFIX}) + # Without the stacked-prefix feature, tests using BPREFIX + # are redundant to EPREFIX, but run only if we will fail. + # Otherways, BPREFIX really is BROOT (the EAPI 7 one). + local BPREFIX=${EPREFIX} + local bprefix=${eprefix} + if has stacked-prefix ${FEATURES} && + [[ -z ${ROOT%/} ]] && + [[ ${CBUILD} == ${CHOST} ]] && + [[ ${EPREFIX} != ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} ]] && + :; then + BPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}} + bprefix=$(canonicalize ${BPREFIX}) + fi # this is hell expensive, but how else? find "${ED%/}/" -executable \! -type d -print0 \ | xargs -0 grep -H -n -m1 "^#!" \ @@ -63,7 +76,8 @@ install_qa_check_prefix() { [[ $(canonicalize "/${rf#${D%/}/}") != ${eprefix}/* ]] && continue fi # does the shebang start with ${EPREFIX}, and does it exist? - if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] ; then + if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] \ + || [[ ${line[0]} == ${BPREFIX}/* || ${line[0]} == ${bprefix}/* ]] ; then if [[ ! -e ${ROOT%/}${line[0]} && ! -e ${D%/}${line[0]} ]] ; then # hmm, refers explicitly to $EPREFIX, but doesn't exist, # if it's in PATH that's wrong in any case @@ -79,16 +93,25 @@ install_qa_check_prefix() { # unprefixed shebang, is the script directly in $PATH or an init # script? if [[ ":${PATH}:${EPREFIX}/etc/init.d:" == *":${fp}:"* ]] ; then + local foundprefix="none" if [[ -e ${EROOT%/}${line[0]} || -e ${ED%/}${line[0]} ]] ; then - # is it unprefixed, but we can just fix it because a - # prefixed variant exists + # is it unprefixed, but we can just fix it because an + # eprefixed variant exists eqawarn "eprefixing shebang of ${fn#${D%/}/}" + foundprefix=${EPREFIX} + elif [[ -e ${BPREFIX}${line[0]} ]] ; then + # is it unprefixed, but we can just fix it because a + # bprefixed variant exists + eqawarn "bprefixing shebang of ${fn#${D%/}/}" + foundprefix=${BPREFIX} + fi + if [[ ${foundprefix} != "none" ]] ; then # statement is made idempotent on purpose, because # symlinks may point to the same target, and hence the # same real file may be sedded multiple times since we # read the shebangs in one go upfront for performance # reasons - sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${EPREFIX}"${line[0]}':' "${rf}" + sed -i -e '1s:^#! \?'"${line[0]}"':#!'"${foundprefix}"${line[0]}':' "${rf}" continue else # this is definitely wrong: script in $PATH and invalid shebang