Put ebuild helpers at the absolute front of the PATH.
authorZac Medico <zmedico@gentoo.org>
Tue, 28 Apr 2009 08:03:28 +0000 (08:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 28 Apr 2009 08:03:28 +0000 (08:03 -0000)
svn path=/main/trunk/; revision=13404

bin/ebuild.sh

index 83e79e81866a65ad1f20741fef4a8157b53f14e2..02587d9cbf48c011403d2ec38357333a7164d782 100755 (executable)
@@ -71,8 +71,12 @@ unalias -a
 # Unset some variables that break things.
 unset GZIP BZIP BZIP2 CDPATH GREP_OPTIONS GREP_COLOR GLOBIGNORE
 
-export PATH="/usr/local/sbin:/sbin:/usr/sbin:$PORTAGE_BIN_PATH/ebuild-helpers:/usr/local/bin:/bin:/usr/bin:${ROOTPATH}"
-[ ! -z "$PREROOTPATH" ] && export PATH="${PREROOTPATH%%:}:$PATH"
+ROOTPATH=${ROOTPATH##:}
+ROOTPATH=${ROOTPATH%%:}
+PREROOTPATH=${PREROOTPATH##:}
+PREROOTPATH=${PREROOTPATH%%:}
+PATH=$PORTAGE_BIN_PATH/ebuild-helpers:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH
+export PATH
 
 source "${PORTAGE_BIN_PATH}/isolated-functions.sh"  &>/dev/null
 
@@ -1913,8 +1917,7 @@ ebuild_main() {
                        ;;
        esac
 
-       export PATH="/usr/local/sbin:/sbin:/usr/sbin:${ebuild_helpers_path}:/usr/local/bin:/bin:/usr/bin:${ROOTPATH}"
-       [[ -n $PREROOTPATH ]] && export PATH="${PREROOTPATH%%:}:$PATH"
+       PATH=$ebuild_helpers_path:$PREROOTPATH${PREROOTPATH:+:}/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin${ROOTPATH:+:}$ROOTPATH
        unset ebuild_helpers_path
 
        if ! hasq $EBUILD_SH_ARGS clean depend help info nofetch ; then