summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py
diff options
context:
space:
mode:
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