summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2017-06-14 21:57:29 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-22 09:23:38 +0100
commit246b2fde383c6b6fdde83db686e0f8a2a9b94615 (patch)
tree4adc780a81d5eba0ad259858608b53e716800982 /bitbake/bin
parent9e622784e16cc38e1334979557f90ce87e9408a1 (diff)
downloadopenembedded-core-contrib-246b2fde383c6b6fdde83db686e0f8a2a9b94615.tar.gz
bitbake: toaster: noweb should init database
When the 'noweb' option for Toaster is used, perform the database check/create if the Toaster database does not yet exist. This will allow Toaster to not fail if the first use is with 'noweb'. This avoids potentially clashing database updates if there are multiple overlaping 'noweb' sessions (for example with a CI system). If the user wished to update the database, they can either use the explicit "lsupdate" command or (re)start a web hosted Toaster session (which is gated by the webserver's PID). [YOCTO #11378] (Bitbake rev: 910b96b9894c712aa32b5d4dadda88b766d86e35) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster50
1 files changed, 35 insertions, 15 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index fd6cabf378..61a4a0f85d 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -24,6 +24,29 @@ Usage: source toaster start|stop [webport=<address:port>] [noweb]
[webport] Set the development server (default: localhost:8000)
"
+databaseCheck()
+{
+ retval=0
+ # you can always add a superuser later via
+ # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME>
+ $MANAGE migrate --noinput || retval=1
+
+ if [ $retval -eq 1 ]; then
+ echo "Failed migrations, aborting system start" 1>&2
+ return $retval
+ fi
+ # Make sure that checksettings can pick up any value for TEMPLATECONF
+ export TEMPLATECONF
+ $MANAGE checksettings --traceback || retval=1
+
+ if [ $retval -eq 1 ]; then
+ printf "\nError while checking settings; aborting\n"
+ return $retval
+ fi
+
+ return $retval
+}
+
webserverKillAll()
{
local pidfile
@@ -48,22 +71,9 @@ webserverStartAll()
fi
retval=0
- # you can always add a superuser later via
- # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME>
- $MANAGE migrate --noinput || retval=1
- if [ $retval -eq 1 ]; then
- echo "Failed migrations, aborting system start" 1>&2
- return $retval
- fi
- # Make sure that checksettings can pick up any value for TEMPLATECONF
- export TEMPLATECONF
- $MANAGE checksettings --traceback || retval=1
-
- if [ $retval -eq 1 ]; then
- printf "\nError while checking settings; aborting\n"
- return $retval
- fi
+ # check the database
+ databaseCheck || return 1
echo "Starting webserver..."
@@ -240,6 +250,16 @@ case $CMD in
line='INHERIT+="toaster buildhistory"'
grep -q "$line" $conf || echo $line >> $conf
+ if [ $WEBSERVER -eq 0 ] ; then
+ # Do not update the database for "noweb" unless
+ # it does not yet exist
+ if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then
+ if ! databaseCheck; then
+ echo "Failed ${CMD}."
+ return 4
+ fi
+ fi
+ fi
if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
echo "Failed ${CMD}."
return 4