Skip to contentSkip to conversation

toaster script improvements

PATCH New Ed Bartosh 1 participant 12 messages Dec 11, 2015

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

cover toaster script improvements

Hi,

This patchset includes bunch of readability, usability and code style fixes for toaster script. It was started as a fix for #8775 and then I just couldn't stop and decided to make the script a bit better.

The following changes since commit 8e8b585191cafe9420e31de58d786afffe93d532:

toasterconf: remove SDKMACHINE variable (2015-12-10 16:28:21 +0200)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib ed/toaster/improve-toaster-script
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/improve-toaster-script

Ed Bartosh (11):
toaster: implement checksocket command
toaster: check if address:port is in use
toaster: split long lines, add/remove witespaces
toaster: remove unused variable
toaster: add MANAGE variable
toaster: updated header of the toaster script
toaster: remove addtoConfiguration function
toaster: remove 2 unused functions
toaster: move checks to another place
toaster: move setting of default values
toaster: remove 2 confusing parameters

 bitbake/bin/toaster                                | 144 +++++++++------------
 .../toastermain/management/commands/checksocket.py |  69 ++++++++++
 2 files changed, 129 insertions(+), 84 deletions(-)
 create mode 100644 bitbake/lib/toaster/toastermain/management/commands/checksocket.py

--
Regards,
Ed

author
#1 lore raw

PATCH 1/11 toaster: implement checksocket command

Implemented new management command to check if it's possible to listen on specified address:port.

[YOCTO #8775]

---
 .../toastermain/management/commands/checksocket.py | 69 ++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 bitbake/lib/toaster/toastermain/management/commands/checksocket.py
bitbake/lib/toaster/toastermain/management/commands/checksocket.py new file +69 -0
new file mode 100644
index 0000000..0399b86
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# BitBake Toaster Implementation
+#
+# Copyright (C) 2015 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""Custom management command checksocket."""
+
+import errno
+import socket
+
+from django.core.management.base import BaseCommand, CommandError
+from django.utils.encoding import force_text
+
+DEFAULT_ADDRPORT = "0.0.0.0:8000"
+
+class Command(BaseCommand):
+    """Custom management command."""
+
+    help = 'Check if Toaster can listen on address:port'
+
+    def add_arguments(self, parser):
+        parser.add_argument('addrport', nargs='?', default=DEFAULT_ADDRPORT,
+                            help='ipaddr:port to check, %s by default' % \
+                                 DEFAULT_ADDRPORT)
+
+    def handle(self, *args, **options):
+        addrport = options['addrport']
+        if ':' not in addrport:
+            raise CommandError('Invalid addr:port specified: %s' % addrport)
+        splitted = addrport.split(':')
+        try:
+            splitted[1] = int(splitted[1])
+        except ValueError:
+            raise CommandError('Invalid port specified: %s' % splitted[1])
+        self.stdout.write('Check if toaster can listen on %s' % addrport)
+        try:
+            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+            sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+            sock.bind(tuple(splitted))
+        except (socket.error, OverflowError) as err:
+            errors = {
+                errno.EACCES: 'You don\'t have permission to access port %s' \
+                              % splitted[1],
+                errno.EADDRINUSE: 'Port %s is already in use' % splitted[1],
+                errno.EADDRNOTAVAIL: 'IP address can\'t be assigned to',
+            }
+            if hasattr(err, 'errno') and err.errno in errors:
+                errtext = errors[err.errno]
+            else:
+                errtext = force_text(err)
+            raise CommandError(errtext)
+
+        self.stdout.write("OK")
Signature · 1 line
2.1.4
author
#2 lore raw

PATCH 2/11 toaster: check if address:port is in use

In reply to Ed Bartosh

Used new management command checksocket to check if Toaster can listen on address:port.

[YOCTO #8775]

---
 bitbake/bin/toaster | 5 +++++
 1 file changed, 5 insertions(+)
bitbake/bin/toaster +5 -0
index 1c1e029..f43bcb1 100755
@@ -309,6 +309,11 @@ fi
 
 echo "The system will $CMD."
 
+# check if addr:port is not in use
+if [ "$CMD" == 'start' ]; then
+    python $BBBASEDIR/lib/toaster/manage.py checksocket "0.0.0.0:$WEB_PORT" || return 1
+fi
+
 # Make sure it's safe to run by checking bitbake lock
 
 lock=1
Signature · 1 line
2.1.4
author
#3 lore raw

PATCH 3/11 toaster: split long lines, add/remove witespaces

In reply to Ed Bartosh

Made toaster script more readable by splitting long lines and removing and adding whitespaces.

---
 bitbake/bin/toaster | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)
bitbake/bin/toaster +19 -12
index f43bcb1..a849559 100755
@@ -37,7 +37,8 @@ webserverKillAll()
             while kill -0 $pid 2>/dev/null; do
                 kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
-                # Kill processes if they are still running - may happen in interactive shells
+                # Kill processes if they are still running - may happen
+                # in interactive shells
                 ps fux | grep "python.*manage.py runserver" | awk '{print $2}' | xargs kill
             done
             rm  ${pidfile}
@@ -55,7 +56,7 @@ webserverStartAll()
 
     retval=0
     # you can always add a superuser later via
-    # python bitbake/lib/toaster/manage.py python manage.py createsuperuser --username=<ME>
+    # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME>
     python $BBBASEDIR/lib/toaster/manage.py migrate --noinput || retval=1
 
     if [ $retval -eq 1 ]; then
@@ -72,7 +73,9 @@ webserverStartAll()
 
     echo "Starting webserver..."
 
-    python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid
+    python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" \
+           </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \
+           & echo $! >${BUILDDIR}/.toastermain.pid
 
     sleep 1
 
@@ -128,8 +131,10 @@ start_bitbake() {
     fi
     export BBSERVER=0.0.0.0:-1
     export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl`
-    if [ $NOTOASTERUI -eq 0 ]; then        # we start the TOASTERUI only if not inhibited
-        bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \
+    # we start the TOASTERUI only if not inhibited
+    if [ $NOTOASTERUI -eq 0 ]; then
+        bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc \
+            >>${BUILDDIR}/toaster_ui.log 2>&1 \
             & echo $! >${BUILDDIR}/.toasterui.pid
     fi
     return 0
@@ -146,7 +151,6 @@ check_pidbyfile() {
     [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
-
 notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
@@ -154,7 +158,6 @@ notify_chldexit() {
     fi
 }
 
-
 verify_prereq() {
     # Verify Django version
     reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
@@ -171,7 +174,6 @@ verify_prereq() {
     return 0
 }
 
-
 # read command line parameters
 if [ -n "$BASH_SOURCE" ] ; then
     TOASTER=${BASH_SOURCE}
@@ -207,7 +209,7 @@ if [ -n "$TEMPLATECONF" ]; then
         fi
         if [ ! -d "$TEMPLATECONF" ]; then
             echo >&2 "Error: '$TEMPLATECONF' must be a directory containing toasterconf.json"
-	    [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
+            [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
         fi
     fi
 fi
@@ -216,10 +218,12 @@ if [ "$TOASTER_CONF" = "" ]; then
     TOASTER_CONF="$TEMPLATECONF/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. Set TOASTER_CONF to specify file or fix .templateconf"
     [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
 fi
+
 # this defines the dir toaster will use for
 # 1) clones of layers (in _toaster_clones )
 # 2) the build dir (in build)
@@ -284,7 +288,8 @@ if [ "$TOASTER_CONF" = "" ]; then
     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. set TOASTER_CONF to specify a path"
+    echo "$TOASTER_CONF configuration file not found."
+    echo " set TOASTER_CONF to specify a path"
     return 1
 fi
 # this defines the dir toaster will use for
@@ -293,7 +298,8 @@ fi
 # 3) the sqlite db if that is being used.
 # 4) pid's we need to clean up on exit/shutdown
 # note: for future. in order to make this an arbitrary directory, we need to
-# make sure that the toaster.sqlite file doesn't default to `pwd` like it currently does.
+# make sure that the toaster.sqlite file doesn't default to `pwd`
+# like it currently does.
 export TOASTER_DIR=`dirname $BUILDDIR`
 
 # Determine the action. If specified by arguments, fine, if not, toggle it
@@ -328,7 +334,8 @@ if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then
 fi
 
 if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
-    echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2
+    echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
+    echo " Something fishy is going on." 1>&2
     echo "Cleaning up the web server to start from a clean slate."
     webserverKillAll
 fi
Signature · 1 line
2.1.4
author
#4 lore raw

PATCH 4/11 toaster: remove unused variable

In reply to Ed Bartosh

Removed unused variable RUNNING from the toaster script.

---
 bitbake/bin/toaster | 1 -
 1 file changed, 1 deletion(-)
bitbake/bin/toaster +0 -1
index a849559..ccbfdb3 100755
@@ -185,7 +185,6 @@ fi
 
 BBBASEDIR=`dirname $TOASTER`/..
 OEROOT=`dirname $TOASTER`/../..
-RUNNING=0
 NOTOASTERUI=0
 WEBSERVER=1
 TOASTER_BRBE=""
Signature · 1 line
2.1.4
author
#5 lore raw

PATCH 5/11 toaster: add MANAGE variable

In reply to Ed Bartosh

Used MANAGE variable to avoid repeating path to
manage.py in many places in toaster script.

---
 bitbake/bin/toaster | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
bitbake/bin/toaster +7 -6
index ccbfdb3..087e3f9 100755
@@ -57,14 +57,14 @@ webserverStartAll()
     retval=0
     # you can always add a superuser later via
     # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME>
-    python $BBBASEDIR/lib/toaster/manage.py migrate --noinput || retval=1
+    $MANAGE migrate --noinput || retval=1
 
     if [ $retval -eq 1 ]; then
         echo "Failed migrations, aborting system start" 1>&2
         return $retval
     fi
 
-    python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
+    $MANAGE checksettings --traceback || retval=1
 
     if [ $retval -eq 1 ]; then
         printf "\nError while checking settings; aborting\n"
@@ -73,7 +73,7 @@ webserverStartAll()
 
     echo "Starting webserver..."
 
-    python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" \
+    $MANAGE runserver "0.0.0.0:$WEB_PORT" \
            </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \
            & echo $! >${BUILDDIR}/.toastermain.pid
 
@@ -130,7 +130,7 @@ start_bitbake() {
         return 1
     fi
     export BBSERVER=0.0.0.0:-1
-    export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl`
+    export DATABASE_URL=`$MANAGE get-dburl`
     # we start the TOASTERUI only if not inhibited
     if [ $NOTOASTERUI -eq 0 ]; then
         bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc \
@@ -184,6 +184,7 @@ else
 fi
 
 BBBASEDIR=`dirname $TOASTER`/..
+MANAGE=$BBBASEDIR/lib/toaster/manage.py
 OEROOT=`dirname $TOASTER`/../..
 NOTOASTERUI=0
 WEBSERVER=1
@@ -316,7 +317,7 @@ echo "The system will $CMD."
 
 # check if addr:port is not in use
 if [ "$CMD" == 'start' ]; then
-    python $BBBASEDIR/lib/toaster/manage.py checksocket "0.0.0.0:$WEB_PORT" || return 1
+    $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1
 fi
 
 # Make sure it's safe to run by checking bitbake lock
@@ -351,7 +352,7 @@ case $CMD in
         fi
         start_bitbake
         if [ $? -eq 0 ]; then
-            python $BBBASEDIR/lib/toaster/manage.py runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid
+            $MANAGE runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid
             # set fail safe stop system on terminal exit
             trap stop_system SIGHUP
             echo "Successful ${CMD}."
Signature · 1 line
2.1.4
author
#6 lore raw

PATCH 6/11 toaster: updated header of the toaster script

In reply to Ed Bartosh

Updated GPL information, years of development and usage information. Removed outdated information about 2 ways of starting Toaster.

---
 bitbake/bin/toaster | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
bitbake/bin/toaster +7 -13
index 087e3f9..40c3c35 100755
@@ -1,5 +1,8 @@
 #!/bin/echo ERROR: This script needs to be sourced. Please run as .
-# (c) 2013 Intel Corp.
+
+# toaster - shell script to start Toaster
+
+# Copyright (C) 2013-2015 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -12,19 +15,10 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-# This script can be run in two modes.
-
-# When used with "source", from a build directory,
-# it enables toaster event logging and starts the bitbake resident server.
-# use as:  source toaster [start|stop] [noweb] [noui]
+# along with this program. If not, see http://www.gnu.org/licenses/.
 
-# When it is called as a stand-alone script, it starts just the
-# web server, and the building shall be done through the web interface.
-# As script, it will not return to the command prompt. Stop with Ctrl-C.
+# Usage: source toaster [start|stop|restart-bitbake] [webport=<port>]
+#                       [noui] [noweb] [nobrowser] [brbe=<BRBE>]
 
 # Helper function to kill a background toaster development server
 
Signature · 1 line
2.1.4
author
#7 lore raw

PATCH 7/11 toaster: remove addtoConfiguration function

In reply to Ed Bartosh

This function is useless as it's called just once
and makes code less readable.

---
 bitbake/bin/toaster | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
bitbake/bin/toaster +6 -11
index 40c3c35..97ca177 100755
@@ -83,16 +83,6 @@ webserverStartAll()
     return $retval
 }
 
-# Helper functions to add a special configuration file
-
-addtoConfiguration()
-{
-    file=$1
-    shift
-    echo "#Created by toaster start script" > ${BUILDDIR}/conf/$file
-    for var in "$@"; do echo $var >> ${BUILDDIR}/conf/$file; done
-}
-
 INSTOPSYSTEM=0
 
 # define the stop command
@@ -339,7 +329,12 @@ fi
 
 case $CMD in
     start )
