commit:     a0ac6e6727abec8d2482c95b1e84d8df24d78619
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue May  1 18:14:07 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue May  1 18:15:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a0ac6e67

phase-helpers.sh: fix best/has_version -b for cross-prefix

Fixes: 43b6be7423aa ("phase-helpers.sh: Implement -r|-d|-b options for 
best/has_version")

 bin/phase-helpers.sh                    |  2 +-
 pym/portage/tests/emerge/test_simple.py | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 59c19cf67..8b16d7d31 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -912,7 +912,7 @@ ___best_version_and_has_version_common() {
                                case ${root_arg} in
                                        -r) root=${EROOT} ;;
                                        -d) root=${ESYSROOT} ;;
-                                       -b) root=${BROOT:-/} ;;
+                                       -b) 
root=${BROOT:-/${PORTAGE_OVERRIDE_EPREFIX#/}} ;;
                                esac
                        else
                                case ${root_arg} in

diff --git a/pym/portage/tests/emerge/test_simple.py 
b/pym/portage/tests/emerge/test_simple.py
index 17dcd548d..495e22297 100644
--- a/pym/portage/tests/emerge/test_simple.py
+++ b/pym/portage/tests/emerge/test_simple.py
@@ -119,11 +119,13 @@ pkg_preinst() {
                                "EAPI" : "7_pre1",
                                "KEYWORDS": "~x86",
                                "RDEPEND": "dev-libs/D[flag]",
+                               "MISC_CONTENT": install_something,
                        },
                        "dev-libs/D-1": {
                                "EAPI" : "7_pre1",
                                "KEYWORDS": "~x86",
                                "IUSE" : "flag",
+                               "MISC_CONTENT": install_something,
                        },
                        "virtual/foo-0": {
                                "EAPI" : "5",
@@ -326,6 +328,16 @@ pkg_preinst() {
                        portageq_cmd + ("match", eroot, "dev-libs/D[flag]"),
 
                        # Test cross-prefix usage, including chpathtool for 
binpkgs.
+                       # EAPI 7
+                       ({"EPREFIX" : cross_prefix},) + \
+                               emerge_cmd + ("dev-libs/C",),
+                       ({"EPREFIX" : cross_prefix},) + \
+                               portageq_cmd + ("has_version", cross_prefix, 
"dev-libs/C"),
+                       ({"EPREFIX" : cross_prefix},) + \
+                               portageq_cmd + ("has_version", cross_prefix, 
"dev-libs/D"),
+                       ({"ROOT": cross_root},) + emerge_cmd + ("dev-libs/D",),
+                       portageq_cmd + ("has_version", cross_eroot, 
"dev-libs/D"),
+                       # EAPI 5
                        ({"EPREFIX" : cross_prefix},) + \
                                emerge_cmd + ("--usepkgonly", "dev-libs/A"),
                        ({"EPREFIX" : cross_prefix},) + \

Reply via email to