Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed
Date: Tue, 09 Apr 2013 13:16:06 +0100	[thread overview]
Message-ID: <1365509766.12407.73.camel@ted> (raw)
In-Reply-To: <4b8c3ca6b0f66674fbc8196e9bbed57ca9df2980.1365503027.git.pkj@axis.com>

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





      reply	other threads:[~2013-04-09 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 10:24 [PATCH 0/1] Do not grow PATH unnecessarily in oe-buildenv-internal Peter Kjellerstedt
2013-04-09 10:24 ` [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed Peter Kjellerstedt
2013-04-09 12:16   ` Richard Purdie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365509766.12407.73.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.kjellerstedt@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox