All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve setup scripts
@ 2014-02-24 15:17 Gary Thomas
  2014-02-24 15:17 ` [PATCH 1/2] oe-init-build-env: Improve script sourcing detection Gary Thomas
  2014-02-24 15:18 ` [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting Gary Thomas
  0 siblings, 2 replies; 7+ messages in thread
From: Gary Thomas @ 2014-02-24 15:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Gary Thomas

These changes improve the setup scripts which are initiated
by the user via 'oe-init-build-env'.

Gary Thomas (2):
  oe-init-build-env: Improve script sourcing detection.
  scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

 oe-init-build-env         |   42 +++++++++++++++++++++++-------------------
 scripts/oe-setup-builddir |    8 ++++++++
 2 files changed, 31 insertions(+), 19 deletions(-)

-- 
1.7.9.5



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

* [PATCH 1/2] oe-init-build-env: Improve script sourcing detection.
  2014-02-24 15:17 [PATCH 0/2] Improve setup scripts Gary Thomas
@ 2014-02-24 15:17 ` Gary Thomas
  2014-02-24 15:18 ` [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting Gary Thomas
  1 sibling, 0 replies; 7+ messages in thread
From: Gary Thomas @ 2014-02-24 15:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Gary Thomas

This script is only useful when sourced into a shell.  These
changes improve the detection of this operation, no matter
how the script is referenced.

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
---
 oe-init-build-env |   42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/oe-init-build-env b/oe-init-build-env
index 8ef32f3..5249513 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -25,27 +25,31 @@
 # being sourced.   To workaround the shell limitation use "set arg1" prior 
 # to sourcing this script.
 #
-if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./oe-init-build-env" ]; then
-   echo "Error: This script needs to be sourced. Please run as '. ./oe-init-build-env'"
+if [ -n "$BASH_SOURCE" ]; then
+   OEROOT="`dirname $BASH_SOURCE`"
+elif [ -n "$ZSH_NAME" ]; then
+   OEROOT="`dirname $0`"
 else
-   if [ -n "$BASH_SOURCE" ]; then
-      OEROOT="`dirname $BASH_SOURCE`"
-   elif [ -n "$ZSH_NAME" ]; then
-      OEROOT="`dirname $0`"
-   else
-      OEROOT="`pwd`"
-   fi
-   if [ -n "$BBSERVER" ]; then
-      unset BBSERVER
-   fi
-    OEROOT=`readlink -f "$OEROOT"`
-   export OEROOT
-   . $OEROOT/scripts/oe-buildenv-internal && \
-        $OEROOT/scripts/oe-setup-builddir && \
-        [ -n "$BUILDDIR" ] && cd $BUILDDIR
-   unset OEROOT
-   unset BBPATH
+   OEROOT="`pwd`"
 fi
+if [ -n "$BBSERVER" ]; then
+   unset BBSERVER
+fi
+THIS_SCRIPT=$OEROOT/oe-init-build-env
+
+if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
+   echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
+   exit 1
+fi
+
+OEROOT=`readlink -f "$OEROOT"`
+export OEROOT
+. $OEROOT/scripts/oe-buildenv-internal && \
+     $OEROOT/scripts/oe-setup-builddir && \
+     [ -n "$BUILDDIR" ] && cd $BUILDDIR
+unset OEROOT
+unset BBPATH
+unset THIS_SCRIPT
 
 # Shutdown any bitbake server if the BBSERVER variable is not set
 if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
-- 
1.7.9.5



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

* [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
  2014-02-24 15:17 [PATCH 0/2] Improve setup scripts Gary Thomas
  2014-02-24 15:17 ` [PATCH 1/2] oe-init-build-env: Improve script sourcing detection Gary Thomas
@ 2014-02-24 15:18 ` Gary Thomas
  2014-02-24 15:37   ` Richard Purdie
  2014-02-25  8:34   ` Matthieu CRAPET
  1 sibling, 2 replies; 7+ messages in thread
From: Gary Thomas @ 2014-02-24 15:18 UTC (permalink / raw)
  To: openembedded-core; +Cc: Gary Thomas

Keeping track of the TEMPLATECONF variable in the build
tree will let this script produce the same output when
listing 'conf-notes.txt' every time the script is run,
regardless of whether or not TEMPLATECONF has been provided
by the user.

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
index a869fdc..4322158 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -37,8 +37,16 @@ fi
 
 cd "$BUILDDIR"
 
+if (test -f "$BUILDDIR/conf/template.conf") then
+    TEMPLATECONF=$(cat $BUILDDIR/conf/template.conf)
+fi
+
 TEMPLATECONF=${TEMPLATECONF:-meta/conf}
 
+if ! (test -f "$BUILDDIR/conf/template.conf") then
+    echo "$TEMPLATECONF" >$BUILDDIR/conf/template.conf
+fi
+
 # 
 # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
 #
-- 
1.7.9.5



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

* Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
  2014-02-24 15:18 ` [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting Gary Thomas
@ 2014-02-24 15:37   ` Richard Purdie
  2014-02-24 15:42     ` Gary Thomas
  2014-02-25  8:34   ` Matthieu CRAPET
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Purdie @ 2014-02-24 15:37 UTC (permalink / raw)
  To: Gary Thomas; +Cc: openembedded-core

On Mon, 2014-02-24 at 08:18 -0700, Gary Thomas wrote:
> Keeping track of the TEMPLATECONF variable in the build
> tree will let this script produce the same output when
> listing 'conf-notes.txt' every time the script is run,
> regardless of whether or not TEMPLATECONF has been provided
> by the user.
> 
> Signed-off-by: Gary Thomas <gary@mlbassoc.com>
> ---
>  scripts/oe-setup-builddir |    8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
> index a869fdc..4322158 100755
> --- a/scripts/oe-setup-builddir
> +++ b/scripts/oe-setup-builddir
> @@ -37,8 +37,16 @@ fi
>  
>  cd "$BUILDDIR"
>  
> +if (test -f "$BUILDDIR/conf/template.conf") then
> +    TEMPLATECONF=$(cat $BUILDDIR/conf/template.conf)
> +fi
> +
>  TEMPLATECONF=${TEMPLATECONF:-meta/conf}
>  
> +if ! (test -f "$BUILDDIR/conf/template.conf") then
> +    echo "$TEMPLATECONF" >$BUILDDIR/conf/template.conf
> +fi
> +

Can you please call this something other than xxx.conf? I don't fancy
someone trying to load this ".conf" file with bitbake...

Since you're also looking in this area, there is one piece I've meant to
add for a long time but never quite got to. I think something like a
hidden top level ".templatepointer" style file might be a good idea for
repos like poky and for anyone else trying to customise the build. This
would allow us to point directly at poky's template configuration files
without having to hack the scripts which is currently what happens
there.

That hacking has long since bothered me, equally, I tend to have more
pressing issues to deal with so its never been done as yet.

Cheers,

Richard








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

* Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
  2014-02-24 15:37   ` Richard Purdie
@ 2014-02-24 15:42     ` Gary Thomas
  2014-02-24 16:13       ` Richard Purdie
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2014-02-24 15:42 UTC (permalink / raw)
  To: Richard Purdie; +Cc: openembedded-core

On 2014-02-24 08:37, Richard Purdie wrote:
> On Mon, 2014-02-24 at 08:18 -0700, Gary Thomas wrote:
>> Keeping track of the TEMPLATECONF variable in the build
>> tree will let this script produce the same output when
>> listing 'conf-notes.txt' every time the script is run,
>> regardless of whether or not TEMPLATECONF has been provided
>> by the user.
>>
>> Signed-off-by: Gary Thomas <gary@mlbassoc.com>
>> ---
>>  scripts/oe-setup-builddir |    8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
>> index a869fdc..4322158 100755
>> --- a/scripts/oe-setup-builddir
>> +++ b/scripts/oe-setup-builddir
>> @@ -37,8 +37,16 @@ fi
>>  
>>  cd "$BUILDDIR"
>>  
>> +if (test -f "$BUILDDIR/conf/template.conf") then
>> +    TEMPLATECONF=$(cat $BUILDDIR/conf/template.conf)
>> +fi
>> +
>>  TEMPLATECONF=${TEMPLATECONF:-meta/conf}
>>  
>> +if ! (test -f "$BUILDDIR/conf/template.conf") then
>> +    echo "$TEMPLATECONF" >$BUILDDIR/conf/template.conf
>> +fi
>> +
> 
> Can you please call this something other than xxx.conf? I don't fancy
> someone trying to load this ".conf" file with bitbake...
> 
> Since you're also looking in this area, there is one piece I've meant to
> add for a long time but never quite got to. I think something like a
> hidden top level ".templatepointer" style file might be a good idea for
> repos like poky and for anyone else trying to customise the build. This
> would allow us to point directly at poky's template configuration files
> without having to hack the scripts which is currently what happens
> there.

Do you mean for things like this line which is different in Poky?
  TEMPLATECONF=${TEMPLATECONF:-meta/conf}
vs.
  TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}

Do you have a list of where such differences are so I can address them?

> 
> That hacking has long since bothered me, equally, I tend to have more
> pressing issues to deal with so its never been done as yet.

I'll see what I can do to improve on this and send a new [set of] patches.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


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

* Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
  2014-02-24 15:42     ` Gary Thomas
@ 2014-02-24 16:13       ` Richard Purdie
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2014-02-24 16:13 UTC (permalink / raw)
  To: Gary Thomas; +Cc: openembedded-core

On Mon, 2014-02-24 at 08:42 -0700, Gary Thomas wrote:
> On 2014-02-24 08:37, Richard Purdie wrote:
> > On Mon, 2014-02-24 at 08:18 -0700, Gary Thomas wrote:
> >> Keeping track of the TEMPLATECONF variable in the build
> >> tree will let this script produce the same output when
> >> listing 'conf-notes.txt' every time the script is run,
> >> regardless of whether or not TEMPLATECONF has been provided
> >> by the user.
> >>
> >> Signed-off-by: Gary Thomas <gary@mlbassoc.com>
> >> ---
> >>  scripts/oe-setup-builddir |    8 ++++++++
> >>  1 file changed, 8 insertions(+)
> >>
> >> diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir
> >> index a869fdc..4322158 100755
> >> --- a/scripts/oe-setup-builddir
> >> +++ b/scripts/oe-setup-builddir
> >> @@ -37,8 +37,16 @@ fi
> >>  
> >>  cd "$BUILDDIR"
> >>  
> >> +if (test -f "$BUILDDIR/conf/template.conf") then
> >> +    TEMPLATECONF=$(cat $BUILDDIR/conf/template.conf)
> >> +fi
> >> +
> >>  TEMPLATECONF=${TEMPLATECONF:-meta/conf}
> >>  
> >> +if ! (test -f "$BUILDDIR/conf/template.conf") then
> >> +    echo "$TEMPLATECONF" >$BUILDDIR/conf/template.conf
> >> +fi
> >> +
> > 
> > Can you please call this something other than xxx.conf? I don't fancy
> > someone trying to load this ".conf" file with bitbake...
> > 
> > Since you're also looking in this area, there is one piece I've meant to
> > add for a long time but never quite got to. I think something like a
> > hidden top level ".templatepointer" style file might be a good idea for
> > repos like poky and for anyone else trying to customise the build. This
> > would allow us to point directly at poky's template configuration files
> > without having to hack the scripts which is currently what happens
> > there.
> 
> Do you mean for things like this line which is different in Poky?
>   TEMPLATECONF=${TEMPLATECONF:-meta/conf}
> vs.
>   TEMPLATECONF=${TEMPLATECONF:-meta-yocto/conf}
> 
> Do you have a list of where such differences are so I can address them?

That is literally the remaining thing I'd like to resolved, making that
configurable. I'm not sure there is anything else.

Cheers,

Richard

> > 
> > That hacking has long since bothered me, equally, I tend to have more
> > pressing issues to deal with so its never been done as yet.
> 
> I'll see what I can do to improve on this and send a new [set of] patches.
> 




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

* Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
  2014-02-24 15:18 ` [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting Gary Thomas
  2014-02-24 15:37   ` Richard Purdie
@ 2014-02-25  8:34   ` Matthieu CRAPET
  1 sibling, 0 replies; 7+ messages in thread
From: Matthieu CRAPET @ 2014-02-25  8:34 UTC (permalink / raw)
  To: Gary Thomas, openembedded-core

Hi,

You can drop parenthesis in your test (it will create a useless subshell).

Regards,
Matthieu


-----Message d'origine-----
De : openembedded-core-bounces@lists.openembedded.org [mailto:openembedded-core-bounces@lists.openembedded.org] De la part de Gary Thomas
Envoyé : lundi 24 février 2014 16:18
À : openembedded-core@lists.openembedded.org
Cc : Gary Thomas
Objet : [OE-core] [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

Keeping track of the TEMPLATECONF variable in the build tree will let this script produce the same output when listing 'conf-notes.txt' every time the script is run, regardless of whether or not TEMPLATECONF has been provided by the user.

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir index a869fdc..4322158 100755
--- a/scripts/oe-setup-builddir
+++ b/scripts/oe-setup-builddir
@@ -37,8 +37,16 @@ fi
 
 cd "$BUILDDIR"
 
+if (test -f "$BUILDDIR/conf/template.conf") then
+    TEMPLATECONF=$(cat $BUILDDIR/conf/template.conf) fi
+
 TEMPLATECONF=${TEMPLATECONF:-meta/conf}
 
+if ! (test -f "$BUILDDIR/conf/template.conf") then
+    echo "$TEMPLATECONF" >$BUILDDIR/conf/template.conf fi
+
 #
 # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf  #
--
1.7.9.5

_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

end of thread, other threads:[~2014-02-25  8:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 15:17 [PATCH 0/2] Improve setup scripts Gary Thomas
2014-02-24 15:17 ` [PATCH 1/2] oe-init-build-env: Improve script sourcing detection Gary Thomas
2014-02-24 15:18 ` [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting Gary Thomas
2014-02-24 15:37   ` Richard Purdie
2014-02-24 15:42     ` Gary Thomas
2014-02-24 16:13       ` Richard Purdie
2014-02-25  8:34   ` Matthieu CRAPET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.