[oe-commits] Peter Kjellerstedt : oe-buildenv-internal: Only add to $PATH if needed

git at git.openembedded.org git at git.openembedded.org
Tue Apr 9 12:16:53 UTC 2013


Module: openembedded-core.git
Branch: master
Commit: 7429db6f38e405774ba66b3fa1bc3ac4b74ae6b9
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=7429db6f38e405774ba66b3fa1bc3ac4b74ae6b9

Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
Date:   Tue Apr  9 12:24:13 2013 +0200

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 at axis.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/oe-buildenv-internal |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index df95389..644df8f 100755
--- a/scripts/oe-buildenv-internal
+++ b/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





More information about the Openembedded-commits mailing list