diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-11-07 12:19:53 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-11-07 12:20:18 -0800 |
commit | d00e6b124b8709269de1c66d889c79bd8f91fa88 (patch) | |
tree | f8712c32fabdf61418397ec26dea0641319eb453 | |
parent | 36bdacd2807d0ab6cfecc590426df52c7b1c29d8 (diff) | |
download | portage-d00e6b124b8709269de1c66d889c79bd8f91fa88.tar.gz portage-d00e6b124b8709269de1c66d889c79bd8f91fa88.tar.bz2 portage-d00e6b124b8709269de1c66d889c79bd8f91fa88.zip |
Only support ROOT override for best/has_version.
In the context of ebuilds, ROOT=/ override is the only common case, so
it makes sense to only support ROOT overrides.
-rw-r--r-- | bin/phase-helpers.sh | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index 5d2d5dd3a..6609dc77a 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -599,25 +599,19 @@ _eapi4_src_install() { # @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). +# Return true if given package is installed. Otherwise return false. +# Callers may override the ROOT variable in order match packages from an +# alternative ROOT. has_version() { - local eroot=${EROOT} + local eroot 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 + eroot=${ROOT%/}${EPREFIX#/}/ + ;; esac if [[ -n $PORTAGE_IPC_DAEMON ]] ; then "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "${eroot}" "$1" @@ -639,25 +633,19 @@ has_version() { # @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). +# Returns the best/most-current match. +# Callers may override the ROOT variable in order match packages from an +# alternative ROOT. best_version() { - local eroot=${EROOT} + local eroot 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 + eroot=${ROOT%/}${EPREFIX#/}/ + ;; esac if [[ -n $PORTAGE_IPC_DAEMON ]] ; then "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "${eroot}" "$1" |