Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] Do not grow PATH unnecessarily in oe-buildenv-internal
@ 2013-04-09 10:24 Peter Kjellerstedt
  2013-04-09 10:24 ` [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed Peter Kjellerstedt
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Kjellerstedt @ 2013-04-09 10:24 UTC (permalink / raw)
  To: openembedded-core

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(-)

-- 
1.7.11.7




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed
  2013-04-09 10:24 [PATCH 0/1] Do not grow PATH unnecessarily in oe-buildenv-internal Peter Kjellerstedt
@ 2013-04-09 10:24 ` Peter Kjellerstedt
  2013-04-09 12:16   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Kjellerstedt @ 2013-04-09 10:24 UTC (permalink / raw)
  To: openembedded-core

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(-)

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




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] oe-buildenv-internal: Only add to $PATH if needed
  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
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2013-04-09 12:16 UTC (permalink / raw)
  To: Peter Kjellerstedt; +Cc: openembedded-core

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-09 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox