Since BROOT is only defined in src_* phases, make has/best_version -b
use the equivalent /${PORTAGE_OVERRIDE_EPREFIX#/} value that is defined
in all phases. This makes has/best_version -b in EAPI 7 behave exactly
the same as --host-root behaves in EAPI 6, allowing python ebuilds to
call python_setup in any ebuild phase.Bug: https://bugs.gentoo.org/665038 --- bin/phase-helpers.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 5c9f957e9..ba3f27930 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -916,7 +916,12 @@ ___best_version_and_has_version_common() { case ${root_arg} in -r) root=${ROOT%/}/${EPREFIX#/} ;; -d) root=${ESYSROOT} ;; - -b) root=${BROOT:-/} ;; + -b) + # Use /${PORTAGE_OVERRIDE_EPREFIX#/} which is equivalent + # to BROOT, except BROOT is only defined in src_* phases. + root=/${PORTAGE_OVERRIDE_EPREFIX#/} + cmd+=(env EPREFIX="${PORTAGE_OVERRIDE_EPREFIX}") + ;; esac else case ${root_arg} in -- 2.16.4
