* [PATCH 0/1] toaster: allow noweb option to also init database
@ 2017-06-15 4:57 David Reyna
2017-06-15 4:57 ` [PATCH 1/1] toaster: noweb should " David Reyna
0 siblings, 1 reply; 2+ messages in thread
From: David Reyna @ 2017-06-15 4:57 UTC (permalink / raw)
To: bitbake-devel
From: David Reyna <David.Reyna@windriver.com>
if the 'noweb' option for Toaster is used first, it should also be able
to initialize the Toaster database.
The following changes since commit 6964efddd31c479386d1643c1025bc102710392f:
bitbake: cooker: ensure graceful exit after exception during BuildCompleted handler (2017-06-14 14:54:25 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib dreyna/submit/dreyna/toaster/noweb_db_11378
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=dreyna/submit/dreyna/toaster/noweb_db_11378
David Reyna (1):
toaster: noweb should init database
bin/toaster | 50 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 15 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 1/1] toaster: noweb should init database
2017-06-15 4:57 [PATCH 0/1] toaster: allow noweb option to also init database David Reyna
@ 2017-06-15 4:57 ` David Reyna
0 siblings, 0 replies; 2+ messages in thread
From: David Reyna @ 2017-06-15 4:57 UTC (permalink / raw)
To: bitbake-devel
From: David Reyna <David.Reyna@windriver.com>
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]
Signed-off-by: David Reyna <David.Reyna@windriver.com>
---
bin/toaster | 50 +++++++++++++++++++++++++++++++++++---------------
1 file changed, 35 insertions(+), 15 deletions(-)
diff --git a/bin/toaster b/bin/toaster
index fd6cabf..61a4a0f 100755
--- a/bin/toaster
+++ b/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
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-15 5:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15 4:57 [PATCH 0/1] toaster: allow noweb option to also init database David Reyna
2017-06-15 4:57 ` [PATCH 1/1] toaster: noweb should " David Reyna
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.