toaster: 8279: Provide a single way of starting Toaster
cover toaster: 8279: Provide a single way of starting Toaster
Hi,
This patchset merges two Toaster modes in one:
To run toaster you should source it in already prepared build environment:
cd poky
. oe-init-build-env
. ../bitbake/bin/toaster
After that you should be able to trigger builds both ways:
from command line and from toaster UI.
The following changes since commit 8a0d8eee432924433c3e70198aaeab3161476c5f:
toaster manual: Updated the set up and use chapter (2015-10-27 07:28:22 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ed/toaster/8279-v3
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-v3
Ed Bartosh (24):
toaster: don't allow to run toaster as a script
toaster: implement get-dburl command
toaster: set DATABASE_URL in toaster script
toaster: run bitbake the same way
toaster: remove unused variable
toaster: check for toaster configuration later
toaster: use parent of the build dir
toaster: make runbuilds to loop
toaster: start 'manage.py runbuilds' in the script
toaster: update brbe and project attributes
toaster: implement stop_bitbake function
toaster: implement start_bitbake function
toaster: implement 'toaster restart-bitbake'
toaster: remove _setupBE function
toaster: reimplemented startBBServer method
toaster: remove stopBBServer API
toaster: do not terminate bb server
toaster: remove usage of BUILD_MODE variable
toaster: do not create duplicate HelpText objects
toaster: implement BitbakeController.getVariable
toaster: set varibales on bitbake server
toaster: remove writeConfFile API
toaster: stop using toaster-pre.conf
toaster: remove SDKMACHINE from project variables
Michael Wood (1):
toaster: buildinfohelper Broaden the toaster created recipe data case
bitbake/bin/toaster | 186 +++++++-------------- bitbake/lib/bb/ui/buildinfohelper.py | 23 +-- bitbake/lib/bb/ui/toasterui.py | 15 +- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 15 +- .../toaster/bldcontrol/localhostbecontroller.py | 132 ++++----------- .../bldcontrol/management/commands/runbuilds.py | 13 +- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 -- bitbake/lib/toaster/bldcontrol/tests.py | 4 - bitbake/lib/toaster/toastergui/templates/base.html | 13 +- .../lib/toaster/toastergui/templates/landing.html | 10 -- .../toaster/toastergui/templates/projectconf.html | 70 +------- bitbake/lib/toaster/toastergui/tests.py | 4 - bitbake/lib/toaster/toastergui/views.py | 29 ---- .../toastermain/management/commands/get-dburl.py | 9 + bitbake/lib/toaster/toastermain/settings.py | 3 - bitbake/lib/toaster/toastermain/urls.py | 9 +- 16 files changed, 142 insertions(+), 403 deletions(-) create mode 100644 bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
--
Ed
PATCH 1/25 toaster: don't allow to run toaster as a script
Removed support of starting toaster as a script.
Sourcing a toaster script becomes the only way to start it. It's consistent with the way oe build system is started by sourcing oe-init-build-env. It also returns user back to shell, so user can continue running builds without having to open new terminal window.
[YOCTO #8279]
--- bitbake/bin/toaster | 82 ++++------------------------------------------------- 1 file changed, 6 insertions(+), 76 deletions(-)
bitbake/bin/toaster +6 -76
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/echo ERROR: This script needs to be sourced. Please run as . # (c) 2013 Intel Corp. # This program is free software; you can redistribute it and/or modify
@@ -81,9 +81,7 @@ webserverStartAll() return $retval fi - if [ "$TOASTER_MANAGED" = '1' ]; then - python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 - fi + python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 if [ $retval -eq 1 ]; then printf "\nError while checking settings; aborting\n"
@@ -176,8 +174,6 @@ else TOASTER=$0 fi -[ `basename \"$0\"` = `basename \"${TOASTER}\"` ] && TOASTER_MANAGED=1 - BBBASEDIR=`dirname $TOASTER`/.. RUNNING=0
@@ -201,7 +197,7 @@ if [ "$TOASTER_CONF" = "" ]; then fi if [ ! -f $TOASTER_CONF ]; then echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" - [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 + return 1 fi # this defines the dir toaster will use for # 1) clones of layers (in _toaster_clones )
@@ -234,88 +230,22 @@ for param in $*; do esac done -if [ "$TOASTER_MANAGED" = '1' ]; then - # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. - # Start just the web server, point the web browser to the interface, and start any Django services. - - if ! verify_prereq; then - 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 - exit 1 - fi - - if [ -n "$BUILDDIR" ]; then - 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 - exit 1 - fi - - # Define a fake builddir where only the pid files are actually created. No real builds will take place here. - BUILDDIR=/tmp/toaster_$$ - if [ -d "$BUILDDIR" ]; then - echo "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1 - exit 1 - fi - - mkdir -p "$BUILDDIR" - - RUNNING=1 - trap_ctrlc() { - echo "** Stopping system" - webserverKillAll - RUNNING=0 - } - - do_cleanup() { - find "$BUILDDIR" -type f | xargs rm - rmdir "$BUILDDIR" - } - cleanup() { - if grep -ir error "$BUILDDIR" >/dev/null; then - if grep -irn "That port is already in use" "$BUILDDIR"; then - echo "You can use the \"webport=PORTNUMBER\" parameter to start Toaster on a different port (port $WEB_PORT is already in use)" - do_cleanup - else - printf "\nErrors found in the Toaster log files present in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster" - fi - else - echo "No errors found, removing the run directory '$BUILDDIR'" - do_cleanup - fi - } - export TOASTER_MANAGED=1 - if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then - echo "Failed to start the web server, stopping" 1>&2 - cleanup - exit 1 - fi - if [ $WEBSERVER -gt 0 ] && [ $NOBROWSER -eq 0 ] ; then - echo "Starting browser..." - xdg-open http://127.0.0.1:$WEB_PORT/ >/dev/null 2>&1 & - fi - trap trap_ctrlc 2 - echo "Toaster is now running. You can stop it with Ctrl-C" - while [ $RUNNING -gt 0 ]; do - python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log" - sleep 1 - done - cleanup - echo "**** Exit" - exit 0 +if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then + echo "Error: This script needs to be sourced. Please run as . $TOASTER" + exit 1 fi - if ! verify_prereq; then 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 return 1 fi - # We make sure we're running in the current shell and in a good environment if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then echo "Error: Build environment is not setup or bitbake is not in path." 1>&2 return 2 fi - # Determine the action. If specified by arguments, fine, if not, toggle it if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then CMD="$1"
Signature · 1 line
2.1.4
PATCH 2/25 toaster: implement get-dburl command
In reply to Ed BartoshImplemented management command to call getDATABASE_URL API. It will be used to get database url from toaster shell script by running 'manage.py get-dburl'
--- bitbake/lib/toaster/toastermain/management/commands/get-dburl.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 bitbake/lib/toaster/toastermain/management/commands/get-dburl.py
bitbake/lib/toaster/toastermain/management/commands/get-dburl.py new file +9 -0
@@ -0,0 +1,9 @@ +from toastermain.settings import getDATABASE_URL +from django.core.management.base import NoArgsCommand + +class Command(NoArgsCommand): + args = "" + help = "get database url" + + def handle_noargs(self,**options): + print getDATABASE_URL()
Signature · 1 line
2.1.4
PATCH 3/25 toaster: set DATABASE_URL in toaster script
In reply to Ed BartoshSet environment variable DATABASE_URL in bitbake/bit/toaster Variable value is obtained by running 'manage.py get-dburl'
--- bitbake/bin/toaster | 1 + 1 file changed, 1 insertion(+)
bitbake/bin/toaster +1 -0
@@ -300,6 +300,7 @@ case $CMD in echo "Bitbake server start failed" else export BBSERVER=0.0.0.0:-1 + export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl` if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid fi
Signature · 1 line
2.1.4
PATCH 4/25 toaster: run bitbake the same way
In reply to Ed BartoshRun bitbake in toaster script the same way as it's run by localbuildcontroller.
--- bitbake/bin/toaster | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
bitbake/bin/toaster +4 -6
@@ -285,16 +285,13 @@ case $CMD in start ) start_success=1 addtoConfiguration toaster.conf "INHERIT+=\"toaster buildhistory\"" $TOASTER_BRBE + echo > ${BUILDDIR}/conf/toaster-pre.conf if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then echo "Failed ${CMD}." return 4 fi unset BBSERVER - PREREAD="" - if [ -e ${BUILDDIR}/conf/toaster-pre.conf ]; then - rm ${BUILDDIR}/conf/toaster-pre.conf - fi - bitbake $PREREAD --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 + bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 if [ $? -ne 0 ]; then start_success=0 echo "Bitbake server start failed"
@@ -302,7 +299,8 @@ case $CMD in export BBSERVER=0.0.0.0:-1 export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl` if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited - bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid + bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \ + & echo $! >${BUILDDIR}/.toasterui.pid fi fi if [ $start_success -eq 1 ]; then
Signature · 1 line
2.1.4
PATCH 5/25 toaster: remove unused variable
In reply to Ed BartoshRemoved variable RUNNING as it's not used anymore
in the toaster script.
--- bitbake/bin/toaster | 3 --- 1 file changed, 3 deletions(-)
bitbake/bin/toaster +0 -3
@@ -175,9 +175,6 @@ else fi BBBASEDIR=`dirname $TOASTER`/.. - -RUNNING=0 - NOTOASTERUI=0 WEBSERVER=1 TOASTER_BRBE=""
Signature · 1 line
2.1.4
PATCH 6/25 toaster: check for toaster configuration later
In reply to Ed BartoshMoved check for toasterconf.json after check of build environment. We'll need some variables from build environment to find toasterconf.json better way.
--- bitbake/bin/toaster | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-)
bitbake/bin/toaster +24 -24
@@ -181,30 +181,6 @@ TOASTER_BRBE="" if [ "$WEB_PORT" = "" ]; then WEB_PORT="8000" fi -# this is the configuraton file we are using for toaster -# note default is assuming yocto. Override this if you are -# running in a pure OE environment and use the toasterconf.json -# in meta/conf/toasterconf.json -# note: for future there are a number of relative path assumptions -# in the local layers that currently prevent using an arbitrary -# toasterconf.json -if [ "$TOASTER_CONF" = "" ]; then - TOASTER_CONF="$(dirname $TOASTER)/../../meta-yocto/conf/toasterconf.json" - export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')") -fi -if [ ! -f $TOASTER_CONF ]; then - echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" - return 1 -fi -# 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` - NOBROWSER=0
@@ -243,6 +219,30 @@ if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then return 2 fi +# this is the configuraton file we are using for toaster +# note default is assuming yocto. Override this if you are +# running in a pure OE environment and use the toasterconf.json +# in meta/conf/toasterconf.json +# note: for future there are a number of relative path assumptions +# in the local layers that currently prevent using an arbitrary +# toasterconf.json +if [ "$TOASTER_CONF" = "" ]; then + TOASTER_CONF="$(dirname $TOASTER)/../../meta-yocto/conf/toasterconf.json" + export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')") +fi +if [ ! -f $TOASTER_CONF ]; then + echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path" + return 1 +fi +# 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` + # Determine the action. If specified by arguments, fine, if not, toggle it if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then CMD="$1"
Signature · 1 line
2.1.4
PATCH 7/25 toaster: use parent of the build dir
In reply to Ed BartoshAssigned TOASTER_DIR to the parent of the build directory. This should fix local controller crash as it assumes that TOASTER_DIR is a root of local poky and tries to clone it.
--- bitbake/bin/toaster | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/bin/toaster +1 -1
@@ -241,7 +241,7 @@ fi # 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` +export TOASTER_DIR=`dirname $BUILDDIR` # Determine the action. If specified by arguments, fine, if not, toggle it if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then
Signature · 1 line
2.1.4
PATCH 8/25 toaster: make runbuilds to loop
In reply to Ed BartoshMade runbuilds to loop to avoid having a loop in shell code and initialize heavy Django init machinery every second.
Ignored exceptions to prevent exiting a loop.
--- .../lib/toaster/bldcontrol/management/commands/runbuilds.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +10 -3
@@ -5,6 +5,7 @@ from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdExcep from bldcontrol.models import BuildRequest, BuildEnvironment, BRError, BRVariable import os import logging +import time logger = logging.getLogger("ToasterScheduler")
@@ -128,6 +129,12 @@ class Command(NoArgsCommand): def handle_noargs(self, **options): - self.cleanup() - self.archive() - self.schedule() + while True: + try: + self.cleanup() + self.archive() + self.schedule() + except: + pass + + time.sleep(1)
Signature · 1 line
2.1.4
PATCH 9/25 toaster: start 'manage.py runbuilds' in the script
In reply to Ed BartoshRunning runbuilds machinery in background allows Toaster to start builds initiated by toaster UI.
Added runbuilds pid file to the list in webserverKillAll to kill runbuilds the same way as runserver process.
--- bitbake/bin/toaster | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/bin/toaster +2 -1
@@ -31,7 +31,7 @@ webserverKillAll() { local pidfile - for pidfile in ${BUILDDIR}/.toastermain.pid; do + for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do if [ -f ${pidfile} ]; then pid=`cat ${pidfile}` while kill -0 $pid 2>/dev/null; do
@@ -299,6 +299,7 @@ case $CMD in bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \ & echo $! >${BUILDDIR}/.toasterui.pid fi + python $BBBASEDIR/lib/toaster/manage.py runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid fi if [ $start_success -eq 1 ]; then # set fail safe stop system on terminal exit
Signature · 1 line
2.1.4
PATCH 10/25 toaster: update brbe and project attributes
In reply to Ed BartoshUpdated attributes of buildinfohelper object as they can be changed for every build. For example brbe is set by runbuilds for every build triggered by Toaster UI.
--- bitbake/lib/bb/ui/buildinfohelper.py | 6 ++++++ 1 file changed, 6 insertions(+)
bitbake/lib/bb/ui/buildinfohelper.py +6 -0
@@ -796,6 +796,8 @@ class BuildInfoHelper(object): build_info['cooker_log_path'] = consolelogfile build_info['build_name'] = self.server.runCommand(["getVariable", "BUILDNAME"])[0] build_info['bitbake_version'] = self.server.runCommand(["getVariable", "BB_VERSION"])[0] + build_info['brbe'] = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0] + build_info['project'] = self.project = self.server.runCommand(["getVariable", "TOASTER_PROJECT"])[0] return build_info
@@ -938,6 +940,10 @@ class BuildInfoHelper(object): assert '_pkgs' in vars(event) build_information = self._get_build_information(consolelogfile) + # Update brbe and project as they can be changed for every build + self.brbe = build_information['brbe'] + self.project = build_information['project'] + build_obj = self.orm_wrapper.create_build_object(build_information, self.brbe, self.project) self.internal_state['build'] = build_obj
Signature · 1 line
2.1.4
PATCH 11/25 toaster: implement stop_bitbake function
In reply to Ed BartoshSeparated functionality of stopping bitbake server and observer processes.
This functionality will be used by build controllers to restart bitbake processes.
--- bitbake/bin/toaster | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
bitbake/bin/toaster +8 -4
@@ -126,16 +126,20 @@ stop_system() kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null rm ${BUILDDIR}/.toasterui.pid fi - BBSERVER=0.0.0.0:-1 bitbake -m - unset BBSERVER + stop_bitbake webserverKillAll - # force stop any misbehaving bitbake server - lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill trap - SIGHUP #trap - SIGCHLD INSTOPSYSTEM=0 } +stop_bitbake() { + BBSERVER=0.0.0.0:-1 bitbake -m + unset BBSERVER + # force stop any misbehaving bitbake server + lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill +} + check_pidbyfile() { [ -e $1 ] && kill -0 `cat $1` 2>/dev/null }
Signature · 1 line
2.1.4
PATCH 12/25 toaster: implement start_bitbake function
In reply to Ed BartoshSeparated functionality of starting bitbake server and observer processes.
This functionality will be used by build controllers to restart bitbake processes.
--- bitbake/bin/toaster | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
bitbake/bin/toaster +18 -15
@@ -133,6 +133,22 @@ stop_system() INSTOPSYSTEM=0 } +start_bitbake() { + unset BBSERVER + bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 + if [ $? -ne 0 ]; then + echo "Bitbake server start failed" + return 1 + fi + export BBSERVER=0.0.0.0:-1 + export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl` + if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited + bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \ + & echo $! >${BUILDDIR}/.toasterui.pid + fi + return 0 +} + stop_bitbake() { BBSERVER=0.0.0.0:-1 bitbake -m unset BBSERVER
@@ -284,28 +300,15 @@ fi case $CMD in start ) - start_success=1 addtoConfiguration toaster.conf "INHERIT+=\"toaster buildhistory\"" $TOASTER_BRBE echo > ${BUILDDIR}/conf/toaster-pre.conf if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then echo "Failed ${CMD}." return 4 fi - unset BBSERVER - bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 - if [ $? -ne 0 ]; then - start_success=0 - echo "Bitbake server start failed" - else - export BBSERVER=0.0.0.0:-1 - export DATABASE_URL=`$BBBASEDIR/lib/toaster/manage.py get-dburl` - if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited - bitbake --observe-only -u toasterui --remote-server=$BBSERVER -t xmlrpc >>${BUILDDIR}/toaster_ui.log 2>&1 \ - & echo $! >${BUILDDIR}/.toasterui.pid - fi + start_bitbake + if [ $? -eq 0 ]; then python $BBBASEDIR/lib/toaster/manage.py runbuilds & echo $! >${BUILDDIR}/.runbuilds.pid - fi - if [ $start_success -eq 1 ]; then # set fail safe stop system on terminal exit trap stop_system SIGHUP echo "Successful ${CMD}."
Signature · 1 line
2.1.4
PATCH 13/25 toaster: implement 'toaster restart-bitbake'
In reply to Ed BartoshThis implementation allows to have functionality of restarting bitbake in toaster script. It can be used by toaster script and build controllers.
[YOCTO #8279]
--- bitbake/bin/toaster | 9 +++++++++ 1 file changed, 9 insertions(+)
bitbake/bin/toaster +9 -0
@@ -228,6 +228,15 @@ if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then exit 1 fi +if [ "$1" = 'restart-bitbake' ] ; then + stop_bitbake + sleep 1 + start_bitbake + rc=$? + sleep 1 + return $rc +fi + if ! verify_prereq; then 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 return 1
Signature · 1 line
2.1.4
PATCH 14/25 toaster: remove _setupBE function
In reply to Ed BartoshThis function is not needed as build environment is always created because of the new way to run Toaster. It can be only sourced after oe-init-build-env is sourced.
--- .../lib/toaster/bldcontrol/localhostbecontroller.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +2 -17
@@ -71,17 +71,6 @@ class LocalhostBEController(BuildEnvironmentController): logger.debug("localhostbecontroller: shellcmd success") return out - def _setupBE(self): - assert self.pokydirname and os.path.exists(self.pokydirname) - path = self.be.builddir - if not path: - raise Exception("Invalid path creation specified.") - if not os.path.exists(path): - os.makedirs(path, 0755) - self._shellcmd("bash -c \"source %s/oe-init-build-env %s\"" % (self.pokydirname, path)) - # delete the templateconf.cfg; it may come from an unsupported layer configuration - os.remove(os.path.join(path, "conf/templateconf.cfg")) - def writeConfFile(self, file_name, variable_list = None, raw = None): filepath = os.path.join(self.be.builddir, file_name)
@@ -290,16 +279,12 @@ class LocalhostBEController(BuildEnvironmentController): logger.debug("localhostbecontroller: current layer list %s " % pformat(layerlist)) - # 4. configure the build environment, so we have a conf/bblayers.conf - assert self.pokydirname is not None - self._setupBE() - - # 5. update the bblayers.conf + # 4. update the bblayers.conf bblayerconf = os.path.join(self.be.builddir, "conf/bblayers.conf") if not os.path.exists(bblayerconf): raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf) - # 6. create custom layer and add custom recipes to it + # 5. create custom layer and add custom recipes to it layerpath = os.path.join(self.be.sourcedir, "_meta-toaster-custom") if os.path.isdir(layerpath): shutil.rmtree(layerpath) # remove leftovers from previous builds
Signature · 1 line
2.1.4
PATCH 15/25 toaster: reimplemented startBBServer method
In reply to Ed BartoshRewritten LocalhostBEController.startBBServer to use 'toaster restart-bitbake' and read bitbake port number from bitbake.lock.
Removed complicated logic of running oe-init-memres and looking for bitbake port number in the logs.
--- .../toaster/bldcontrol/localhostbecontroller.py | 82 +++++----------------- 1 file changed, 18 insertions(+), 64 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +18 -64
@@ -89,74 +89,28 @@ class LocalhostBEController(BuildEnvironmentController): # find our own toasterui listener/bitbake from toaster.bldcontrol.management.commands.loadconf import _reduce_canon_path - own_bitbake = _reduce_canon_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../bin/bitbake")) - - assert os.path.exists(own_bitbake) and os.path.isfile(own_bitbake) - - logger.debug("localhostbecontroller: running the listener at %s" % own_bitbake) - - toaster_ui_log_filepath = os.path.join(self.be.builddir, "toaster_ui.log") - # get the file length; we need to detect the _last_ start of the toaster UI, not the first - toaster_ui_log_filelength = 0 - if os.path.exists(toaster_ui_log_filepath): - with open(toaster_ui_log_filepath, "w") as f: - f.seek(0, 2) # jump to the end - toaster_ui_log_filelength = f.tell() - - cmd = "bash -c \"source %s/oe-init-build-env %s 2>&1 >toaster_server.log && bitbake --read %s/conf/toaster-pre.conf --postread %s/conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 2>&1 >>toaster_server.log \"" % (self.pokydirname, self.be.builddir, self.be.builddir, self.be.builddir) - - port = "-1" - logger.debug("localhostbecontroller: starting builder \n%s\n" % cmd) - - cmdoutput = self._shellcmd(cmd) - with open(self.be.builddir + "/toaster_server.log", "r") as f: - for i in f.readlines(): - if i.startswith("Bitbake server address"): - port = i.split(" ")[-1] - logger.debug("localhostbecontroller: Found bitbake server port %s" % port) - - cmd = "bash -c \"source %s/oe-init-build-env-memres -1 %s && DATABASE_URL=%s %s --observe-only -u toasterui --remote-server=0.0.0.0:-1 -t xmlrpc\"" % (self.pokydirname, self.be.builddir, self.dburl, own_bitbake) - with open(toaster_ui_log_filepath, "a+") as f: - p = subprocess.Popen(cmd, cwd = self.be.builddir, shell=True, stdout=f, stderr=f) - - def _toaster_ui_started(filepath, filepos = 0): - if not os.path.exists(filepath): - return False - with open(filepath, "r") as f: - f.seek(filepos) - for line in f: - if line.startswith("NOTE: ToasterUI waiting for events"): - return True - return False - - retries = 0 - started = False - while not started and retries < 50: - started = _toaster_ui_started(toaster_ui_log_filepath, toaster_ui_log_filelength) - import time - logger.debug("localhostbecontroller: Waiting bitbake server to start") - time.sleep(0.5) - retries += 1 - - if not started: - toaster_ui_log = open(os.path.join(self.be.builddir, "toaster_ui.log"), "r").read() - toaster_server_log = open(os.path.join(self.be.builddir, "toaster_server.log"), "r").read() - raise BuildSetupException("localhostbecontroller: Bitbake server did not start in 25 seconds, aborting (Error: '%s' '%s')" % (toaster_ui_log, toaster_server_log)) - - logger.debug("localhostbecontroller: Started bitbake server") - - while port == "-1": - # the port specification is "autodetect"; read the bitbake.lock file - with open("%s/bitbake.lock" % self.be.builddir, "r") as f: - for line in f.readlines(): + toaster = _reduce_canon_path(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../../../bin/toaster")) + assert os.path.exists(toaster) and os.path.isfile(toaster) + + # restart bitbake server and toastergui observer + self._shellcmd("bash -c 'source %s restart-bitbake'" % toaster, self.be.builddir) + logger.debug("localhostbecontroller: restarted bitbake server") + + # read port number from bitbake.lock + self.be.bbport = "" + bblock = os.path.join(self.be.builddir, 'bitbake.lock') + if os.path.exists(bblock): + with open(bblock) as fplock: + for line in fplock: if ":" in line: - port = line.split(":")[1].strip() - logger.debug("localhostbecontroller: Autodetected bitbake port %s", port) + self.be.bbport = line.split(":")[-1].strip() + logger.debug("localhostbecontroller: bitbake port %s", self.be.bbport) break - assert self.be.sourcedir and os.path.exists(self.be.builddir) + if not self.be.bbport: + raise BuildSetupException("localhostbecontroller: can't read bitbake port from %s" % bblock) + self.be.bbaddress = "localhost" - self.be.bbport = port self.be.bbstate = BuildEnvironment.SERVER_STARTED self.be.save()
Signature · 1 line
2.1.4
PATCH 16/25 toaster: remove stopBBServer API
In reply to Ed BartoshRemoved stopBBServer API from build controller as toaster doesn't stop bitbake server anymore. It's reused for both types of builds: triggered by UI and started manually.
--- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 6 ------ bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 9 --------- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 ---------- bitbake/lib/toaster/bldcontrol/tests.py | 4 ---- 4 files changed, 29 deletions(-)
bitbake/lib/toaster/bldcontrol/bbcontroller.py +0 -6
@@ -140,12 +140,6 @@ class BuildEnvironmentController(object): """ raise Exception("FIXME: Must override in order to actually start the BB server") - def stopBBServer(self): - """ Stops the currently running BB server. - The bbstate MUST be updated to "stopped". - self.connection must be none. - """ - raise Exception("FIXME: Must override stoBBServer") def setLayers(self, bbs, ls): """ Checks-out bitbake executor and layers from git repositories.
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +0 -9
@@ -114,15 +114,6 @@ class LocalhostBEController(BuildEnvironmentController): self.be.bbstate = BuildEnvironment.SERVER_STARTED self.be.save() - def stopBBServer(self): - assert self.pokydirname and os.path.exists(self.pokydirname) - assert self.islayerset - self._shellcmd("bash -c \"source %s/oe-init-build-env %s && %s source toaster stop\"" % - (self.pokydirname, self.be.builddir, (lambda: "" if self.be.bbtoken is None else "BBTOKEN=%s" % self.be.bbtoken)())) - self.be.bbstate = BuildEnvironment.SERVER_STOPPED - self.be.save() - logger.debug("localhostbecontroller: Stopped bitbake server") - def getGitCloneDirectory(self, url, branch): """Construct unique clone directory name out of url and branch.""" if branch != "HEAD":
bitbake/lib/toaster/bldcontrol/sshbecontroller.py +0 -10
@@ -98,16 +98,6 @@ class SSHBEController(BuildEnvironmentController): self.be.bbstate = BuildEnvironment.SERVER_STARTED self.be.save() - def stopBBServer(self): - assert self.pokydirname and self._pathexists(self.pokydirname) - assert self.islayerset - print self._shellcmd("bash -c \"source %s/oe-init-build-env %s && %s source toaster stop\"" % - (self.pokydirname, self.be.builddir, (lambda: "" if self.be.bbtoken is None else "BBTOKEN=%s" % self.be.bbtoken)())) - self.be.bbstate = BuildEnvironment.SERVER_STOPPED - self.be.save() - print "Stopped server" - - def _copyFile(self, filepath1, filepath2): p = subprocess.Popen("scp '%s' '%s'" % (filepath1, filepath2), stdout=subprocess.PIPE, stderr = subprocess.PIPE, shell=True) (out, err) = p.communicate()
bitbake/lib/toaster/bldcontrol/tests.py +0 -4
@@ -71,9 +71,6 @@ class BEControllerTests(object): self.assertFalse(socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((hostname, int(bc.be.bbport))), "Server not answering") - bc.stopBBServer() - self.assertTrue(socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((hostname, int(bc.be.bbport))), "Server not stopped") - self._serverForceStop(bc) def test_getBBController(self):
@@ -96,7 +93,6 @@ class BEControllerTests(object): bbc = bc.getBBController() self.assertTrue(isinstance(bbc, BitbakeController)) - bc.stopBBServer() self._serverForceStop(bc)
Signature · 1 line
2.1.4
PATCH 17/25 toaster: do not terminate bb server
In reply to Ed BartoshToaster needs bb server to be running all the time due to merged analysis and managed modes. Server gets restarted before every build triggered by UI, but it shouldn't be terminated as it will influence command line builds.
[YOCTO #8279]
--- bitbake/lib/bb/ui/toasterui.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
bitbake/lib/bb/ui/toasterui.py +5 -10
@@ -255,16 +255,11 @@ def main(server, eventHandler, params ): logger.info("ToasterUI build done 1, brbe: %s", buildinfohelper.brbe ) # we start a new build info - if buildinfohelper.brbe is not None: - - logger.debug("ToasterUI under BuildEnvironment management - exiting after the build") - server.terminateServer() - else: - logger.debug("ToasterUI prepared for new build") - errors = 0 - warnings = 0 - taskfailures = [] - buildinfohelper = BuildInfoHelper(server, build_history_enabled) + logger.debug("ToasterUI prepared for new build") + errors = 0 + warnings = 0 + taskfailures = [] + buildinfohelper = BuildInfoHelper(server, build_history_enabled) logger.info("ToasterUI build done 2") continue
Signature · 1 line
2.1.4
PATCH 18/25 toaster: remove usage of BUILD_MODE variable
In reply to Ed BartoshAs both modes can be used at the same time we can't have any difference in UI between modes.
Removed all conditional statements that used BUILD_MODE.
--- bitbake/lib/toaster/toastergui/templates/base.html | 13 +++++-------- .../lib/toaster/toastergui/templates/landing.html | 10 ---------- bitbake/lib/toaster/toastergui/tests.py | 4 ---- bitbake/lib/toaster/toastergui/views.py | 20 -------------------- bitbake/lib/toaster/toastermain/settings.py | 3 --- bitbake/lib/toaster/toastermain/urls.py | 9 ++++----- 6 files changed, 9 insertions(+), 50 deletions(-)
bitbake/lib/toaster/toastergui/templates/base.html +5 -8
@@ -91,7 +91,7 @@ <i class="icon-info-sign" title="<strong>Toaster version information</strong>" data-content="<dl><dt>Branch</dt><dd>{{TOASTER_BRANCH}}</dd><dt>Revision</dt><dd>{{TOASTER_REVISION}}</dd></dl>"></i> {% endif %} </span> - {% if BUILD_MODE and request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %} + {% if request.resolver_match.url_name != 'landing' and request.resolver_match.url_name != 'newproject' %} <ul class="nav"> <li {% if request.resolver_match.url_name == 'all-builds' %} class="active"
@@ -121,18 +121,15 @@ </ul> <span class="pull-right divider-vertical"></span> - <!-- new project button; only show in build mode --> - {% if BUILD_MODE %} - <div class="btn-group pull-right"> - <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a> - </div> - {% endif %} + <div class="btn-group pull-right"> + <a class="btn" id="new-project-button" href="{% url 'newproject' %}">New project</a> + </div> <!-- New build popover; only shown if there is at least one user-created project and we're in build mode --> - {% if BUILD_MODE and non_cli_projects.count > 0 %} + {% if non_cli_projects.count > 0 %} <div class="btn-group pull-right" id="new-build-button" style="display:none"> <button class="btn dropdown-toggle" data-toggle="dropdown"> New build
bitbake/lib/toaster/toastergui/templates/landing.html +0 -10
@@ -5,9 +5,6 @@ {% load humanize %} {% block pagecontent %} - - {% if BUILD_MODE %} - <!-- build mode --> <div class="container-fluid"> <div class="row-fluid"> <div class="hero-unit span12 well-transparent">
@@ -61,11 +58,4 @@ </div> </div> </div> - {% else %} - <!-- analysis mode --> - <div class="alert alert-info lead top-air"> - Toaster has not recorded any builds yet. Run a build from the command line to see it here. - </div> - {% endif %} - {% endblock %}
bitbake/lib/toaster/toastergui/tests.py +0 -4
@@ -42,10 +42,6 @@ import re PROJECT_NAME = "test project" CLI_BUILDS_PROJECT_NAME = 'Command line builds' -# by default, tests are run in build mode; to run in analysis mode, -# set this to False in individual test cases -toastermain.settings.BUILD_MODE = True - class ViewTests(TestCase): """Tests to verify view APIs."""
bitbake/lib/toaster/toastergui/views.py +0 -20
@@ -76,10 +76,6 @@ def landing(request): default_project = Project.objects.get_default_project() default_project_builds = Build.objects.filter(project = default_project) - if (not toastermain.settings.BUILD_MODE) and default_project_builds.count() > 0: - args = (default_project.id,) - return redirect(reverse('projectbuilds', args = args), permanent = False) - # we only redirect to projects page if there is a user-generated project num_builds = Build.objects.all().count() user_projects = Project.objects.filter(is_default = False)
@@ -102,9 +98,6 @@ def _get_latest_builds(prj=None): if prj is not None: queryset = queryset.filter(project = prj) - if not toastermain.settings.BUILD_MODE: - queryset = queryset.exclude(project__is_default=False) - return list(itertools.chain( queryset.filter(outcome=Build.IN_PROGRESS).order_by("-started_on"), queryset.filter(outcome__lt=Build.IN_PROGRESS).order_by("-started_on")[:3] ))
@@ -1893,10 +1886,6 @@ def managedcontextprocessor(request): "projects": projects, "non_cli_projects": projects.exclude(is_default=True), "DEBUG" : toastermain.settings.DEBUG, - - # True if Toaster is in build mode, False otherwise - "BUILD_MODE": toastermain.settings.BUILD_MODE, - "CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE, "TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH, "TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION,
@@ -1939,11 +1928,6 @@ if True: queryset = Build.objects.all() - # if in analysis mode, exclude builds for all projects except - # command line builds - if not toastermain.settings.BUILD_MODE: - queryset = queryset.exclude(project__is_default=False) - redirect_page = resolve(request.path_info).url_name context, pagesize, orderby = _build_list_helper(request,
@@ -3048,10 +3032,6 @@ if True: queryset_all = queryset_all.filter(Q(is_default=False) | q_default_with_builds) - # if in BUILD_MODE, exclude everything but the command line builds project - if not toastermain.settings.BUILD_MODE: - queryset_all = queryset_all.exclude(is_default=False) - # boilerplate code that takes a request for an object type and returns a queryset # for that object type. copypasta for all needed table searches (filter_string, search_term, ordering_string) = _search_tuple(request, Project)
bitbake/lib/toaster/toastermain/settings.py +0 -3
@@ -92,9 +92,6 @@ if 'DATABASE_URL' in os.environ: else: raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl) -BUILD_MODE = False -if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1": - BUILD_MODE = True # Allows current database settings to be exported as a DATABASE_URL environment variable value
bitbake/lib/toaster/toastermain/urls.py +4 -5
@@ -59,12 +59,11 @@ if toastermain.settings.DEBUG_PANEL_ENABLED: urlpatterns.insert(1, url(r'', include(debug_toolbar.urls))) #logger.info("Enabled django_toolbar extension") +urlpatterns = [ + # Uncomment the next line to enable the admin: + url(r'^admin/', include(admin.site.urls)), +] + urlpatterns -if toastermain.settings.BUILD_MODE: - urlpatterns = [ - # Uncomment the next line to enable the admin: - url(r'^admin/', include(admin.site.urls)), - ] + urlpatterns # Automatically discover urls.py in various apps, beside our own # and map module directories to the patterns
Signature · 1 line
2.1.4
PATCH 19/25 toaster: do not create duplicate HelpText objects
In reply to Ed Bartoshbuildinfohelper code expects only one HelpText object per build/variable/description.
Current code creates more than one such an object, which causes toastergui to crash with this exception:
MultipleObjectsReturned: get() returned more than one HelpText -- it returned 2!
Used git_or_create API to ensure that only one HelpText object is created.
--- bitbake/lib/bb/ui/buildinfohelper.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +3 -7
@@ -700,7 +700,6 @@ class ORMWrapper(object): def save_build_variables(self, build_obj, vardump): assert isinstance(build_obj, Build) - helptext_objects = [] for k in vardump: desc = vardump[k]['doc'] if desc is None:
@@ -711,10 +710,9 @@ class ORMWrapper(object): if desc is None: desc = '' if len(desc): - helptext_objects.append(HelpText(build=build_obj, - area=HelpText.VARIABLE, - key=k, - text=desc)) + HelpText.objects.get_or_create(build=build_obj, + area=HelpText.VARIABLE, + key=k, text=desc) if not bool(vardump[k]['func']): value = vardump[k]['v'] if value is None:
@@ -734,8 +732,6 @@ class ORMWrapper(object): if len(varhist_objects): VariableHistory.objects.bulk_create(varhist_objects) - HelpText.objects.bulk_create(helptext_objects) - class MockEvent(object): """ This object is used to create event, for which normal event-processing methods can
Signature · 1 line
2.1.4
PATCH 20/25 toaster: buildinfohelper Broaden the toaster created recipe data case
In reply to Ed BartoshFrom: Michael Wood <[email protected]>
When build information is the 'original' source of the information we need to return the recipe that was created rather than the copy of the recipe that is taken for keeping build history. We do this already for command line triggered builds, but we also have this case for custom images. We can simply check if the built_recipe exists instead of special casing this.
--- bitbake/lib/bb/ui/buildinfohelper.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
bitbake/lib/bb/ui/buildinfohelper.py +3 -4
@@ -304,12 +304,11 @@ class ORMWrapper(object): break - # If we're in analysis mode then we are wholly responsible for the data + # If we're in analysis mode or if this is a custom recipe + # then we are wholly responsible for the data # and therefore we return the 'real' recipe rather than the build # history copy of the recipe. - if recipe_information['layer_version'].build is not None and \ - recipe_information['layer_version'].build.project == \ - Project.objects.get_default_project(): + if built_recipe is None: return recipe return built_recipe
Signature · 1 line
2.1.4
PATCH 21/25 toaster: implement BitbakeController.getVariable
In reply to Ed BartoshAdded new API to get value of bitbake variable from bitbake server. The API will be used to update INHERIT variable instead of writing it to the toaster configuration files.
--- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 3 +++ 1 file changed, 3 insertions(+)
bitbake/lib/toaster/bldcontrol/bbcontroller.py +3 -0
@@ -52,6 +52,9 @@ class BitbakeController(object): def setVariable(self, name, value): return self._runCommand(["setVariable", name, value]) + def getVariable(self, name): + return self._runCommand(["getVariable", name]) + def build(self, targets, task = None): if task is None: task = "build"
Signature · 1 line
2.1.4
PATCH 22/25 toaster: set varibales on bitbake server
In reply to Ed BartoshSet project variables using connection to bitbake server instead of writing them to toaster configuration files.
This is a way to avoid rewriting configuration files before and after every build, triggered by toaster UI.
--- bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +9 -2
@@ -292,12 +292,19 @@ class LocalhostBEController(BuildEnvironmentController): def triggerBuild(self, bitbake, layers, variables, targets): # set up the buid environment with the needed layers self.setLayers(bitbake, layers, targets) - self.writeConfFile("conf/toaster-pre.conf", variables) - self.writeConfFile("conf/toaster.conf", raw = "INHERIT+=\"toaster buildhistory\"") # get the bb server running with the build req id and build env id bbctrl = self.getBBController() + # set variables + for var in variables: + bbctrl.setVariable(var.name, var.value) + + # Add 'toaster' and 'buildhistory' to INHERIT variable + inherit = {item.strip() for item in bbctrl.getVariable('INHERIT').split()} + inherit = inherit.union(["toaster", "buildhistory"]) + bbctrl.setVariable('INHERIT', ' '.join(inherit)) + # trigger the build command task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, targets)) if len(task) == 0:
Signature · 1 line
2.1.4
PATCH 23/25 toaster: remove writeConfFile API
In reply to Ed BartoshThis API is not used anymore as toaster doesn't write variables to configuration files anymore. It sets variables through its connection to bitbake server.
--- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 6 ------ bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 11 ----------- 2 files changed, 17 deletions(-)
bitbake/lib/toaster/bldcontrol/bbcontroller.py +0 -6
@@ -130,12 +130,6 @@ class BuildEnvironmentController(object): bblayerconffile.write("# line added by toaster build control\nBBLAYERS = \"" + " ".join(layerlist) + "\"") bblayerconffile.close() - - def writeConfFile(self, variable_list = None, raw = None): - """ Writes a configuration file in the build directory. Override with buildenv-specific implementation. """ - raise Exception("FIXME: Must override to actually write a configuration file") - - def startBBServer(self): """ Starts a BB server with Toaster toasterui set up to record the builds, an no controlling UI. After this method executes, self.be bbaddress/bbport MUST point to a running and free server,
bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +0 -11
@@ -71,17 +71,6 @@ class LocalhostBEController(BuildEnvironmentController): logger.debug("localhostbecontroller: shellcmd success") return out - - def writeConfFile(self, file_name, variable_list = None, raw = None): - filepath = os.path.join(self.be.builddir, file_name) - with open(filepath, "w") as conffile: - if variable_list is not None: - for i in variable_list: - conffile.write("%s=\"%s\"\n" % (i.name, i.value)) - if raw is not None: - conffile.write(raw) - - def startBBServer(self): assert self.pokydirname and os.path.exists(self.pokydirname) assert self.islayerset
Signature · 1 line
2.1.4
PATCH 24/25 toaster: stop using toaster-pre.conf
In reply to Ed BartoshThis file is not needed anymore as toaster UI doesn't write variables to it. It sets them directly on bitbake server.
--- bitbake/bin/toaster | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
bitbake/bin/toaster +1 -2
@@ -135,7 +135,7 @@ stop_system() start_bitbake() { unset BBSERVER - bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 + bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 if [ $? -ne 0 ]; then echo "Bitbake server start failed" return 1
@@ -310,7 +310,6 @@ fi case $CMD in start ) addtoConfiguration toaster.conf "INHERIT+=\"toaster buildhistory\"" $TOASTER_BRBE - echo > ${BUILDDIR}/conf/toaster-pre.conf if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then echo "Failed ${CMD}." return 4
Signature · 1 line
2.1.4
PATCH 25/25 toaster: remove SDKMACHINE from project variables
In reply to Ed BartoshRemoved SDKMACHINE from predefined set of variables
for the project as it causes bitbake build error:
SDKMACHINE is set, but SDK_ARCH has not been changed as a result
This variable does not need to be predefined as it's not used by toaster.
It's still possible to specify it in project configuration if needed. SDK_ARCH variable should be set too to avoid above mentioned build failure.
--- .../toaster/toastergui/templates/projectconf.html | 70 +--------------------- bitbake/lib/toaster/toastergui/views.py | 9 --- 2 files changed, 1 insertion(+), 78 deletions(-)
bitbake/lib/toaster/toastergui/templates/projectconf.html +1 -69
@@ -107,32 +107,6 @@ </form> </dd> {% endif %} - - {% if sdk_machine_defined %} - <dt> - <span class="js-config-var-name js-config-var-managed-name">SDKMACHINE</span> - <i class="icon-question-sign get-help" title="Specifies the architecture (i.e. i686 or x86_64) for which to build SDK and ADT items <br /><a href='http://www.yoctoproject.org/docs/1.6.1/ref-manual/ref-manual.html#var-SDKMACHINE' target='_blank'>Read more in the manual</a>"></i> - </dt> - <dd class="lead"> - <span id="sdkmachine">{{sdk_machine}}</span> - <i id="change-sdkmachine-icon" class="icon-pencil"></i> - <form id="change-sdkmachine-form" style="display:none;"> - <label class="radio"> - <input type="radio" name="sdkmachine" value="i686"> - i686 - </label> - <label class="radio"> - <input type="radio" name="sdkmachine" value="x86_64"> - x86_64 - </label> - <div style="padding-top:10px;"> - <button id="apply-change-sdkmachine" type="button" class="btn">Save</button> - <button id="cancel-change-sdkmachine" type="button" class="btn btn-link">Cancel</button> - </div> - </form> - </dd> - {% endif %} - </dl> <!-- <ul class="unstyled configuration-list" id="configvar-list"> -->
@@ -774,48 +748,6 @@ }); {% endif %} - - {% if sdk_machine_defined %} - // change SDKMACHINE variable - $('#change-sdkmachine-icon').click(function() { - var current_value = document.getElementById("sdkmachine").innerHTML; - var radios = document.getElementsByName('sdkmachine'); - for (var i = 0, length = radios.length; i < length; i++) { - radios[i].checked = false; - if (radios[i].value == current_value) { - radios[i].checked = true; - } - } - $('#change-sdkmachine-icon, #sdkmachine').hide(); - $("#change-sdkmachine-form").slideDown(); - }); - - $('#cancel-change-sdkmachine').click(function(){ - $("#change-sdkmachine-form").slideUp(function() { - $('#sdkmachine, #change-sdkmachine-icon').show(); - }); - }); - - $('#apply-change-sdkmachine').click(function(){ - var value=""; - var radios = document.getElementsByName('sdkmachine'); - for (var i = 0, length = radios.length; i < length; i++) { - if (radios[i].checked) { - // do whatever you want with the checked radio - value=radios[i].value; - break; - } - } - postEditAjaxRequest({"configvarChange" : 'SDKMACHINE:'+value}); - $('#sdkmachine').text(value); - $("#change-sdkmachine-form").slideUp(function() { - $('#sdkmachine, #change-sdkmachine-icon').show(); - }); - - }); - {% endif %} - - // add new variable $("button#add-configvar-button").click( function (evt) { var variable = $("input#variable").val();
@@ -830,7 +762,7 @@ $(".save").attr("disabled","disabled"); // Reload page if admin-removed core managed value is manually added back in - if (0 <= " DISTRO IMAGE_FSTYPES IMAGE_INSTALL_append PACKAGE_CLASSES SDKMACHINE ".indexOf( " "+variable+" " )) { + if (0 <= " DISTRO IMAGE_FSTYPES IMAGE_INSTALL_append PACKAGE_CLASSES ".indexOf( " "+variable+" " )) { // delayed reload to avoid race condition with postEditAjaxRequest do_reload=true; }
bitbake/lib/toaster/toastergui/views.py +0 -9
@@ -2456,10 +2456,6 @@ if True: return_data['package_classes'] = ProjectVariable.objects.get(project = prj, name = "PACKAGE_CLASSES").value, except ProjectVariable.DoesNotExist: pass - try: - return_data['sdk_machine'] = ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value, - except ProjectVariable.DoesNotExist: - pass return HttpResponse(json.dumps( return_data ), content_type = "application/json")
@@ -2868,11 +2864,6 @@ if True: context['package_classes_defined'] = "1" except ProjectVariable.DoesNotExist: pass - try: - context['sdk_machine'] = ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value - context['sdk_machine_defined'] = "1" - except ProjectVariable.DoesNotExist: - pass return context
Signature · 1 line
2.1.4
Quoted 18 lines · On 27/10/2015 17:27, "[email protected] on behalf of Ed…
Hi,
This patchset merges two Toaster modes in one:
To run toaster you should source it in already prepared build environment:
cd poky
. oe-init-build-env
. ../bitbake/bin/toasterAfter that you should be able to trigger builds both ways:
from command line and from toaster UI.The following changes since commit
8a0d8eee432924433c3e70198aaeab3161476c5f:toaster manual: Updated the set up and use chapter (2015-10-27 07:28:22
+0000)
Quoted 6 lines
are available in the git repository at:
git://git.yoctoproject.org/poky-contribed/toaster/8279-v3http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-v
3
I ran a couple of builds with this, and encountered a couple of problems:
1. If you want to start a build from Toaster, you need to remove the SDKMACHINE variable from the BitBake variables page in the project configuration. Otherwise builds fail. We need to make sure we remove that variable from the toasterconf.json files (as separate patches I guess).
2. For builds started from CLI, all data is collected. But for the build I started from Toaster, the following data was missing:
* The recipes table is empty (http://i.imgur.com/sxqeqxp.png), but if you navigate to a recipe from the package details page, the data is there
(http://i.imgur.com/FTcbwA2.png)
* The layer branch and commit are missing from packages tables and recipe details pages (http://i.imgur.com/6agaG6L.png). But they show in the build configuration page (http://i.imgur.com/Bt1XFxv.png)
Cheers
Belén
Quoted 59 lines
Ed Bartosh (24):
toaster: don't allow to run toaster as a script
toaster: implement get-dburl command
toaster: setDATABASE_URLin toaster script
toaster: run bitbake the same way
toaster: remove unused variable
toaster: check for toaster configuration later
toaster: use parent of the build dir
toaster: make runbuilds to loop
toaster: start 'manage.pyrunbuilds' in the script
toaster: update brbe and project attributes
toaster: implementstop_bitbakefunction
toaster: implementstart_bitbakefunction
toaster: implement 'toaster restart-bitbake'
toaster: remove_setupBEfunction
toaster: reimplemented startBBServer method
toaster: remove stopBBServer API
toaster: do not terminate bb server
toaster: remove usage ofBUILD_MODEvariable
toaster: do not create duplicate HelpText objects
toaster: implement BitbakeController.getVariable
toaster: set varibales on bitbake server
toaster: remove writeConfFile API
toaster: stop using toaster-pre.conf
toaster: remove SDKMACHINE from project variablesMichael Wood (1):
toaster: buildinfohelper Broaden the toaster created recipe data casebitbake/bin/toaster | 186
+++++++--------------bitbake/lib/bb/ui/buildinfohelper.py | 23 +-- bitbake/lib/bb/ui/toasterui.py | 15 +- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 15 +- .../toaster/bldcontrol/localhostbecontroller.py | 132 ++++----------- .../bldcontrol/management/commands/runbuilds.py | 13 +- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 -- bitbake/lib/toaster/bldcontrol/tests.py | 4 - bitbake/lib/toaster/toastergui/templates/base.html | 13 +- .../lib/toaster/toastergui/templates/landing.html | 10 -- .../toaster/toastergui/templates/projectconf.html | 70 +------- bitbake/lib/toaster/toastergui/tests.py | 4 - bitbake/lib/toaster/toastergui/views.py | 29 ---- .../toastermain/management/commands/get-dburl.py | 9 + bitbake/lib/toaster/toastermain/settings.py | 3 - bitbake/lib/toaster/toastermain/urls.py | 9 +- 16 files changed, 142 insertions(+), 403 deletions(-)create mode 100644
bitbake/lib/toaster/toastermain/management/commands/get-dburl.py--
EdSignature · 4 lines
_______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
Quoted 11 lines · Ed Bartosh
This patchset merges two Toaster modes in one:
To run toaster you should source it in already prepared build environment:
cd poky
. oe-init-build-env
. ../bitbake/bin/toasterAfter that you should be able to trigger builds both ways:
from command line and from toaster UI.
This works fine for me.
I'm able to run builds from the command line and from Toaster, and the data about those builds appears to be complete.
I have also gone through the code, and can't see any glaring issues with it.
Elliot
Quoted 72 lines
The following changes since commit
8a0d8eee432924433c3e70198aaeab3161476c5f:toaster manual: Updated the set up and use chapter (2015-10-27 07:28:22
+0000)are available in the git repository at:
git://git.yoctoproject.org/poky-contribed/toaster/8279-v3http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-v3
Ed Bartosh (24):
toaster: don't allow to run toaster as a script
toaster: implement get-dburl command
toaster: setDATABASE_URLin toaster script
toaster: run bitbake the same way
toaster: remove unused variable
toaster: check for toaster configuration later
toaster: use parent of the build dir
toaster: make runbuilds to loop
toaster: start 'manage.pyrunbuilds' in the script
toaster: update brbe and project attributes
toaster: implementstop_bitbakefunction
toaster: implementstart_bitbakefunction
toaster: implement 'toaster restart-bitbake'
toaster: remove_setupBEfunction
toaster: reimplemented startBBServer method
toaster: remove stopBBServer API
toaster: do not terminate bb server
toaster: remove usage ofBUILD_MODEvariable
toaster: do not create duplicate HelpText objects
toaster: implement BitbakeController.getVariable
toaster: set varibales on bitbake server
toaster: remove writeConfFile API
toaster: stop using toaster-pre.conf
toaster: remove SDKMACHINE from project variablesMichael Wood (1):
toaster: buildinfohelper Broaden the toaster created recipe data casebitbake/bin/toaster | 186 +++++++-------------- bitbake/lib/bb/ui/buildinfohelper.py | 23 +-- bitbake/lib/bb/ui/toasterui.py | 15 +- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 15 +- .../toaster/bldcontrol/localhostbecontroller.py | 132 ++++----------- .../bldcontrol/management/commands/runbuilds.py | 13 +- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 -- bitbake/lib/toaster/bldcontrol/tests.py | 4 - bitbake/lib/toaster/toastergui/templates/base.html | 13 +- .../lib/toaster/toastergui/templates/landing.html | 10 -- .../toaster/toastergui/templates/projectconf.html | 70 +------- bitbake/lib/toaster/toastergui/tests.py | 4 - bitbake/lib/toaster/toastergui/views.py | 29 ---- .../toastermain/management/commands/get-dburl.py | 9 + bitbake/lib/toaster/toastermain/settings.py | 3 - bitbake/lib/toaster/toastermain/urls.py | 9 +- 16 files changed, 142 insertions(+), 403 deletions(-) create mode 100644
bitbake/lib/toaster/toastermain/management/commands/get-dburl.py--
Ed--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre
Just to clarify, I tested the v4 branch with 2 patches cherry-picked.
Branch:
ed/toaster/8279-v4
Patches (to remove SDKMACHINE):
d5f682695c9f0005eb0713b4e302f36a22f80a9e0c4206c68d3089741525681c3ce0d2f96c09d451
Elliot
Quoted 105 lines · Elliot
Quoted 11 lines · Ed Bartosh
This patchset merges two Toaster modes in one:
To run toaster you should source it in already prepared build environment:
cd poky
. oe-init-build-env
. ../bitbake/bin/toasterAfter that you should be able to trigger builds both ways:
from command line and from toaster UI.This works fine for me.
I'm able to run builds from the command line and from Toaster, and the data about those builds appears to be complete.
I have also gone through the code, and can't see any glaring issues with it.
Elliot
Quoted 63 lines
The following changes since commit
8a0d8eee432924433c3e70198aaeab3161476c5f:toaster manual: Updated the set up and use chapter (2015-10-27 07:28:22
+0000)are available in the git repository at:
git://git.yoctoproject.org/poky-contribed/toaster/8279-v3http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-v3
Ed Bartosh (24):
toaster: don't allow to run toaster as a script
toaster: implement get-dburl command
toaster: setDATABASE_URLin toaster script
toaster: run bitbake the same way
toaster: remove unused variable
toaster: check for toaster configuration later
toaster: use parent of the build dir
toaster: make runbuilds to loop
toaster: start 'manage.pyrunbuilds' in the script
toaster: update brbe and project attributes
toaster: implementstop_bitbakefunction
toaster: implementstart_bitbakefunction
toaster: implement 'toaster restart-bitbake'
toaster: remove_setupBEfunction
toaster: reimplemented startBBServer method
toaster: remove stopBBServer API
toaster: do not terminate bb server
toaster: remove usage ofBUILD_MODEvariable
toaster: do not create duplicate HelpText objects
toaster: implement BitbakeController.getVariable
toaster: set varibales on bitbake server
toaster: remove writeConfFile API
toaster: stop using toaster-pre.conf
toaster: remove SDKMACHINE from project variablesMichael Wood (1):
toaster: buildinfohelper Broaden the toaster created recipe data casebitbake/bin/toaster | 186 +++++++-------------- bitbake/lib/bb/ui/buildinfohelper.py | 23 +-- bitbake/lib/bb/ui/toasterui.py | 15 +- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 15 +- .../toaster/bldcontrol/localhostbecontroller.py | 132 ++++----------- .../bldcontrol/management/commands/runbuilds.py | 13 +- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 -- bitbake/lib/toaster/bldcontrol/tests.py | 4 - bitbake/lib/toaster/toastergui/templates/base.html | 13 +- .../lib/toaster/toastergui/templates/landing.html | 10 -- .../toaster/toastergui/templates/projectconf.html | 70 +------- bitbake/lib/toaster/toastergui/tests.py | 4 - bitbake/lib/toaster/toastergui/views.py | 29 ---- .../toastermain/management/commands/get-dburl.py | 9 + bitbake/lib/toaster/toastermain/settings.py | 3 - bitbake/lib/toaster/toastermain/urls.py | 9 +- 16 files changed, 142 insertions(+), 403 deletions(-) create mode 100644
bitbake/lib/toaster/toastermain/management/commands/get-dburl.pyQuoted 9 lines
--
Ed--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster--
Elliot Smith
Software Engineer
Intel Open Source Technology Centre
Signature · 3 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre
Quoted 11 lines · Elliot
Just to clarify, I tested the v4 branch with 2 patches cherry-picked.
Branch:
ed/toaster/8279-v4
Patches (to remove SDKMACHINE):
d5f682695c9f0005eb0713b4e302f36a22f80a9e0c4206c68d3089741525681c3ce0d2f96c09d451
I tested in the same way, and it also works for me. However, I found that when you run build from the toaster GUI, the toaster process stayed in the foreground, so I was not able to start a build from command line afterwards. But if you press enter, you are dropped back to your shell. Elliot explained: "well, you are technically dropped back to the shell, it's just that toaster is being a bit naughty and writing to stdout, which is a bit confusing, because you can't see the prompt".
This indeed caused me quite a bit of confusion. If it's easy to fix, it would be good to do so, so that after the build completes you are cleanly dropped back to your shell and everything is ready to start a command line build if that's what you want to do.
Cheers
Belén
Quoted 145 lines
Elliot
On 9 November 2015 at 16:23, Smith, Elliot
<[email protected]> wrote:On 27 October 2015 at 17:27, Ed Bartosh
<[email protected]> wrote:This patchset merges two Toaster modes in one:
To run toaster you should source it in already prepared build environment:
cd poky
. oe-init-build-env
. ../bitbake/bin/toasterAfter that you should be able to trigger builds both ways:
from command line and from toaster UI.This works fine for me.
I'm able to run builds from the command line and from Toaster, and the data about those builds appears to be complete.
I have also gone through the code, and can't see any glaring issues with it.
Elliot
The following changes since commit
8a0d8eee432924433c3e70198aaeab3161476c5f:toaster manual: Updated the set up and use chapter (2015-10-27 07:28:22
+0000)are available in the git repository at:
git://git.yoctoproject.org/poky-contrib
<http://git.yoctoproject.org/poky-contrib> ed/toaster/8279-v3http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-v
3
<http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=ed/toaster/8279-
v3>Ed Bartosh (24):
toaster: don't allow to run toaster as a script
toaster: implement get-dburl command
toaster: setDATABASE_URLin toaster script
toaster: run bitbake the same way
toaster: remove unused variable
toaster: check for toaster configuration later
toaster: use parent of the build dir
toaster: make runbuilds to loop
toaster: start 'manage.pyrunbuilds' in the script
toaster: update brbe and project attributes
toaster: implementstop_bitbakefunction
toaster: implementstart_bitbakefunction
toaster: implement 'toaster restart-bitbake'
toaster: remove_setupBEfunction
toaster: reimplemented startBBServer method
toaster: remove stopBBServer API
toaster: do not terminate bb server
toaster: remove usage ofBUILD_MODEvariable
toaster: do not create duplicate HelpText objects
toaster: implement BitbakeController.getVariable
toaster: set varibales on bitbake server
toaster: remove writeConfFile API
toaster: stop using toaster-pre.conf
toaster: remove SDKMACHINE from project variablesMichael Wood (1):
toaster: buildinfohelper Broaden the toaster created recipe data casebitbake/bin/toaster | 186
+++++++--------------bitbake/lib/bb/ui/buildinfohelper.py | 23 +-- bitbake/lib/bb/ui/toasterui.py | 15 +- bitbake/lib/toaster/bldcontrol/bbcontroller.py | 15 +- .../toaster/bldcontrol/localhostbecontroller.py | 132 ++++----------- .../bldcontrol/management/commands/runbuilds.py | 13 +- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 10 -- bitbake/lib/toaster/bldcontrol/tests.py | 4 - bitbake/lib/toaster/toastergui/templates/base.html | 13 +- .../lib/toaster/toastergui/templates/landing.html | 10 -- .../toaster/toastergui/templates/projectconf.html | 70 +------- bitbake/lib/toaster/toastergui/tests.py | 4 - bitbake/lib/toaster/toastergui/views.py | 29 ---- .../toastermain/management/commands/get-dburl.py | 9 + bitbake/lib/toaster/toastermain/settings.py | 3 - bitbake/lib/toaster/toastermain/urls.py | 9 +- 16 files changed, 142 insertions(+), 403 deletions(-)create mode 100644
bitbake/lib/toaster/toastermain/management/commands/get-dburl.py--
Ed--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toasterSignature · 18 lines
Elliot Smith Software Engineer Intel Open Source Technology Centre -- Elliot Smith Software Engineer Intel Open Source Technology Centre