-        addtoConfiguration toaster.conf "INHERIT+=\"toaster buildhistory\"" $TOASTER_BRBE
+        # Create configuration file
+        conf=${BUILDDIR}/conf/toaster.conf
+        echo "# Created by toaster start script" > $conf
+        echo "INHERIT+=\"toaster buildhistory\"" >> $conf
+        [ -n "$TOASTER_BRBE" ] && echo $TOASTER_BRBE >> $conf
+
         if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
             echo "Failed ${CMD}."
             return 4
Signature · 1 line
2.1.4
author
#8 lore raw

PATCH 8/11 toaster: remove 2 unused functions

In reply to Ed Bartosh

Removed check_pidbyfile and notify_chldexit functions from toaster script as they're not called in the script.

---
 bitbake/bin/toaster | 12 ------------
 1 file changed, 12 deletions(-)
bitbake/bin/toaster +0 -12
index 97ca177..1f4c400 100755
@@ -131,17 +131,6 @@ stop_bitbake() {
     lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
 }
 
-check_pidbyfile() {
-    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
-}
-
-notify_chldexit() {
-    if [ $NOTOASTERUI -eq 0 ]; then
-        check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
-        stop_system
-    fi
-}
-
 verify_prereq() {
     # Verify Django version
     reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
@@ -355,7 +344,6 @@ case $CMD in
         # stop system on terminal exit
         set -o monitor
         trap stop_system SIGHUP
-        #trap notify_chldexit SIGCHLD
     ;;
     stop )
         stop_system
