diff sources/include.sh @ 608:ab76d4cdd392

Jean Wolter pointed out that running RECORD_COMMANDS=1 twice could create circular symlinks. Hopefully fixed now, and some related cleanups/clarifications.
author Rob Landley <rob@landley.net>
date Tue, 03 Feb 2009 01:42:29 -0600
parents 3d67228ceb1e
children 7523d1f3b818
line wrap: on
line diff
--- a/sources/include.sh	Mon Feb 02 05:50:02 2009 -0600
+++ b/sources/include.sh	Tue Feb 03 01:42:29 2009 -0600
@@ -29,7 +29,7 @@
 export BUILD="${TOP}/build"
 export HOSTTOOLS="${BUILD}/host"
 
-[ -z "$WRAPPY_LOGDIR" ] && WRAPPY_LOGDIR="$BUILD"
+mkdir -p "${SRCDIR}" || dienow
 
 # Adjust $PATH
 
@@ -43,16 +43,21 @@
   fi
 fi
 
+# Setup for $RECORD_COMMANDS
+
+# WRAPPY_LOGPATH is set unconditionally in case host-tools.sh needs to
+# enable wrapping partway through its own build.  Extra environment variables
+# don't actually affect much, it's changing $PATH that changes behavior.
+
 STAGE_NAME=`echo $0 | sed 's@.*/\(.*\)\.sh@\1@'`
+[ -z "$WRAPPY_LOGDIR" ] && WRAPPY_LOGDIR="$BUILD"
 export WRAPPY_LOGPATH="$WRAPPY_LOGDIR/cmdlines.${STAGE_NAME}.setupfor"
-if [ -f "$BUILD/wrapdir/wrappy" ]
+if [ ! -z "$RECORD_COMMANDS" ] && [ -f "$BUILD/wrapdir/wrappy" ]
 then
   export WRAPPY_REALPATH="$PATH"
   PATH="$BUILD/wrapdir"
 fi
 
-mkdir -p "${SRCDIR}" || dienow
-
 # Tell bash not to cache the $PATH because we modify it.  Without this, bash
 # won't find new executables added after startup.
 set +h