summaryrefslogtreecommitdiffstats
path: root/bin/phase-helpers.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-11-07 11:16:09 -0800
committerZac Medico <zmedico@gentoo.org>2011-11-07 11:16:09 -0800
commitb58e5fd407c8726fd2ffe674444255aab9ae0010 (patch)
treee0ef20c06d072364552ce19f9d6c01e7dac09faf /bin/phase-helpers.sh
parentc88e394bfeafa16ac5dc75232b9b9b139f76e59c (diff)
downloadportage-b58e5fd407c8726fd2ffe674444255aab9ae0010.tar.gz
portage-b58e5fd407c8726fd2ffe674444255aab9ae0010.tar.bz2
portage-b58e5fd407c8726fd2ffe674444255aab9ae0010.zip
Fix best/has_version ROOT override for EAPI 3-4.
This has been broken since commit ab484dc9a2612aa6709fad3ff926c8589a706637. In order to support prefix, callers will have to override EROOT instead.
Diffstat (limited to 'bin/phase-helpers.sh')
-rw-r--r--bin/phase-helpers.sh46
1 files changed, 40 insertions, 6 deletions
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index a47064e37..5d2d5dd3a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -596,12 +596,29 @@ _eapi4_src_install() {
fi
}
-# Return true if given package is installed. Otherwise return false.
-# Takes single depend-type atoms.
+# @FUNCTION: has_version
+# @USAGE: <DEPEND ATOM>
+# @DESCRIPTION:
+# Returns the best/most-current match. Callers may override the ROOT
+# variable in order match packages from an alternative ROOT. In
+# EAPI 3 and later, override EROOT instead (ROOT override is supported
+# in this case only if EPREFIX is empty).
has_version() {
local eroot=${EROOT}
- case "$EAPI" in 0|1|2) eroot=${ROOT} ;; esac
+ case "$EAPI" in
+ 0|1|2)
+ eroot=${ROOT}
+ ;;
+ *)
+ if [[ -z ${EPREFIX} && ${EROOT} != ${ROOT} ]] ; then
+ # Handle ROOT environment override, which ebuilds
+ # sometimes use for stage1/cross-compiling.
+ # In order to support prefix, they'll have to
+ # override EROOT instead.
+ eroot=${ROOT}
+ fi
+ esac
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
"$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "$1"
else
@@ -619,12 +636,29 @@ has_version() {
esac
}
-# Returns the best/most-current match.
-# Takes single depend-type atoms.
+# @FUNCTION: best_version
+# @USAGE: <DEPEND ATOM>
+# @DESCRIPTION:
+# Returns the best/most-current match. Callers may override the ROOT
+# variable in order match packages from an alternative ROOT. In
+# EAPI 3 and later, override EROOT instead (ROOT override is supported
+# in this case only if EPREFIX is empty).
best_version() {
local eroot=${EROOT}
- case "$EAPI" in 0|1|2) eroot=${ROOT} ;; esac
+ case "$EAPI" in
+ 0|1|2)
+ eroot=${ROOT}
+ ;;
+ *)
+ if [[ -z ${EPREFIX} && ${EROOT} != ${ROOT} ]] ; then
+ # Handle ROOT environment override, which ebuilds
+ # sometimes use for stage1/cross-compiling.
+ # In order to support prefix, they'll have to
+ # override EROOT instead.
+ eroot=${ROOT}
+ fi
+ esac
if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
"$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "$1"
else