Discussion:
[gentoo-portage-dev] [PATCH] phase-helpers.sh: has/best_version -b in any phase (bug 665038)
Zac Medico
2018-09-02 22:03:28 UTC
Permalink
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
Brian Dolbec
2018-09-02 23:20:41 UTC
Permalink
On Sun, 2 Sep 2018 15:03:28 -0700
Post by Zac Medico
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
LGTM
Zac Medico
2018-09-03 18:33:33 UTC
Permalink
Post by Brian Dolbec
On Sun, 2 Sep 2018 15:03:28 -0700
Post by Zac Medico
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
LGTM
Thanks, merged:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=102220e1f71341e9bc85236074813f191bb389a4
--
Thanks,
Zac
Loading...