]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-buildenv-internal: Only add to $PATH if needed
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Tue, 9 Apr 2013 10:24:13 +0000 (12:24 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 9 Apr 2013 12:11:51 +0000 (13:11 +0100)
First strip $PATH of any existence of the paths needed by Open Embedded
and BitBake. Then add the needed paths at the beginning. This makes sure
the needed paths are searched first, without growing $PATH unnecessarily
if oe-init-build-env is rerun for a directory for which it has
previously been run.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/oe-buildenv-internal

index df953896f1cfb76a963a5ff4382b483b8efa83e5..644df8f30c4dbaa62783a897ab608b362111edb5 100755 (executable)
@@ -74,8 +74,9 @@ if ! (test -d "$BITBAKEDIR"); then
     return 1
 fi
 
-NEWPATHS="${OEROOT}/scripts:$BITBAKEDIR/bin/:"
-[ "${PATH#$NEWPATHS}" != "$PATH" ] || PATH="$NEWPATHS$PATH"
+# 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
 
 # Used by the runqemu script