summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/toaster
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-05 13:18:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-10 23:07:48 +0000
commitda8110a86ad8b57b8c41873d40aeac346ee66b88 (patch)
tree0c25d2757da8ed119316af0886ebb64818bdc8cd /bitbake/bin/toaster
parent0c89846dafa229b5af9653d6e141011c35451825 (diff)
downloadpoky-da8110a86ad8b57b8c41873d40aeac346ee66b88.tar.gz
bitbake: toaster: improve logging facilities for toaster
This patch improves the logging facilities for toaster in order to help diagnose bugs that happen on user machines. The logs are stored now under "/tmp/toaster_$$" where $$ is a PID-based unique identifier. On shutdown, toaster will automatically erase all logs unless errors are listed in the log file. On error, Toaster provides suggestions on what to do. This patch includes a minor fix found as a result of logging improvements. (Bitbake rev: 8a8248f7b7e30469f592e2f8adbf6ce21e8685c5) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/toaster')
-rwxr-xr-xbitbake/bin/toaster41
1 files changed, 34 insertions, 7 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index c3b8633c25..04f2e99378 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -69,7 +69,7 @@ function webserverStartAll()
69 fi 69 fi
70 if [ $retval -eq 0 ]; then 70 if [ $retval -eq 0 ]; then
71 echo "Starting webserver..." 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 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 73 sleep 1
74 if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then 74 if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then
75 retval=1 75 retval=1
@@ -189,17 +189,43 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th
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 192 BUILDDIR=/tmp/toaster_$$
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
195 exit 1;
196 fi
197
198 mkdir -p "$BUILDDIR"
199
193 RUNNING=1 200 RUNNING=1
194 function trap_ctrlc() { 201 function trap_ctrlc() {
195 echo "** Stopping system" 202 echo "** Stopping system"
196 webserverKillAll 203 webserverKillAll
197 RUNNING=0 204 RUNNING=0
198 } 205 }
206
207 function do_cleanup() {
208 find "$BUILDDIR" -type f | xargs rm
209 rmdir "$BUILDDIR"
210 }
211 function cleanup() {
212 if grep -ir error "$BUILDDIR" >/dev/null; then
213 if grep -irn "That port is already in use" "$BUILDDIR"; then
214 echo "You can use the \"webport=PORTNUMBER\" parameter to start Toaster on a different port (port $WEB_PORT is already in use)"
215 do_cleanup
216 else
217 echo -e "\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"
218 fi
219 else
220 echo "No errors found, removing the run directory '$BUILDDIR'"
221 do_cleanup
222 fi;
223 }
199 TOASTER_MANAGED=1 224 TOASTER_MANAGED=1
200 export TOASTER_MANAGED=1 225 export TOASTER_MANAGED=1
201 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then 226 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
202 echo "Failed to start the web server, stopping" 1>&2; 227 echo "Failed to start the web server, stopping" 1>&2;
228 cleanup
203 exit 1; 229 exit 1;
204 fi 230 fi
205 if [ $WEBSERVER -gt 0 ]; then 231 if [ $WEBSERVER -gt 0 ]; then
@@ -209,9 +235,10 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th
209 trap trap_ctrlc SIGINT 235 trap trap_ctrlc SIGINT
210 echo "Toaster is now running. You can stop it with Ctrl-C" 236 echo "Toaster is now running. You can stop it with Ctrl-C"
211 while [ $RUNNING -gt 0 ]; do 237 while [ $RUNNING -gt 0 ]; do
212 python $BBBASEDIR/lib/toaster/manage.py runbuilds 238 python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log"
213 sleep 1 239 sleep 1
214 done 240 done
241 cleanup
215 echo "**** Exit" 242 echo "**** Exit"
216 exit 0 243 exit 0
217fi 244fi
@@ -275,8 +302,8 @@ case $CMD in
275 fi 302 fi
276 unset BBSERVER 303 unset BBSERVER
277 PREREAD="" 304 PREREAD=""
278 if [ -e conf/toaster-pre.conf ]; then 305 if [ -e ${BUILDDIR}/conf/toaster-pre.conf ]; then
279 PREREAD="--read conf/toaster-pre.conf" 306 rm ${BUILDDIR}/conf/toaster-pre.conf
280 fi 307 fi
281 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
282 if [ $? -ne 0 ]; then 309 if [ $? -ne 0 ]; then
@@ -285,7 +312,7 @@ case $CMD in
285 else 312 else
286 export BBSERVER=0.0.0.0:-1 313 export BBSERVER=0.0.0.0:-1
287 if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited 314 if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited
288 bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid 315 bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid
289 fi 316 fi
290 fi 317 fi
291 if [ $start_success -eq 1 ]; then 318 if [ $start_success -eq 1 ]; then