Improve setup scripts
v2 cover Improve setup scripts
These changes improve the setup scripts which are initiated by the user via 'oe-init-build-env'.
Gary Thomas (3):
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.
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.
.templateconf: New file for customized template defaults
.templateconf | 2 ++ oe-init-build-env | 42 +++++++++++++++++++++++------------------- scripts/oe-setup-builddir | 10 +++++++++- 3 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 .templateconf
Signature · 1 line
1.7.9.5
PATCH v2 1/3 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
@@ -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
PATCH v2 3/3 .templateconf: New file for customized template defaults
In reply to Gary ThomasThis file will allow easy customization of the build tools, in particular the default setting of TEMPLATECONF, which should reduce the need to fiddle with scripts in the future.
--- .templateconf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .templateconf
.templateconf new file +2 -0
@@ -0,0 +1,2 @@ +# Template settings +TEMPLATECONF=${TEMPLATECONF:-meta/conf}
Signature · 1 line
1.7.9.5
PATCH v2 2/3 scripts/oe-setup-builddir: Keep track of TEMPLATECONF setting
In reply to Gary ThomasKeeping 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.
Note that the default value for TEMPLATECONF now comes from an easily customizable file $OEROOT/.templateconf
--- scripts/oe-setup-builddir | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
scripts/oe-setup-builddir +9 -1
@@ -37,7 +37,15 @@ fi cd "$BUILDDIR" -TEMPLATECONF=${TEMPLATECONF:-meta/conf} +if (test -f "$BUILDDIR/conf/templateconf.cfg") then + TEMPLATECONF=$(cat $BUILDDIR/conf/templateconf.cfg) +fi + +source $OEROOT/.templateconf + +if ! (test -f "$BUILDDIR/conf/templateconf.cfg") then + echo "$TEMPLATECONF" >$BUILDDIR/conf/templateconf.cfg +fi # # $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
Signature · 1 line
1.7.9.5
Quoted 13 lines · Gary Thomas
These changes improve the setup scripts which are initiated by the user via 'oe-init-build-env'.
Gary Thomas (3):
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.
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.
.templateconf: New file for customized template defaults
Quoted 6 lines
.templateconf | 2 ++ oe-init-build-env | 42 +++++++++++++++++++++++------------------- scripts/oe-setup-builddir | 10 +++++++++- 3 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 .templateconf
Ping? Any comments or discussion?
Signature · 4 lines
------------------------------------------------------------ Gary Thomas | Consulting for the MLB Associates | Embedded world ------------------------------------------------------------