commit:     27952b1d753ef4ea9bbd2307f8a9a315ad94557d
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 26 14:42:00 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Oct 26 15:45:14 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=27952b1d

Convert portageq helper to a function

This keeps it out of PATH in ebuilds to avoid breaking external
utilities that call portageq.

Bug: https://bugs.gentoo.org/906129
Bug: https://bugs.gentoo.org/916287
Bug: https://bugs.gentoo.org/916296
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 NEWS                        | 4 +++-
 bin/ebuild-helpers/portageq | 8 --------
 bin/phase-helpers.sh        | 4 ++++
 bin/portageq-wrapper        | 1 -
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/NEWS b/NEWS
index 06cd7695a6..fe171d1e27 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,9 @@ Release notes take the form of the following optional 
categories:
 portage-3.0.55 (UNRELEASED)
 --------------
 
-TODO
+Bug fixes:
+* Convert portageq helper to a function to avoid breaking external callers
+  (bug ##916287, bug #916296).
 
 portage-3.0.54 (2023-10-25)
 --------------

diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
deleted file mode 100755
index bd9d6b0442..0000000000
--- a/bin/ebuild-helpers/portageq
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
-
-die "'${0##*/}' is not allowed in ebuild scope"
-exit 1

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 3f12b37077..6c2ecf0bc2 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1006,6 +1006,10 @@ best_version() {
        ___best_version_and_has_version_common "$@"
 }
 
+portageq() {
+    die "portageq is not allowed in ebuild scope"
+}
+
 if ___eapi_has_get_libdir; then
        get_libdir() {
                local libdir_var="LIBDIR_${ABI}"

diff --git a/bin/portageq-wrapper b/bin/portageq-wrapper
index afa2defe1b..047d1d826c 100755
--- a/bin/portageq-wrapper
+++ b/bin/portageq-wrapper
@@ -9,7 +9,6 @@ IFS=":"
 set -f # in case ${PATH} contains any shell glob characters
 
 for path in "${PORTAGE_BIN_PATH}" ${PATH}; do
-       [[ ${path} == */portage/*/ebuild-helpers* ]] && continue
        [[ -x ${path}/portageq ]] || continue
        PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
                exec "${PORTAGE_PYTHON:-/usr/bin/python}" "${path}/portageq" 
"$@"

Reply via email to