From b58e5fd407c8726fd2ffe674444255aab9ae0010 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 7 Nov 2011 11:16:09 -0800 Subject: 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. --- bin/phase-helpers.sh | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'bin') 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: +# @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: +# @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 -- cgit v1.2.3-1-g7c22