summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/bin/toaster80
1 files changed, 5 insertions, 75 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 2c3432c24a..fbda8dc9f4 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/echo ERROR: This script needs to be sourced. Please run as .
2# (c) 2013 Intel Corp. 2# (c) 2013 Intel Corp.
3 3
4# This program is free software; you can redistribute it and/or modify 4# This program is free software; you can redistribute it and/or modify
@@ -81,9 +81,7 @@ webserverStartAll()
81 return $retval 81 return $retval
82 fi 82 fi
83 83
84 if [ "$TOASTER_MANAGED" = '1' ]; then 84 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
85 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
86 fi
87 85
88 if [ $retval -eq 1 ]; then 86 if [ $retval -eq 1 ]; then
89 printf "\nError while checking settings; aborting\n" 87 printf "\nError while checking settings; aborting\n"
@@ -176,8 +174,6 @@ else
176 TOASTER=$0 174 TOASTER=$0
177fi 175fi
178 176
179[ `basename \"$0\"` = `basename \"${TOASTER}\"` ] && TOASTER_MANAGED=1
180
181BBBASEDIR=`dirname $TOASTER`/.. 177BBBASEDIR=`dirname $TOASTER`/..
182 178
183RUNNING=0 179RUNNING=0
@@ -234,88 +230,22 @@ for param in $*; do
234 esac 230 esac
235done 231done
236 232
237if [ "$TOASTER_MANAGED" = '1' ]; then 233if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then
238 # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. 234 echo "Error: This script needs to be sourced. Please run as . $TOASTER"
239 # Start just the web server, point the web browser to the interface, and start any Django services. 235 exit 1
240
241 if ! verify_prereq; then
242 echo "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
243 exit 1
244 fi
245
246 if [ -n "$BUILDDIR" ]; then
247 printf "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.\n" 1>&2
248 exit 1
249 fi
250
251 # Define a fake builddir where only the pid files are actually created. No real builds will take place here.
252 BUILDDIR=/tmp/toaster_$$
253 if [ -d "$BUILDDIR" ]; then
254 echo "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
255 exit 1
256 fi
257
258 mkdir -p "$BUILDDIR"
259
260 RUNNING=1
261 trap_ctrlc() {
262 echo "** Stopping system"
263 webserverKillAll
264 RUNNING=0
265 }
266
267 do_cleanup() {
268 find "$BUILDDIR" -type f | xargs rm
269 rmdir "$BUILDDIR"
270 }
271 cleanup() {
272 if grep -ir error "$BUILDDIR" >/dev/null; then
273 if grep -irn "That port is already in use" "$BUILDDIR"; then
274 echo "You can use the \"webport=PORTNUMBER\" parameter to start Toaster on a different port (port $WEB_PORT is already in use)"
275 do_cleanup
276 else
277 printf "\nErrors found in the Toaster log files present in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify toaster@yoctoproject.org or submit a bug https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
278 fi
279 else
280 echo "No errors found, removing the run directory '$BUILDDIR'"
281 do_cleanup
282 fi
283 }
284 export TOASTER_MANAGED=1
285 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
286 echo "Failed to start the web server, stopping" 1>&2
287 cleanup
288 exit 1
289 fi
290 if [ $WEBSERVER -gt 0 ] && [ $NOBROWSER -eq 0 ] ; then
291 echo "Starting browser..."
292 xdg-open http://127.0.0.1:$WEB_PORT/ >/dev/null 2>&1 &
293 fi
294 trap trap_ctrlc 2
295 echo "Toaster is now running. You can stop it with Ctrl-C"
296 while [ $RUNNING -gt 0 ]; do
297 python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log"
298 sleep 1
299 done
300 cleanup
301 echo "**** Exit"
302 exit 0
303fi 236fi
304 237
305
306if ! verify_prereq; then 238if ! verify_prereq; then
307 echo "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 239 echo "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
308 return 1 240 return 1
309fi 241fi
310 242
311
312# We make sure we're running in the current shell and in a good environment 243# We make sure we're running in the current shell and in a good environment
313if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then 244if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
314 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2 245 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2
315 return 2 246 return 2
316fi 247fi
317 248
318
319# Determine the action. If specified by arguments, fine, if not, toggle it 249# Determine the action. If specified by arguments, fine, if not, toggle it
320if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then 250if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then
321 CMD="$1" 251 CMD="$1"