Do not grow PATH unnecessarily in oe-buildenv-internal
cover Do not grow PATH unnecessarily in oe-buildenv-internal
As a result of the discussion on the OE mailing list, I have reworked the patch for oe-buildenv-internal that makes sure that the paths for OE and BitBake are added to $PATH in a way that does not make it grow unnecessarily.
//Peter
The following changes since commit e57284abca76fe7e6c29484104ae4349459c63dc:
kernel.bbclass: do_sizecheck: update path to build image and do not delete (2013-04-08 22:26:24 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib pkj/oe-buildenv-internal
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/oe-buildenv-internal
Peter Kjellerstedt (1):
oe-buildenv-internal: Only add to $PATH if needed
scripts/oe-buildenv-internal | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.11.7
PATCH 1/1 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.
--- scripts/oe-buildenv-internal | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/oe-buildenv-internal +4 -2
@@ -74,8 +74,10 @@ if ! (test -d "$BITBAKEDIR"); then return 1 fi -PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" -unset BITBAKEDIR +# 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 export BUILDDIR
Signature · 1 line
1.7.11.7
Re: [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed
Quoted 10 lines · Peter Kjellerstedt
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 <[email protected]>--- scripts/oe-buildenv-internal | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
I'll merge this however ultimately I suspect we should have off the original PATH into some variable, then if that variable is set, append NEWPATHS to the original value and reset PATH to that.
It does mean if the user messed with path in the meantime, it gets reset but I suspect not many users do that.
Cheers,
Richard
Quoted 17 lines
scripts/oe-buildenv-internal +4
-2@@ -74,8 +74,10 @@ if ! (test -d "$BITBAKEDIR"); then return 1 fi -PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" -unset BITBAKEDIR +# 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 export BUILDDIR