toaster: fixes for toaster script
cover toaster: fixes for toaster script
This has fixes for the startup script so it can work in both managed and analysis mode.
The following changes since commit a8e82d93bfa8feb722912d03ee26bbad7e6fe9f7:
toaster: Modify "New build" button behaviour for cli builds project (2015-10-15 14:54:27 +0300)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib bavery/submit/ed/2105-10-15_fixes-for-toaster-script
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=bavery/submit/ed/2105-10-15_fixes-for-toaster-script
Ed Bartosh (4):
toaster: use path to the script to guess config path
toaster: get rid of SRCFILE
toaster: set TOASTER_MANAGED variable
toaster: exit or return depending on the mode
bin/toaster | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
--
1.9.1
PATCH 1/4 toaster: use path to the script to guess config path
From: Ed Bartosh <[email protected]>
Used $TOASTER variable(path to the toaster script) instead of current directory name to get path to the toasterconf.json
This way script should work in both modes and it doesn't depend on the current directory.
--- bin/toaster | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
bin/toaster +3 -3
@@ -194,11 +194,11 @@ fi # in the local layers that currently prevent using an arbitrary # toasterconf.json if [ "$TOASTER_CONF" = "" ]; then - BIN_DIR=$(dirname -- "$0") - export TOASTER_CONF="$BIN_DIR/../../meta-yocto/conf/toasterconf.json" + TOASTER_CONF="$(dirname $TOASTER)/../../meta-yocto/conf/toasterconf.json" + export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')") fi if [ ! -f $TOASTER_CONF ]; then - echo "$TOASTER_CONF configuration file not found, exiting..." + echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" exit 1; fi # this defines the dir toaster will use for
Signature · 1 line
1.9.1
PATCH 2/4 toaster: get rid of SRCFILE
From: Ed Bartosh <[email protected]>
Used TOASTER variable instead of SRCFILE as they're essentially the same.
--- bin/toaster | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
bin/toaster +1 -3
@@ -232,9 +232,7 @@ for param in $*; do esac done -[ -n "${BASH_SOURCE}" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_ - -if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then +if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. # Start just the web server, point the web browser to the interface, and start any Django services.
Signature · 1 line
1.9.1
PATCH 3/4 toaster: set TOASTER_MANAGED variable
In reply to brian averyFrom: Ed Bartosh <[email protected]>
Set TOASTER_MANAGED to 1 if toaster is run as a script.
--- bin/toaster | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
bin/toaster +3 -2
@@ -176,6 +176,8 @@ else TOASTER=$0 fi +[ `basename \"$0\"` = `basename \"${TOASTER}\"` ] && TOASTER_MANAGED=1 + BBBASEDIR=`dirname $TOASTER`/.. RUNNING=0
@@ -232,7 +234,7 @@ for param in $*; do esac done -if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then +if [ "$TOASTER_MANAGED" = '1' ]; then # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. # Start just the web server, point the web browser to the interface, and start any Django services.
@@ -279,7 +281,6 @@ if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then do_cleanup fi } - TOASTER_MANAGED=1 export TOASTER_MANAGED=1 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then echo "Failed to start the web server, stopping" 1>&2
Signature · 1 line
1.9.1
PATCH 4/4 toaster: exit or return depending on the mode
In reply to brian averyFrom: Ed Bartosh <[email protected]>
When toaster script is sourced 'return' should be used as using 'exit' will cause script to exit the shell and close terminal window. If script is called 'exit' should be used. Otherwise shell will throw and error:
return: can only `return' from a function or sourced script
Used 'return' or 'exit' depending on the toaster mode using TOASTER_MANAGED variable.
--- bin/toaster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bin/toaster +1 -1
@@ -201,7 +201,7 @@ if [ "$TOASTER_CONF" = "" ]; then fi if [ ! -f $TOASTER_CONF ]; then echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" - exit 1; + [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 fi # this defines the dir toaster will use for # 1) clones of layers (in _toaster_clones )
Signature · 1 line
1.9.1