Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] phase-helpers.sh: has/best_version -b in any phase (bug 665038)
Date: Sun, 02 Sep 2018 22:06:11
Message-Id: 20180902220328.15574-1-zmedico@gentoo.org
1 Since BROOT is only defined in src_* phases, make has/best_version -b
2 use the equivalent /${PORTAGE_OVERRIDE_EPREFIX#/} value that is defined
3 in all phases. This makes has/best_version -b in EAPI 7 behave exactly
4 the same as --host-root behaves in EAPI 6, allowing python ebuilds to
5 call python_setup in any ebuild phase.
6
7 Bug: https://bugs.gentoo.org/665038
8 ---
9 bin/phase-helpers.sh | 7 ++++++-
10 1 file changed, 6 insertions(+), 1 deletion(-)
11
12 diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
13 index 5c9f957e9..ba3f27930 100644
14 --- a/bin/phase-helpers.sh
15 +++ b/bin/phase-helpers.sh
16 @@ -916,7 +916,12 @@ ___best_version_and_has_version_common() {
17 case ${root_arg} in
18 -r) root=${ROOT%/}/${EPREFIX#/} ;;
19 -d) root=${ESYSROOT} ;;
20 - -b) root=${BROOT:-/} ;;
21 + -b)
22 + # Use /${PORTAGE_OVERRIDE_EPREFIX#/} which is equivalent
23 + # to BROOT, except BROOT is only defined in src_* phases.
24 + root=/${PORTAGE_OVERRIDE_EPREFIX#/}
25 + cmd+=(env EPREFIX="${PORTAGE_OVERRIDE_EPREFIX}")
26 + ;;
27 esac
28 else
29 case ${root_arg} in
30 --
31 2.16.4

Replies