Browse Source

oe-buildenv-internal: Only add to $PATH if needed

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>
Peter Kjellerstedt 11 years ago
parent
commit
7429db6f38
1 changed files with 3 additions and 2 deletions
  1. 3 2
      scripts/oe-buildenv-internal

+ 3 - 2
scripts/oe-buildenv-internal

@@ -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