summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-10-13 17:10:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-10-30 13:39:51 +0000
commit2837b110ae8fd5ff0ca3ac5959cadb7d4a5ce6cc (patch)
treefca7aba2e90cbcb6f3b11a90bb00665850fa2460 /bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
parenta0660718e6599538dd65cadadbc04c6adc951b57 (diff)
downloadpoky-2837b110ae8fd5ff0ca3ac5959cadb7d4a5ce6cc.tar.gz
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 <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py19
1 files changed, 12 insertions, 7 deletions
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):
39 # we could not find a BEC; postpone the BR 39 # we could not find a BEC; postpone the BR
40 br.state = BuildRequest.REQ_QUEUED 40 br.state = BuildRequest.REQ_QUEUED
41 br.save() 41 br.save()
42 print "No build env"
42 return 43 return
43 44
44 # set up the buid environment with the needed layers
45 print "Build %s, Environment %s" % (br, bec.be) 45 print "Build %s, Environment %s" % (br, bec.be)
46 bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all()) 46 # let the build request know where it is being executed
47 br.environment = bec.be
48 br.save()
47 49
48 # get the bb server running 50 # set up the buid environment with the needed layers
49 bbctrl = bec.getBBController() 51 bec.setLayers(br.brbitbake_set.all(), br.brlayer_set.all())
50 52
51 # let toasterui that this is a managed build 53 # get the bb server running with the build req id and build env id
52 bbctrl.setVariable("TOASTER_BRBE", "%d:%d" % (br.pk, bec.be.pk)) 54 bbctrl = bec.getBBController("%d:%d" % (br.pk, bec.be.pk))
53 55
54 # set the build configuration 56 # set the build configuration
55 for variable in br.brvariable_set.all(): 57 for variable in br.brvariable_set.all():
56 bbctrl.setVariable(variable.name, variable.value) 58 bbctrl.setVariable(variable.name, variable.value)
57 59
58 # trigger the build command 60 # trigger the build command
59 bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all()))) 61 task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, br.brtarget_set.all()))
62 if len(task) == 0:
63 task = None
64 bbctrl.build(list(map(lambda x:x.target, br.brtarget_set.all())), task)
60 65
61 print "Build launched, exiting" 66 print "Build launched, exiting"
62 # disconnect from the server 67 # disconnect from the server