From 2837b110ae8fd5ff0ca3ac5959cadb7d4a5ce6cc Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Mon, 13 Oct 2014 17:10:39 +0100 Subject: bitbake: toaster: change startup parameter passing to avoid race We avoid a race between the setting the TOASTER_BRBE variable and reading the variable in toaster ui by supplying the variable at server startup time through the toaster.conf post-read file. Additional small changes are included, including marking the build request with the environment id of where the build took place. (Bitbake rev: 7c333350418c4140e6c988c5272940f8057d327d) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- .../bldcontrol/management/commands/runbuilds.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py') diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py index 8efe8e62bc..5e253e0efc 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py @@ -39,24 +39,29 @@ class Command(NoArgsCommand): # we could not find a BEC; postpone the BR br.state = BuildRequest.REQ_QUEUED br.save() + print "No build env" return - # set up the buid environment with the needed layers print "Build %s, Environment %s" % (br, bec.be) - bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all()) + # let the build request know where it is being executed + br.environment = bec.be + br.save() - # get the bb server running - bbctrl = bec.getBBController() + # set up the buid environment with the needed layers + bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all()) - # let toasterui that this is a managed build - bbctrl.setVariable("TOASTER_BRBE", "%d:%d" % (br.pk, bec.be.pk)) + # get the bb server running with the build req id and build env id + bbctrl = bec.getBBController("%d:%d" % (br.pk, bec.be.pk)) # set the build configuration for variable in br.brvariable_set.all(): bbctrl.setVariable(variable.name, variable.value) # trigger the build command - bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all()))) + task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, br.brtarget_set.all())) + if len(task) == 0: + task = None + bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all())), task) print "Build launched, exiting" # disconnect from the server -- cgit v1.2.3-54-g00ecf