commit:     1582103b2f0f64e5dc57eddc4217360eac230b8a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed May 16 20:54:23 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed May 16 20:56:43 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1582103b

phase-helpers.sh: handle readonly EPREFIX for local override (bug 655414)

Since ebuild.sh calls "declare -r ED EPREFIX EROOT", use env to
override EPREFIX for the called command.

Fixes: 17fce85669be ("phase-helpers.sh: fix has/best_version for cross-prefix 
portageq (bug 655414)")

 bin/phase-helpers.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 99a30a176..5c9f957e9 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -880,6 +880,7 @@ __eapi6_src_install() {
 
 ___best_version_and_has_version_common() {
        local atom root root_arg
+       local -a cmd=()
        case $1 in
                --host-root|-r|-d|-b)
                        root_arg=$1
@@ -903,7 +904,7 @@ ___best_version_and_has_version_common() {
                                # Since portageq requires the root argument be 
consistent
                                # with EPREFIX, ensure consistency here (bug 
655414).
                                root=/${PORTAGE_OVERRIDE_EPREFIX#/}
-                               local -x EPREFIX=${PORTAGE_OVERRIDE_EPREFIX}
+                               cmd+=(env EPREFIX="${PORTAGE_OVERRIDE_EPREFIX}")
                        else
                                root=/
                        fi ;;
@@ -927,10 +928,11 @@ ___best_version_and_has_version_common() {
        esac
 
        if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
-               "${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" "${root}" 
"${atom}"
+               cmd+=("${PORTAGE_BIN_PATH}"/ebuild-ipc "${FUNCNAME[1]}" 
"${root}" "${atom}")
        else
-               "${PORTAGE_BIN_PATH}"/ebuild-helpers/portageq "${FUNCNAME[1]}" 
"${root}" "${atom}"
+               cmd+=("${PORTAGE_BIN_PATH}"/ebuild-helpers/portageq 
"${FUNCNAME[1]}" "${root}" "${atom}")
        fi
+       "${cmd[@]}"
        local retval=$?
        case "${retval}" in
                0|1)

Reply via email to