commit: 102220e1f71341e9bc85236074813f191bb389a4 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun Sep 2 21:55:56 2018 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Mon Sep 3 17:38:15 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=102220e1
phase-helpers.sh: has/best_version -b in any phase (bug 665038) 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 Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org> 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