]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-buildenv-internal: Add paths to $PATH individually
authorPeter Kjellerstedt <pkj@axis.com>
Tue, 15 Mar 2016 16:48:53 +0000 (17:48 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 Mar 2016 22:57:59 +0000 (22:57 +0000)
Instead of assuming that the path to the scripts directory always is
in $PATH directly before the bitbake directory, treat them as separate
paths and add them individually to $PATH.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-buildenv-internal

index 457763b7943a4e3bc5c0ac79391d5cd127aa17e8..85f82f1b31c040f73c00413952083f84b7e8328d 100755 (executable)
@@ -95,9 +95,14 @@ if ! (test -d "$BITBAKEDIR"); then
 fi
 
 # Make sure our paths are at the beginning of $PATH
-NEWPATHS="${OEROOT}/scripts:$BITBAKEDIR/bin:"
-PATH=$NEWPATHS$(echo $PATH | sed -e "s|:$NEWPATHS|:|g" -e "s|^$NEWPATHS||")
-unset BITBAKEDIR NEWPATHS
+for newpath in "$BITBAKEDIR/bin" "$OEROOT/scripts"; do
+    # Remove any existences of $newpath from $PATH
+    PATH=$(echo $PATH | sed -re "s#(^|:)$newpath(:|$)#\1#g;s#^:##")
+
+    # Add $newpath to $PATH
+    PATH="$newpath:$PATH"
+done
+unset BITBAKEDIR newpath
 
 # Used by the runqemu script
 export BUILDDIR