Enable bash tracing during sourcing of bashrc for --debug mode. See bug #126442.
authorZac Medico <zmedico@gentoo.org>
Wed, 22 Mar 2006 23:47:03 +0000 (23:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 22 Mar 2006 23:47:03 +0000 (23:47 -0000)
svn path=/main/trunk/; revision=2971

bin/ebuild.sh

index d5e6ef68291143dc6136682d0ac886975d8eba7c..410425d219294c23d4b0b0908b822ad911786a1c 100755 (executable)
@@ -42,7 +42,15 @@ OCC="$CC"
 OCXX="$CXX"
 source /etc/profile.env &>/dev/null
 if [ -f "${PORTAGE_BASHRC}" ]; then
-       source "${PORTAGE_BASHRC}"
+       # If $- contains x, then tracing has already enabled elsewhere for some
+       # reason.  We preserve it's state so as not to interfere.
+       if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then
+               source "${PORTAGE_BASHRC}"
+       else
+               set -x
+               source "${PORTAGE_BASHRC}"
+               set +x
+       fi
 fi
 [ ! -z "$OCC" ] && export CC="$OCC"
 [ ! -z "$OCXX" ] && export CXX="$OCXX"