Source bashrc files as late as possible, giving them the opportunity to
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Dec 2008 22:20:34 +0000 (22:20 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Dec 2008 22:20:34 +0000 (22:20 -0000)
override as much as possible. Thanks to Ned Ludd <solar@g.o> for the
suggestion. (trunk r12134)

svn path=/main/branches/2.1.6/; revision=12135

bin/ebuild.sh
bin/isolated-functions.sh
bin/misc-functions.sh

index 87f94717b84f673161e9a2dc570092cd272e6c7e..197be269636b4d70b7e914157c4154d7fcec9a7b 100755 (executable)
@@ -1492,6 +1492,8 @@ _ebuild_phase_funcs() {
        esac
 }
 
+PORTAGE_BASHRCS_SOURCED=0
+
 # @FUNCTION: source_all_bashrcs
 # @DESCRIPTION:
 # Source a relevant bashrc files and perform other miscellaneous
@@ -1504,6 +1506,8 @@ _ebuild_phase_funcs() {
 #    function for the current phase.
 #
 source_all_bashrcs() {
+       [[ $PORTAGE_BASHRCS_SOURCED = 1 ]] && return 0
+       PORTAGE_BASHRCS_SOURCED=1
        local x
 
        if [[ -n $EBUILD_PHASE && -n $EAPI ]] ; then
@@ -1840,7 +1844,6 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm depend && \
                        ;;
        esac
 
-       source_all_bashrcs
 fi
 
 if ! hasq "$EBUILD_PHASE" clean cleanrm && \
@@ -1888,9 +1891,6 @@ fi
 # code can simply assume that it's defined.
 [[ -n $EAPI ]] || EAPI=0
 
-# enable bashrc support for the clean phase
-hasq "$EBUILD_PHASE" clean cleanrm && source_all_bashrcs
-
 # unset USE_EXPAND variables that contain only the special "*" token
 for x in ${USE_EXPAND} ; do
        [ "${!x}" == "*" ] && unset ${x}
@@ -1918,6 +1918,7 @@ if [ "${EBUILD_PHASE}" != "depend" ] ; then
 fi
 
 ebuild_main() {
+       source_all_bashrcs
        local f x
        local export_vars="ASFLAGS CCACHE_DIR CCACHE_SIZE
                CFLAGS CXXFLAGS LDFLAGS LIBCFLAGS LIBCXXFLAGS"
index 77336d914b3d4f41ef2bb42d07cc8880c8dbfd20..9ed933c02ec7a3ae1b53eebf926d613ecea92d9f 100755 (executable)
@@ -514,7 +514,8 @@ save_ebuild_env() {
                        GOOD HILITE HOME IMAGE \
                        LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
                        NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
-                       PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \
+                       PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST \
+                       PORTAGE_BASHRC PORTAGE_BASHRCS_SOURCED \
                        PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \
                        PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \
                        PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \
index f1f70553820e0ecdb453d540486ba8224cda5cee..8ce82a2a825ddb706ac20f005973fc1647efa9e0 100755 (executable)
@@ -710,6 +710,7 @@ dyn_rpm() {
 }
 
 if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then
+       source_all_bashrcs
        [ "$PORTAGE_DEBUG" == "1" ] && set -x
        for x in ${MISC_FUNCTIONS_ARGS}; do
                ${x}