Skip to contentSkip to conversation

Improve setup scripts

PATCH Superseded Gary Thomas 3 participants 7 messages Feb 24, 2014 – Feb 25, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Improve setup scripts

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(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 oe-init-build-env: Improve script sourcing detection.

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.

---
 oe-init-build-env |   42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
oe-init-build-env +23 -19
index 8ef32f3..5249513 100755
@@ -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
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

In reply to 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.

---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)
scripts/oe-setup-builddir +8 -0
index a869fdc..4322158 100755
@@ -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
 #
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

Quoted 19 lines · 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.

---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)
scripts/oe-setup-builddir +0 -0
index a869fdc..4322158 100755
@@ -37,8 +37,16 @@ fi
 
 cd "$BUILDDIR"
 

scripts/oe-setup-builddir fi · line 49

Quoted 10 lines
scripts/oe-setup-builddir +8 -0
+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

#4 lore raw

Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

Quoted 34 lines · Richard Purdie
Quoted 19 lines · 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.

---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)
scripts/oe-setup-builddir +0 -0
index a869fdc..4322158 100755
@@ -37,8 +37,16 @@ fi
 
 cd "$BUILDDIR"
 

scripts/oe-setup-builddir fi · line 49

Quoted 10 lines
scripts/oe-setup-builddir +8 -0
+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...

Quoted 7 lines

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?

Quoted 3 lines

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.

Signature · 4 lines
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
#5 lore raw

Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

Quoted 43 lines · Gary Thomas
Quoted 34 lines · Richard Purdie
Quoted 19 lines · 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.

---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)
scripts/oe-setup-builddir +0 -0
index a869fdc..4322158 100755
@@ -37,8 +37,16 @@ fi
 
 cd "$BUILDDIR"
 

scripts/oe-setup-builddir fi · line 49

Quoted 10 lines
scripts/oe-setup-builddir +8 -0
+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...

Quoted 7 lines

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.

Quoted 6 lines

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

Quoted 6 lines
Quoted 3 lines

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.

#6 lore raw

Re: [PATCH 2/2] scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting

In reply to Gary Thomas

Hi,

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

Regards,
Matthieu

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Gary Thomas Envoyé : lundi 24 février 2014 16:18
À : [email protected]
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.

---
 scripts/oe-setup-builddir |    8 ++++++++
 1 file changed, 8 insertions(+)
scripts/oe-setup-builddir +6 -1
@@ -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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core