All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] toaster: fixes for toaster script
@ 2015-10-15 16:34 brian avery
  2015-10-15 16:34 ` [PATCH 1/4] toaster: use path to the script to guess config path brian avery
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: brian avery @ 2015-10-15 16:34 UTC (permalink / raw)
  To: bitbake-devel

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


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

* [PATCH 1/4] toaster: use path to the script to guess config path
  2015-10-15 16:34 [PATCH 0/4] toaster: fixes for toaster script brian avery
@ 2015-10-15 16:34 ` brian avery
  2015-10-15 16:34 ` [PATCH 2/4] toaster: get rid of SRCFILE brian avery
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: brian avery @ 2015-10-15 16:34 UTC (permalink / raw)
  To: bitbake-devel

From: Ed Bartosh <ed.bartosh@linux.intel.com>

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.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
---
 bin/toaster | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/toaster b/bin/toaster
index e976604..75d3390 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -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
-- 
1.9.1



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

* [PATCH 2/4] toaster: get rid of SRCFILE
  2015-10-15 16:34 [PATCH 0/4] toaster: fixes for toaster script brian avery
  2015-10-15 16:34 ` [PATCH 1/4] toaster: use path to the script to guess config path brian avery
@ 2015-10-15 16:34 ` brian avery
  2015-10-15 16:34 ` [PATCH 3/4] toaster: set TOASTER_MANAGED variable brian avery
  2015-10-15 16:34 ` [PATCH 4/4] toaster: exit or return depending on the mode brian avery
  3 siblings, 0 replies; 5+ messages in thread
From: brian avery @ 2015-10-15 16:34 UTC (permalink / raw)
  To: bitbake-devel

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Used TOASTER variable instead of SRCFILE as they're
essentially the same.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
---
 bin/toaster | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/bin/toaster b/bin/toaster
index 75d3390..d7c5a84 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -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.
 
-- 
1.9.1



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

* [PATCH 3/4] toaster: set TOASTER_MANAGED variable
  2015-10-15 16:34 [PATCH 0/4] toaster: fixes for toaster script brian avery
  2015-10-15 16:34 ` [PATCH 1/4] toaster: use path to the script to guess config path brian avery
  2015-10-15 16:34 ` [PATCH 2/4] toaster: get rid of SRCFILE brian avery
@ 2015-10-15 16:34 ` brian avery
  2015-10-15 16:34 ` [PATCH 4/4] toaster: exit or return depending on the mode brian avery
  3 siblings, 0 replies; 5+ messages in thread
From: brian avery @ 2015-10-15 16:34 UTC (permalink / raw)
  To: bitbake-devel

From: Ed Bartosh <ed.bartosh@linux.intel.com>

Set TOASTER_MANAGED to 1 if toaster is run as a script.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
---
 bin/toaster | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/toaster b/bin/toaster
index d7c5a84..cf93e9f 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -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
-- 
1.9.1



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

* [PATCH 4/4] toaster: exit or return depending on the mode
  2015-10-15 16:34 [PATCH 0/4] toaster: fixes for toaster script brian avery
                   ` (2 preceding siblings ...)
  2015-10-15 16:34 ` [PATCH 3/4] toaster: set TOASTER_MANAGED variable brian avery
@ 2015-10-15 16:34 ` brian avery
  3 siblings, 0 replies; 5+ messages in thread
From: brian avery @ 2015-10-15 16:34 UTC (permalink / raw)
  To: bitbake-devel

From: Ed Bartosh <ed.bartosh@linux.intel.com>

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.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
---
 bin/toaster | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/toaster b/bin/toaster
index cf93e9f..2c3432c 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -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 )
-- 
1.9.1



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

end of thread, other threads:[~2015-10-15 16:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 16:34 [PATCH 0/4] toaster: fixes for toaster script brian avery
2015-10-15 16:34 ` [PATCH 1/4] toaster: use path to the script to guess config path brian avery
2015-10-15 16:34 ` [PATCH 2/4] toaster: get rid of SRCFILE brian avery
2015-10-15 16:34 ` [PATCH 3/4] toaster: set TOASTER_MANAGED variable brian avery
2015-10-15 16:34 ` [PATCH 4/4] toaster: exit or return depending on the mode brian avery

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.