summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-05-04 13:03:59 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-12 12:14:12 +0100
commitb546be990d8e65ad6865194e06389fc013d0184e (patch)
tree9076f17f824c5b8f232a26484928a77586e70e44 /bitbake
parent13e88144bf3d68cc509452fd1a5356f7db8870bc (diff)
downloadpoky-b546be990d8e65ad6865194e06389fc013d0184e.tar.gz
bitbake: toaster: Code cleanup: indent
Replaced tabs with 4 spaces. Removed useless semicolons at the end of lines. (Bitbake rev: 5bfe5eb0bf1e53ddb04c31e786e1ffc15542e6e8) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/toaster125
1 files changed, 62 insertions, 63 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 8568c133ee..f5ee68ca25 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -30,65 +30,65 @@
30 30
31function webserverKillAll() 31function webserverKillAll()
32{ 32{
33 local pidfile 33 local pidfile
34 for pidfile in ${BUILDDIR}/.toastermain.pid; do 34 for pidfile in ${BUILDDIR}/.toastermain.pid; do
35 if [ -f ${pidfile} ]; then 35 if [ -f ${pidfile} ]; then
36 while kill -0 $(< ${pidfile}) 2>/dev/null; do 36 while kill -0 $(< ${pidfile}) 2>/dev/null; do
37 kill -SIGTERM -$(< ${pidfile}) 2>/dev/null 37 kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
38 sleep 1; 38 sleep 1
39 # Kill processes if they are still running - may happen in interactive shells 39 # Kill processes if they are still running - may happen in interactive shells
40 pkill -U $UID -f "python.*manage.py runserver" 40 pkill -U $UID -f "python.*manage.py runserver"
41 done; 41 done;
42 rm ${pidfile} 42 rm ${pidfile}
43 fi 43 fi
44 done 44 done
45} 45}
46 46
47function webserverStartAll() 47function webserverStartAll()
48{ 48{
49 # do not start if toastermain points to a valid process 49 # do not start if toastermain points to a valid process
50 if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{} kill -0 {} ; then 50 if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{} kill -0 {} ; then
51 retval=1 51 retval=1
52 rm "${BUILDDIR}/.toastermain.pid" 52 rm "${BUILDDIR}/.toastermain.pid"
53 fi 53 fi
54 54
55 retval=0
56 python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1
57 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=2
58 if [ $retval -eq 1 ]; then
59 echo "Failed db sync, stopping system start" 1>&2
60 elif [ $retval -eq 2 ]; then
61 echo -e "\nError on migration, trying to recover... \n"
62 python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial --fake
55 retval=0 63 retval=0
56 python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1 64 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
57 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=2 65 fi
58 if [ $retval -eq 1 ]; then 66 if [ "$TOASTER_MANAGED" '==' '1' ]; then
59 echo "Failed db sync, stopping system start" 1>&2 67 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1
60 elif [ $retval -eq 2 ]; then 68 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
61 echo -e "\nError on migration, trying to recover... \n" 69 fi
62 python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial --fake 70 if [ $retval -eq 0 ]; then
63 retval=0 71 echo "Starting webserver..."
64 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 72 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
65 fi 73 sleep 1
66 if [ "$TOASTER_MANAGED" '==' '1' ]; then 74 if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then
67 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 75 retval=1
68 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 76 rm "${BUILDDIR}/.toastermain.pid"
69 fi 77 else
70 if [ $retval -eq 0 ]; then 78 echo "Webserver address: http://0.0.0.0:$WEB_PORT/"
71 echo "Starting webserver..."
72 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
73 sleep 1
74 if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then
75 retval=1
76 rm "${BUILDDIR}/.toastermain.pid"
77 else
78 echo "Webserver address: http://0.0.0.0:$WEB_PORT/"
79 fi
80 fi 79 fi
81 return $retval 80 fi
81 return $retval
82} 82}
83 83
84# Helper functions to add a special configuration file 84# Helper functions to add a special configuration file
85 85
86function addtoConfiguration() 86function addtoConfiguration()
87{ 87{
88 file=$1 88 file=$1
89 shift 89 shift
90 echo "#Created by toaster start script" > ${BUILDDIR}/conf/$file 90 echo "#Created by toaster start script" > ${BUILDDIR}/conf/$file
91 for var in "$@"; do echo $var >> ${BUILDDIR}/conf/$file; done 91 for var in "$@"; do echo $var >> ${BUILDDIR}/conf/$file; done
92} 92}
93 93
94INSTOPSYSTEM=0 94INSTOPSYSTEM=0
@@ -127,7 +127,7 @@ function notify_chldexit() {
127 127
128 128
129function verify_prereq() { 129function verify_prereq() {
130 # Verify prerequisites 130 # Verify prerequisites
131 131
132 if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True >/dev/null; then 132 if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True >/dev/null; then
133 echo -e "This program needs Django 1.6. Please install with\n\npip install django==1.6\n" 133 echo -e "This program needs Django 1.6. Please install with\n\npip install django==1.6\n"
@@ -174,25 +174,25 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
174 # Start just the web server, point the web browser to the interface, and start any Django services. 174 # Start just the web server, point the web browser to the interface, and start any Django services.
175 175
176 if ! verify_prereq; then 176 if ! verify_prereq; then
177 echo -e "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2; 177 echo -e "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2
178 exit 1; 178 exit 1
179 fi 179 fi
180 180
181 if [ -n "$BUILDDIR" ]; then 181 if [ -n "$BUILDDIR" ]; then
182 echo -e "Error: It looks like you sourced oe-init-build-env. Toaster cannot start in build mode from an oe-core build environment.\n You should be starting Toaster from a new terminal window." 1>&2; 182 echo -e "Error: It looks like you sourced oe-init-build-env. Toaster cannot start in build mode from an oe-core build environment.\n You should be starting Toaster from a new terminal window." 1>&2
183 exit 1; 183 exit 1
184 fi 184 fi
185 185
186 if ! which daemon >/dev/null 2>&1; then 186 if ! which daemon >/dev/null 2>&1; then
187 echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2; 187 echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2
188 exit 1; 188 exit 1
189 fi 189 fi
190 190
191 # Define a fake builddir where only the pid files are actually created. No real builds will take place here. 191 # Define a fake builddir where only the pid files are actually created. No real builds will take place here.
192 BUILDDIR=/tmp/toaster_$$ 192 BUILDDIR=/tmp/toaster_$$
193 if [ -d "$BUILDDIR" ]; then 193 if [ -d "$BUILDDIR" ]; then
194 echo -e "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1 194 echo -e "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
195 exit 1; 195 exit 1
196 fi 196 fi
197 197
198 mkdir -p "$BUILDDIR" 198 mkdir -p "$BUILDDIR"
@@ -219,14 +219,14 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
219 else 219 else
220 echo "No errors found, removing the run directory '$BUILDDIR'" 220 echo "No errors found, removing the run directory '$BUILDDIR'"
221 do_cleanup 221 do_cleanup
222 fi; 222 fi
223 } 223 }
224 TOASTER_MANAGED=1 224 TOASTER_MANAGED=1
225 export TOASTER_MANAGED=1 225 export TOASTER_MANAGED=1
226 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then 226 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
227 echo "Failed to start the web server, stopping" 1>&2; 227 echo "Failed to start the web server, stopping" 1>&2
228 cleanup 228 cleanup
229 exit 1; 229 exit 1
230 fi 230 fi
231 if [ $WEBSERVER -gt 0 ]; then 231 if [ $WEBSERVER -gt 0 ]; then
232 echo "Starting browser..." 232 echo "Starting browser..."
@@ -245,14 +245,14 @@ fi
245 245
246 246
247if ! verify_prereq; then 247if ! verify_prereq; then
248 echo -e "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2; 248 echo -e "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2
249 return 1; 249 return 1
250fi 250fi
251 251
252 252
253# We make sure we're running in the current shell and in a good environment 253# We make sure we're running in the current shell and in a good environment
254if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then 254if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
255 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2; 255 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2
256 return 2 256 return 2
257fi 257fi
258 258
@@ -265,7 +265,7 @@ else
265 CMD="start" 265 CMD="start"
266 else 266 else
267 CMD="stop" 267 CMD="stop"
268 fi; 268 fi
269fi 269fi
270 270
271echo "The system will $CMD." 271echo "The system will $CMD."
@@ -303,7 +303,7 @@ case $CMD in
303 unset BBSERVER 303 unset BBSERVER
304 PREREAD="" 304 PREREAD=""
305 if [ -e ${BUILDDIR}/conf/toaster-pre.conf ]; then 305 if [ -e ${BUILDDIR}/conf/toaster-pre.conf ]; then
306 rm ${BUILDDIR}/conf/toaster-pre.conf 306 rm ${BUILDDIR}/conf/toaster-pre.conf
307 fi 307 fi
308 bitbake $PREREAD --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 308 bitbake $PREREAD --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0
309 if [ $? -ne 0 ]; then 309 if [ $? -ne 0 ]; then
@@ -337,4 +337,3 @@ case $CMD in
337 ;; 337 ;;
338esac 338esac
339 339
340