Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 03C48E00B36; Fri, 11 Dec 2015 06:10:31 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.88 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 02E60E00978 for ; Fri, 11 Dec 2015 06:10:28 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 11 Dec 2015 06:10:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,413,1444719600"; d="scan'208";a="869577598" Received: from linux.intel.com ([10.23.219.25]) by orsmga002.jf.intel.com with ESMTP; 11 Dec 2015 06:10:28 -0800 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.51]) by linux.intel.com (Postfix) with ESMTP id 27A4B6A4087 for ; Fri, 11 Dec 2015 06:58:29 -0800 (PST) From: Ed Bartosh To: toaster@yoctoproject.org Date: Fri, 11 Dec 2015 15:37:59 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH 03/11] toaster: split long lines, add/remove witespaces X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Dec 2015 14:10:31 -0000 Made toaster script more readable by splitting long lines and removing and adding whitespaces. Signed-off-by: Ed Bartosh --- bitbake/bin/toaster | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index f43bcb1..a849559 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster @@ -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= + # ../bitbake/lib/toaster/manage.py createsuperuser --username= 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" >${BUILDDIR}/toaster_web.log 2>&1 & echo $! >${BUILDDIR}/.toastermain.pid + python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" \ + >${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 -- 2.1.4