[gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/
commit: 83c88c15f09749d81e76f89aea92212c235b249e Author: Fabian Groffen gentoo org> AuthorDate: Tue Jul 26 19:34:45 2022 + Commit: Fabian Groffen gentoo org> CommitDate: Tue Jul 26 19:34:45 2022 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=83c88c15 bin/install-qa-check.d/05prefix: fix shebang correction #861305 Some syncs with master broke this check. fp should not have a double / in it, else the matching logic doesn't work. Bug: https://bugs.gentoo.org/861305 Signed-off-by: Fabian Groffen gentoo.org> bin/install-qa-check.d/05prefix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix index a60c63fcb..ac059723f 100644 --- a/bin/install-qa-check.d/05prefix +++ b/bin/install-qa-check.d/05prefix @@ -55,7 +55,7 @@ install_qa_check_prefix() { line=( ${line#"#!"} ) IFS=${oldIFS} [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue - local fp=${fn#${D}} ; fp=/${fp%/*} + local fp=${fn#${D}/} ; fp=/${fp%/*} local rf=${fn} # in case we deal with a symlink, make sure we don't replace it # with a real file (sed -i does that)
[gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/
commit: a9911165da14ccb9a905b5f3e0b076a0f50b852b Author: Fabian Groffen gentoo org> AuthorDate: Fri Jan 15 18:31:27 2021 + Commit: Fabian Groffen gentoo org> CommitDate: Fri Jan 15 18:31:27 2021 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9911165 bin/install-qa-check.d/05prefix: silence grep for shebangs on binaries Two birds one stone: - silence grep on binary files if they happen to contain #! - don't process binary files at all (because we only want text files) While at it, also look for "# !" which is the official form to write the shebang. Signed-off-by: Fabian Groffen gentoo.org> bin/install-qa-check.d/05prefix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix index 03da3bbce..959c85b1b 100644 --- a/bin/install-qa-check.d/05prefix +++ b/bin/install-qa-check.d/05prefix @@ -51,7 +51,7 @@ install_qa_check_prefix() { fi # this is hell expensive, but how else? find "${ED%/}/" -executable \! -type d -print0 \ - | xargs -0 grep -H -n -m1 "^#!" \ + | xargs -0 grep -IHnm1 '^# \?!' \ | while read f ; do local fn=${f%%:*}
[gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/
commit: 99383de9bc96c7b4549afb9992dcbde308dc4dd1 Author: Michael Haubenwallner gentoo org> AuthorDate: Thu Jul 5 16:30:35 2018 + Commit: Fabian Groffen gentoo org> CommitDate: Sun Dec 23 11:22:39 2018 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=99383de9 install-qa-check.d/05prefix(D,ED,ROOT,EROOT): support EAPI 7 Also, need to canonicalize EPREFIX only once. Signed-off-by: Fabian Groffen gentoo.org> bin/install-qa-check.d/05prefix | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/bin/install-qa-check.d/05prefix b/bin/install-qa-check.d/05prefix index 32561e263..f702b77f0 100644 --- a/bin/install-qa-check.d/05prefix +++ b/bin/install-qa-check.d/05prefix @@ -3,24 +3,24 @@ install_qa_check_prefix() { [[ ${ED} == ${D} ]] && return - if [[ -d ${ED}/${D} ]] ; then - find "${ED}/${D}" | \ + if [[ -d ${ED%/}${D%/} ]] ; then + find "${ED%/}${D%/}/" | \ while read i ; do - eqawarn "QA Notice: /${i##${ED}/${D}} installed in \${ED}/\${D}" + eqawarn "QA Notice: /${i#${ED%/}${D%/}/} installed in \${ED}\${D}" done - die "Aborting due to QA concerns: files installed in ${ED}/${D}" + die "Aborting due to QA concerns: files installed in ${ED%/}${D%/}/" fi - if [[ -d ${ED}/${EPREFIX} ]] ; then - find "${ED}/${EPREFIX}/" | \ + if [[ -d ${ED%/}${EPREFIX} ]] ; then + find "${ED%/}${EPREFIX}/" | \ while read i ; do - eqawarn "QA Notice: ${i#${D}} double prefix" + eqawarn "QA Notice: ${i#${D%/}/} double prefix" done die "Aborting due to QA concerns: double prefix files installed" fi - if [[ -d ${D} ]] ; then - INSTALLTOD=$(find ${D%/} | egrep -v "^${ED}" | sed -e "s|^${D%/}||" | awk '{if (length($0) <= length("'"${EPREFIX}"'")) { if (substr("'"${EPREFIX}"'", 1, length($0)) != $0) {print $0;} } else if (substr($0, 1, length("'"${EPREFIX}"'")) != "'"${EPREFIX}"'") {print $0;} }') + if [[ -d ${D%/}/ ]] ; then + INSTALLTOD=$(find ${D%/} | egrep -v "^${ED%/}/" | sed -e "s|^${D%/}||" | awk '{if (length($0) <= length("'"${EPREFIX}"'")) { if (substr("'"${EPREFIX}"'", 1, length($0)) != $0) {print $0;} } else if (substr($0, 1, length("'"${EPREFIX}"'")) != "'"${EPREFIX}"'") {print $0;} }') if [[ -n ${INSTALLTOD} ]] ; then eqawarn "QA Notice: the following files are outside of the prefix:" eqawarn "${INSTALLTOD}" @@ -34,8 +34,10 @@ install_qa_check_prefix() { # check shebangs, bug #282539 rm -f "${T}"/non-prefix-shebangs-errs local WHITELIST=" /usr/bin/env " + # shebang can be an absolutised path, bug #342929 + local eprefix=$(canonicalize ${EPREFIX}) # this is hell expensive, but how else? - find "${ED}" -executable \! -type d -print0 \ + find "${ED%/}/" -executable \! -type d -print0 \ | xargs -0 grep -H -n -m1 "^#!" \ | while read f ; do @@ -49,9 +51,7 @@ install_qa_check_prefix() { line=( ${line#"#!"} ) IFS=${oldIFS} [[ ${WHITELIST} == *" ${line[0]} "* ]] && continue - local fp=${fn#${D}} ; fp=/${fp%/*} - # line[0] can be an absolutised path, bug #342929 - local eprefix=$(canonicalize ${EPREFIX}) + local fp=${fn#${D%/}/} ; fp=/${fp%/*} local rf=${fn} # in case we deal with a symlink, make sure we don't replace it # with a real file (sed -i does that) @@ -60,7 +60,7 @@ install_qa_check_prefix() { [[ ${rf} != /* ]] && rf=${fn%/*}/${rf} # ignore symlinks pointing to outside prefix # as seen in sys-devel/native-cctools - [[ $(canonicalize "/${rf#${D}}") != ${eprefix}/* ]] && continue + [[ $(canonicalize "/${rf#${D%/}/}") != ${eprefix}/* ]] && continue fi # does the shebang start with ${EPREFIX}, and does it exist? if [[ ${line[0]} == ${EPREFIX}/* || ${line[0]} == ${eprefix}/* ]] ; then @@ -68,10 +68,10 @@ install_qa_check_prefix() { # hmm, refers explicitly to $EPREFIX, but doesn't exist, # if it's in PATH that's wrong in any case if [[ ":${PATH}:" == *":${fp}:"* ]] ; then - echo "${fn#${D}}:${line[0]} (explicit EPREFIX but target not found)" \ + echo "${fn#${D%/}/}:${line[0]} (explicit EPREFIX but target not found)" \
[gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/
commit: 39d040bc86ee75780549c28008ba8192e5c99ca8 Author: Michael Haubenwallner gentoo org> AuthorDate: Thu Jul 5 16:45:35 2018 + Commit: Fabian Groffen gentoo org> CommitDate: Sun Dec 23 11:23:01 2018 + 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
[gentoo-commits] proj/portage:prefix commit in: bin/install-qa-check.d/
commit: d8e5ec9bd0ad5781d643368f965164be3a9036ee Author: Fabian Groffen gentoo org> AuthorDate: Thu Feb 18 19:16:00 2016 + Commit: Fabian Groffen gentoo org> CommitDate: Thu Feb 18 19:16:00 2016 + URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d8e5ec9b gcc_warn_check: use valid python fallback bin/install-qa-check.d/90gcc-warnings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings index bd82cab..0b0f89c 100644 --- a/bin/install-qa-check.d/90gcc-warnings +++ b/bin/install-qa-check.d/90gcc-warnings @@ -113,7 +113,7 @@ gcc_warn_check() { [[ $reset_debug = 1 ]] && set -x # Use safe cwd, avoiding unsafe import for bug #469338. f=$(cd "${PORTAGE_PYM_PATH}" ; $cat_cmd "${PORTAGE_LOG_FILE}" | \ - "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") + "${PORTAGE_PYTHON:-@PREFIX_PORTAGE_PYTHON@}" "$PORTAGE_BIN_PATH"/check-implicit-pointer-usage.py || die "check-implicit-pointer-usage.py failed") if [[ -n ${f} ]] ; then # In the future this will be a forced "die". In preparation,