Move ccache/distcc PATH code to doebuild_env. v2.2.0_alpha73
authorZac Medico <zmedico@gentoo.org>
Thu, 10 Nov 2011 03:11:35 +0000 (19:11 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 10 Nov 2011 03:11:35 +0000 (19:11 -0800)
bin/ebuild.sh
pym/portage/package/ebuild/doebuild.py

index 226b9f6e5375ff343fff96f94e5d78a18794ea65..f39e5362a3c91bf18c2da702e3181731ca35030e 100755 (executable)
@@ -578,19 +578,11 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
 
                if [[ $EBUILD_PHASE != depend ]] ; then
 
-                       _eprefix=${EPREFIX}
-                       case "$EAPI" in 0|1|2) _eprefix= ;; esac
-                       # Use default ABI libdir in accordance with bug #355283.
-                       x=LIBDIR_${DEFAULT_ABI}
-                       [[ -n $DEFAULT_ABI && -n ${!x} ]] && x=${!x} || x=lib
-
                        if has distcc $FEATURES ; then
-                               PATH="${_eprefix}/usr/$x/distcc/bin:$PATH"
                                [[ -n $DISTCC_LOG ]] && addwrite "${DISTCC_LOG%/*}"
                        fi
 
                        if has ccache $FEATURES ; then
-                               PATH="${_eprefix}/usr/$x/ccache/bin:$PATH"
 
                                if [[ -n $CCACHE_DIR ]] ; then
                                        addread "$CCACHE_DIR"
@@ -600,8 +592,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
                                [[ -n $CCACHE_SIZE ]] && ccache -M $CCACHE_SIZE &> /dev/null
                        fi
 
-                       unset x _eprefix
-
                        if [[ -n $QA_PREBUILT ]] ; then
 
                                # these ones support fnmatch patterns
index 3b728074be79847bcea384bdab821e953e3b86a5..bdfcbcc350b5247a77ab443b138164cd55fda3df 100644 (file)
@@ -372,6 +372,26 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 
        _doebuild_path(mysettings, eapi=eapi)
 
+       if mydo != "depend":
+               ccache = "ccache" in mysettings.features
+               distcc = "distcc" in mysettings.features
+               if ccache or distcc:
+                       # Use default ABI libdir in accordance with bug #355283.
+                       libdir = None
+                       default_abi = mysettings.get("DEFAULT_ABI")
+                       if default_abi:
+                               libdir = mysettings.get("LIBDIR_" + default_abi)
+                       if not libdir:
+                               libdir = "lib"
+
+                       if distcc:
+                               mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
+                                        "usr", libdir, "distcc", "bin") + ":" + mysettings["PATH"]
+
+                       if ccache:
+                               mysettings["PATH"] = os.path.join(os.sep, eprefix_lstrip,
+                                        "usr", libdir, "ccache", "bin") + ":" + mysettings["PATH"]
+
        if not eapi_exports_KV(eapi):
                # Discard KV for EAPIs that don't support it. Cache KV is restored
                # from the backupenv whenever config.reset() is called.