commit: 4bc369c549c34a757c799e3f6df1214cd1da12ef Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Sat May 13 10:35:50 2023 +0000 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> CommitDate: Sat May 13 20:13:25 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4bc369c5
portageq-wrapper: New wrapper script Move the internal portageq wrapper script out of the ebuild-helpers directory. Call the new script from best_version and has_version in the case when IPC is disabled. The goal is to ban portageq from the ebuild environment after some transition time. Bug: https://bugs.gentoo.org/906129 Fixes: ab538e7750fb85d57a3eb9d9b440848c1f2c074a Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> NEWS | 4 ++++ bin/ebuild-helpers/portageq | 24 +---------------------- bin/phase-helpers.sh | 2 +- bin/{ebuild-helpers/portageq => portageq-wrapper} | 19 ++++-------------- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index 6d039c84f..e282d3f3c 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ Breaking changes: * Output deprecation warnings for portageq, prepstrip and prepallstrip when they are called from an ebuild (bug #906129, bug #906156). +Cleanups: +* Move the internal portageq wrapper script out of the ebuild-helpers + directory. + portage-3.0.48 (UNRELEASED) -------------- Bug fixes: diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq index 0df0cd273..e3926e11a 100755 --- a/bin/ebuild-helpers/portageq +++ b/bin/ebuild-helpers/portageq @@ -2,29 +2,7 @@ # Copyright 2009-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -scriptpath=${BASH_SOURCE[0]} -scriptname=${scriptpath##*/} - source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope" - -# Use safe cwd, avoiding unsafe import for bug #469338. -cd "${PORTAGE_PYM_PATH}" || exit 1 - -IFS=':' -set -f # in case ${PATH} contains any shell glob characters - -for path in ${PATH}; do - [[ -x ${path}/${scriptname} ]] || continue - [[ ${path} == */portage/*/ebuild-helpers* ]] && continue - [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue - - PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ - exec "${PORTAGE_PYTHON:-/usr/bin/python}" \ - "${path}/${scriptname}" "$@" -done - -unset IFS -echo "${scriptname}: command not found" 1>&2 -exit 127 +exec "${PORTAGE_BIN_PATH}"/portageq-wrapper "$@" diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index af96b73e4..f1b762b0a 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -963,7 +963,7 @@ ___best_version_and_has_version_common() { if [[ -n ${PORTAGE_IPC_DAEMON} ]] ; then cmd+=("${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" "${root}" "${atom}") else - cmd+=("${PORTAGE_BIN_PATH}"/ebuild-helpers/portageq "${FUNCNAME[1]}" "${root}" "${atom}") + cmd+=("${PORTAGE_BIN_PATH}"/portageq-wrapper "${FUNCNAME[1]}" "${root}" "${atom}") fi "${cmd[@]}" diff --git a/bin/ebuild-helpers/portageq b/bin/portageq-wrapper similarity index 50% copy from bin/ebuild-helpers/portageq copy to bin/portageq-wrapper index 0df0cd273..2ca4052c4 100755 --- a/bin/ebuild-helpers/portageq +++ b/bin/portageq-wrapper @@ -2,29 +2,18 @@ # Copyright 2009-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -scriptpath=${BASH_SOURCE[0]} -scriptname=${scriptpath##*/} - -source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1 - -eqawarn "QA Notice: '${0##*/}' is not allowed in ebuild scope" - # Use safe cwd, avoiding unsafe import for bug #469338. cd "${PORTAGE_PYM_PATH}" || exit 1 -IFS=':' +IFS=":" set -f # in case ${PATH} contains any shell glob characters for path in ${PATH}; do - [[ -x ${path}/${scriptname} ]] || continue [[ ${path} == */portage/*/ebuild-helpers* ]] && continue - [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue - + [[ -x ${path}/portageq ]] || continue PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \ - exec "${PORTAGE_PYTHON:-/usr/bin/python}" \ - "${path}/${scriptname}" "$@" + exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" "$@" done -unset IFS -echo "${scriptname}: command not found" 1>&2 +echo "portageq: command not found" >&2 exit 127
