changeset 1504:eb4d0124767a

Fix record-commands.sh regression with oldpath going recursive when sources/incldue.sh is source twice.
author Rob Landley <rob@landley.net>
date Thu, 15 Mar 2012 22:37:25 -0500
parents ef9114dfbd2e
children a9c403a6aa3b
files sources/include.sh
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/sources/include.sh	Thu Mar 15 22:36:30 2012 -0500
+++ b/sources/include.sh	Thu Mar 15 22:37:25 2012 -0500
@@ -2,11 +2,9 @@
 
 if ! already_included_this 2>/dev/null
 then
+echo includinate $0
 
-already_included_this()
-{
-  true
-}
+alias already_included_this=true
 
 # Set up all the environment variables and functions for a build stage.
 # This file is sourced, not run.
@@ -70,20 +68,19 @@
 
 # Adjust $PATH
 
-export OLDPATH="$PATH"
 # If record-commands.sh set up a wrapper directory, adjust $PATH again.
-if [ -f "$WRAPDIR/wrappy" ]
+if [ -z "$OLDPATH" ] && [ -f "$WRAPDIR/wrappy" ]
 then
   mkdir -p "$BUILD/logs"
   [ $? -ne 0 ] && echo "Bad $WRAPDIR" >&2 && dienow
   export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.$ARCH_NAME.early"
-  OLDPATH="$PATH:$OLDPATH"
+  export OLDPATH="$PATH"
   PATH="$WRAPDIR"
-elif [ ! -f "$HOSTTOOLS/busybox" ]
-then
-  PATH="$(hosttools_path):$OLDPATH"
 else
-  PATH="$(hosttools_path)"
+  export OLDPATH="$PATH"
+  [ ! -f "$HOSTTOOLS/busybox" ] &&
+    PATH="$(hosttools_path):$OLDPATH" ||
+    PATH="$(hosttools_path)"
 fi
 
 # Create files with known permissions