Signature · 1 line
2.1.4
author
#9 lore raw

PATCH 9/11 toaster: move checks to another place

In reply to Ed Bartosh

Moved addr:port, bitbake.lock and toastermain.pid checks to the place where the rest of Toaster starting happens.

---
 bitbake/bin/toaster | 49 +++++++++++++++++++++++--------------------------
 1 file changed, 23 insertions(+), 26 deletions(-)
bitbake/bin/toaster +23 -26
index 1f4c400..6dd20c1 100755
@@ -288,36 +288,33 @@ fi
 
 echo "The system will $CMD."
 
-# check if addr:port is not in use
-if [ "$CMD" == 'start' ]; then
-    $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1
-fi
-
-# Make sure it's safe to run by checking bitbake lock
-
-lock=1
-if [ -e $BUILDDIR/bitbake.lock ]; then
-    python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0
-fi
-
-if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then
-    echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
-    echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
-    return 3
-fi
-
-if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
-    echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
-    echo " Something fishy is going on." 1>&2
-    echo "Cleaning up the web server to start from a clean slate."
-    webserverKillAll
-fi
-
-
 # Execute the commands
 
 case $CMD in
     start )
+        # check if addr:port is not in use
+        if [ "$CMD" == 'start' ]; then
+             $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1
+        fi
+
+        # Make sure it's safe to start by checking bitbake lock
+        if [ -e $BUILDDIR/bitbake.lock ]; then
+            python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null
+            if [ $? -ne 0 ] ; then
+                echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
+                echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
+                return 3
+            fi
+        fi
+
+        # kill Toaster web server if it's alive
+        if [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
+            echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
+            echo " Something fishy is going on." 1>&2
+            echo "Cleaning up the web server to start from a clean slate."
+            webserverKillAll
+        fi
+
         # Create configuration file
         conf=${BUILDDIR}/conf/toaster.conf
         echo "# Created by toaster start script" > $conf
Signature · 1 line
2.1.4
author
#11 lore raw

PATCH 11/11 toaster: remove 2 confusing parameters

In reply to Ed Bartosh

Removed nobrowser and brbe script parameters as both are confusing and nobrowser is not used anywhere.

brbe parameter usage can only be justified if toaster doesn't work properly and user has to manually connect toaster to running bitbake server. Even in this scenario it's very unlikely to achieve as toaster script is not designed for this kind of usage.

---
 bitbake/bin/toaster | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
bitbake/bin/toaster +2 -11
index 7cecc7b..1f98490 100755
@@ -17,8 +17,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see http://www.gnu.org/licenses/.
 
-# Usage: source toaster [start|stop|restart-bitbake] [webport=<port>]
-#                       [noui] [noweb] [nobrowser] [brbe=<BRBE>]
+# Usage: source toaster [start|stop|restart-bitbake]
+#                       [webport=<port>] [noui] [noweb]
 
 # Helper function to kill a background toaster development server
 
@@ -203,8 +203,6 @@ export TOASTER_DIR=`pwd`
 
 NOTOASTERUI=0
 WEBSERVER=1
-NOBROWSER=0
-TOASTER_BRBE=""
 WEB_PORT="8000"
 
 for param in $*; do
@@ -215,12 +213,6 @@ for param in $*; do
     noweb )
             WEBSERVER=0
     ;;
