commit:     b7f0bcda782aee3451833ac1bc70c72ef669b19d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  7 09:02:08 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep 10 06:50:55 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b7f0bcda

Run distcc-pump server throughout src_configure() to src_install()

Start distcc-pump server in all phases throughout src_configure() to
src_install() rather than in src_compile() alone. Since each of those
phases may involve some compilations, we should try to take full
advantage of distcc in all of them. Moreover, this silences distcc
warnings about being unable to connect to the server when compiling.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=507482

---
 bin/phase-functions.sh | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index f39a024..e80f16e 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -382,6 +382,19 @@ __dyn_prepare() {
        trap - SIGINT SIGQUIT
 }
 
+# @FUNCTION: __start_distcc
+# @DESCRIPTION:
+# Start distcc-pump if necessary.
+__start_distcc() {
+       if has distcc $FEATURES && has distcc-pump $FEATURES ; then
+               if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w 
$INCLUDE_SERVER_PORT ]] ; then
+                       # adding distcc to PATH repeatedly results in fatal 
distcc recursion :)
+                       eval $(pump --startup | grep -v PATH)
+                       trap "pump --shutdown >/dev/null" EXIT
+               fi
+       fi
+}
+
 __dyn_configure() {
 
        if [[ -e $PORTAGE_BUILDDIR/.configured ]] ; then
@@ -401,6 +414,7 @@ __dyn_configure() {
        fi
 
        trap __abort_configure SIGINT SIGQUIT
+       __start_distcc
 
        __ebuild_phase pre_src_configure
 
@@ -434,13 +448,7 @@ __dyn_compile() {
        fi
 
        trap __abort_compile SIGINT SIGQUIT
-
-       if has distcc $FEATURES && has distcc-pump $FEATURES ; then
-               if [[ -z $INCLUDE_SERVER_PORT ]] || [[ ! -w 
$INCLUDE_SERVER_PORT ]] ; then
-                       eval $(pump --startup)
-                       trap "pump --shutdown" EXIT
-               fi
-       fi
+       __start_distcc
 
        __ebuild_phase pre_src_compile
 
@@ -464,6 +472,8 @@ __dyn_test() {
        fi
 
        trap "__abort_test" SIGINT SIGQUIT
+       __start_distcc
+
        if [ -d "${S}" ]; then
                cd "${S}"
        else
@@ -509,6 +519,8 @@ __dyn_install() {
                return 0
        fi
        trap "__abort_install" SIGINT SIGQUIT
+       __start_distcc
+
        __ebuild_phase pre_src_install
 
        if ___eapi_has_prefix_variables; then

Reply via email to