summaryrefslogtreecommitdiff
path: root/import-layers/yocto-poky/bitbake/bin/toaster
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-02-01 18:27:11 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-13 05:51:39 +0300
commit6e60e8b2b2bab889379b380a28a167a0edd9d1d3 (patch)
treef12f54d5ba8e74e67e5fad3651a1e125bb8f4191 /import-layers/yocto-poky/bitbake/bin/toaster
parent509842add85b53e13164c1569a1fd43d5b8d91c5 (diff)
downloadopenbmc-6e60e8b2b2bab889379b380a28a167a0edd9d1d3.tar.xz
Yocto 2.3
Move OpenBMC to Yocto 2.3(pyro). Tested: Built and verified Witherspoon and Palmetto images Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Resolves: openbmc/openbmc#2461
Diffstat (limited to 'import-layers/yocto-poky/bitbake/bin/toaster')
-rwxr-xr-ximport-layers/yocto-poky/bitbake/bin/toaster70
1 files changed, 42 insertions, 28 deletions
diff --git a/import-layers/yocto-poky/bitbake/bin/toaster b/import-layers/yocto-poky/bitbake/bin/toaster
index f92d38eca..61a4a0f85 100755
--- a/import-layers/yocto-poky/bitbake/bin/toaster
+++ b/import-layers/yocto-poky/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..."
@@ -111,7 +121,7 @@ verify_prereq() {
if ! sed -n "$exp" $reqfile | python3 - ; then
req=`grep ^Django $reqfile`
echo "This program needs $req"
- echo "Please install with pip install -r $reqfile"
+ echo "Please install with pip3 install -r $reqfile"
return 2
fi
@@ -151,14 +161,7 @@ fi
unset OE_ROOT
-# this defines the dir toaster will use for
-# 1) clones of layers (in _toaster_clones )
-# 2) the build dir (in build)
-# 3) the sqlite db if that is being used.
-# 4) pid's we need to clean up on exit/shutdown
-# note: for future. in order to make this an arbitrary directory, we need to
-# make sure that the toaster.sqlite file doesn't default to `pwd` like it currently does.
-export TOASTER_DIR=`pwd`
+
WEBSERVER=1
ADDR_PORT="localhost:8000"
@@ -214,10 +217,8 @@ fi
# 2) the build dir (in build)
# 3) the sqlite db if that is being used.
# 4) pid's we need to clean up on exit/shutdown
-# note: for future. in order to make this an arbitrary directory, we need to
-# make sure that the toaster.sqlite file doesn't default to `pwd`
-# like it currently does.
export TOASTER_DIR=`dirname $BUILDDIR`
+export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE TOASTER_DIR"
# Determine the action. If specified by arguments, fine, if not, toggle it
if [ "$CMD" = "start" ] ; then
@@ -249,12 +250,25 @@ 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
fi
export BITBAKE_UI='toasterui'
- $MANAGE runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid
+ $MANAGE runbuilds \
+ </dev/null >>${BUILDDIR}/toaster_runbuilds.log 2>&1 \
+ & echo $! >${BUILDDIR}/.runbuilds.pid
+
# set fail safe stop system on terminal exit
trap stop_system SIGHUP
echo "Successful ${CMD}."