-    nobrowser )
-            NOBROWSER=1
-    ;;
-    brbe=* )
-            TOASTER_BRBE=$'\n'"TOASTER_BRBE=\""${param#*=}"\""
-    ;;
     webport=*)
             WEB_PORT="${param#*=}"
     esac
@@ -318,7 +310,6 @@ case $CMD in
         conf=${BUILDDIR}/conf/toaster.conf
         echo "# Created by toaster start script" > $conf
         echo "INHERIT+=\"toaster buildhistory\"" >> $conf
-        [ -n "$TOASTER_BRBE" ] && echo $TOASTER_BRBE >> $conf
 
         if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
             echo "Failed ${CMD}."
Signature · 1 line
2.1.4
author
#10 lore raw

PATCH 10/11 toaster: move setting of default values

In reply to Ed Bartosh

Set default values of script parameters just before they are parsed to increase readability.

---
 bitbake/bin/toaster | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
bitbake/bin/toaster +5 -6
index 6dd20c1..7cecc7b 100755
@@ -159,12 +159,7 @@ fi
 BBBASEDIR=`dirname $TOASTER`/..
 MANAGE=$BBBASEDIR/lib/toaster/manage.py
 OEROOT=`dirname $TOASTER`/../..
-NOTOASTERUI=0
-WEBSERVER=1
-TOASTER_BRBE=""
-if [ "$WEB_PORT" = "" ]; then
-    WEB_PORT="8000"
-fi
+
 # this is the configuraton file we are using for toaster
 # we are using the same logic that oe-setup-builddir uses
 # (based on TEMPLATECONF and .templateconf) to determine
@@ -206,7 +201,11 @@ fi
 # make sure that the toaster.sqlite file doesn't default to `pwd` like it currently does.
 export TOASTER_DIR=`pwd`
 
+NOTOASTERUI=0
+WEBSERVER=1
 NOBROWSER=0
+TOASTER_BRBE=""
+WEB_PORT="8000"
 
 for param in $*; do
     case $param in
Signature · 1 line
2.1.4