summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-12-17 16:48:48 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-18 13:51:53 +0000
commitaa3cc12db9c45595fd9e108418d0ee16c396d69d (patch)
tree9a5a5e84b6f44e4efd229648b8deb996d1d20f5b /bitbake/bin
parent8e4acacb53ef3af83cb67676dbca8471ca5911e5 (diff)
downloadpoky-aa3cc12db9c45595fd9e108418d0ee16c396d69d.tar.gz
bitbake: toaster: split long lines, add/remove whitespace
Made toaster script more readable by splitting long lines and removing and adding whitespace. (Bitbake rev: 6d61d7903eb4fb12464bfea54d3a225f99ad394f) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster31
1 files changed, 19 insertions, 12 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index f43bcb167e..a8495592e2 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -37,7 +37,8 @@ webserverKillAll()
37 while kill -0 $pid 2>/dev/null; do 37 while kill -0 $pid 2>/dev/null; do
38 kill -SIGTERM -$pid 2>/dev/null 38 kill -SIGTERM -$pid 2>/dev/null
39 sleep 1 39 sleep 1
40 # Kill processes if they are still running - may happen in interactive shells 40 # Kill processes if they are still running - may happen
41 # in interactive shells
41 ps fux | grep "python.*manage.py runserver" | awk '{print $2}' | xargs kill 42 ps fux | grep "python.*manage.py runserver" | awk '{print $2}' | xargs kill
42 done 43 done
43 rm ${pidfile} 44 rm ${pidfile}
@@ -55,7 +56,7 @@ webserverStartAll()
55 56
56 retval=0 57 retval=0
57 # you can always add a superuser later via 58 # you can always add a superuser later via
58 # python bitbake/lib/toaster/manage.py python manage.py createsuperuser --username=<ME> 59 # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME>
59 python $BBBASEDIR/lib/toaster/manage.py migrate --noinput || retval=1 60 python $BBBASEDIR/lib/toaster/manage.py migrate --noinput || retval=1
60 61
61 if [ $retval -eq 1 ]; then 62 if [ $retval -eq 1 ]; then
@@ -72,7 +73,9 @@ webserverStartAll()
72 73
73 echo "Starting webserver..." 74 echo "Starting webserver..."
74 75
75 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 76 python $BBBASEDIR/lib/toaster/manage.py runserver "0.0.0.0:$WEB_PORT" \
77 </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \
78 & echo $! >${BUILDDIR}/.toastermain.pid
76 79
77 sleep 1 80 sleep 1
78 81
@@ -128,8 +131,10 @@ start_bitbake() {
128 fi 131 fi
129 export BBSERVER=0.0.0.0:-1 132 export BBSERVER=0.0.0.0:-1
130 export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl` 133 export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl`
131 if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited 134 # we start the TOASTERUI only if not inhibited
132 bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \ 135 if [ $NOTOASTERUI -eq 0 ]; then
136 bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc \
137 >>${BUILDDIR}/toaster_ui.log 2>&1 \
133 & echo $! >${BUILDDIR}/.toasterui.pid 138 & echo $! >${BUILDDIR}/.toasterui.pid
134 fi 139 fi
135 return 0 140 return 0
@@ -146,7 +151,6 @@ check_pidbyfile() {
146 [ -e $1 ] && kill -0 `cat $1` 2>/dev/null 151 [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
147} 152}
148 153
149
150notify_chldexit() { 154notify_chldexit() {
151 if [ $NOTOASTERUI -eq 0 ]; then 155 if [ $NOTOASTERUI -eq 0 ]; then
152 check_pidbyfile ${BUILDDIR}/.toasterui.pid && return 156 check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
@@ -154,7 +158,6 @@ notify_chldexit() {
154 fi 158 fi
155} 159}
156 160
157
158verify_prereq() { 161verify_prereq() {
159 # Verify Django version 162 # Verify Django version
160 reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')") 163 reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
@@ -171,7 +174,6 @@ verify_prereq() {
171 return 0 174 return 0
172} 175}
173 176
174
175# read command line parameters 177# read command line parameters
176if [ -n "$BASH_SOURCE" ] ; then 178if [ -n "$BASH_SOURCE" ] ; then
177 TOASTER=${BASH_SOURCE} 179 TOASTER=${BASH_SOURCE}
@@ -207,7 +209,7 @@ if [ -n "$TEMPLATECONF" ]; then
207 fi 209 fi
208 if [ ! -d "$TEMPLATECONF" ]; then 210 if [ ! -d "$TEMPLATECONF" ]; then
209 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing toasterconf.json" 211 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing toasterconf.json"
210 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 212 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
211 fi 213 fi
212 fi 214 fi
213fi 215fi
@@ -216,10 +218,12 @@ if [ "$TOASTER_CONF" = "" ]; then
216 TOASTER_CONF="$TEMPLATECONF/toasterconf.json" 218 TOASTER_CONF="$TEMPLATECONF/toasterconf.json"
217 export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')") 219 export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')")
218fi 220fi
221
219if [ ! -f $TOASTER_CONF ]; then 222if [ ! -f $TOASTER_CONF ]; then
220 echo "$TOASTER_CONF configuration file not found. Set TOASTER_CONF to specify file or fix .templateconf" 223 echo "$TOASTER_CONF configuration file not found. Set TOASTER_CONF to specify file or fix .templateconf"
221 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 224 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
222fi 225fi
226
223# this defines the dir toaster will use for 227# this defines the dir toaster will use for
224# 1) clones of layers (in _toaster_clones ) 228# 1) clones of layers (in _toaster_clones )
225# 2) the build dir (in build) 229# 2) the build dir (in build)
@@ -284,7 +288,8 @@ if [ "$TOASTER_CONF" = "" ]; then
284 export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')") 288 export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')")
285fi 289fi
286if [ ! -f $TOASTER_CONF ]; then 290if [ ! -f $TOASTER_CONF ]; then
287 echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" 291 echo "$TOASTER_CONF configuration file not found."
292 echo " set TOASTER_CONF to specify a path"
288 return 1 293 return 1
289fi 294fi
290# this defines the dir toaster will use for 295# this defines the dir toaster will use for
@@ -293,7 +298,8 @@ fi
293# 3) the sqlite db if that is being used. 298# 3) the sqlite db if that is being used.
294# 4) pid's we need to clean up on exit/shutdown 299# 4) pid's we need to clean up on exit/shutdown
295# note: for future. in order to make this an arbitrary directory, we need to 300# note: for future. in order to make this an arbitrary directory, we need to
296# make sure that the toaster.sqlite file doesn't default to `pwd` like it currently does. 301# make sure that the toaster.sqlite file doesn't default to `pwd`
302# like it currently does.
297export TOASTER_DIR=`dirname $BUILDDIR` 303export TOASTER_DIR=`dirname $BUILDDIR`
298 304
299# Determine the action. If specified by arguments, fine, if not, toggle it 305# Determine the action. If specified by arguments, fine, if not, toggle it
@@ -328,7 +334,8 @@ if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then
328fi 334fi
329 335
330if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then 336if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
331 echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2 337 echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
338 echo " Something fishy is going on." 1>&2
332 echo "Cleaning up the web server to start from a clean slate." 339 echo "Cleaning up the web server to start from a clean slate."
333 webserverKillAll 340 webserverKillAll
334fi 341fi