[OE-core] [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed

Richard Purdie richard.purdie at linuxfoundation.org
Tue Apr 9 12:16:06 UTC 2013


On Tue, 2013-04-09 at 12:24 +0200, Peter Kjellerstedt wrote:
> 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>
> ---
>  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

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






More information about the Openembedded-core mailing list