summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-11-24 11:20:02 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-30 15:48:10 +0000
commit6f8df05e6e0640470472bc2e613611229e615dda (patch)
tree67746e7c2517cacd72fd85cf4e6501c8fe9ab6ea /bitbake
parentb58b982eaf17b1cbe1b5ede1edda960d69cb5586 (diff)
downloadpoky-6f8df05e6e0640470472bc2e613611229e615dda.tar.gz
bitbake: toaster: orm models Handle CustomImageRecipe BRLayer here
The schedule_build function on the project object is where the BRLayers are created for the build. Instead of creating the BRLayer for the CustomImageRecipe in the localhostbbcontroller create it here so that all that mechanism is in one place. Also fix a number of pyflake errors. (Bitbake rev: f8d3ea784937b6e416d3e5a4feb1283c478e4caa) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/orm/models.py58
1 files changed, 37 insertions, 21 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 394c886973..8816fe0ec9 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -337,20 +337,45 @@ class Project(models.Model):
337 337
338 return queryset 338 return queryset
339 339
340
341 def schedule_build(self): 340 def schedule_build(self):
342 from bldcontrol.models import BuildRequest, BRTarget, BRLayer, BRVariable, BRBitbake 341
343 br = BuildRequest.objects.create(project = self) 342 from bldcontrol.models import BuildRequest, BRTarget, BRLayer
343 from bldcontrol.models import BRBitbake, BRVariable
344
344 try: 345 try:
346 now = timezone.now()
347 build = Build.objects.create(project=self,
348 completed_on=now,
349 started_on=now)
350
351 br = BuildRequest.objects.create(project=self,
352 state=BuildRequest.REQ_QUEUED,
353 build=build)
354 BRBitbake.objects.create(req=br,
355 giturl=self.bitbake_version.giturl,
356 commit=self.bitbake_version.branch,
357 dirpath=self.bitbake_version.dirpath)
345 358
346 BRBitbake.objects.create(req = br, 359 for t in self.projecttarget_set.all():
347 giturl = self.bitbake_version.giturl, 360 BRTarget.objects.create(req=br, target=t.target, task=t.task)
348 commit = self.bitbake_version.branch, 361 Target.objects.create(build=br.build, target=t.target,
349 dirpath = self.bitbake_version.dirpath) 362 task=t.task)
363 # If we're about to build a custom image recipe make sure
364 # that layer is currently in the project before we create the
365 # BRLayer objects
366 customrecipe = CustomImageRecipe.objects.filter(
367 name=t.target,
368 project=self).first()
369 if customrecipe:
370 ProjectLayer.objects.get_or_create(
371 project=self,
372 layercommit=customrecipe.layer_version,
373 optional=False)
350 374
351 for l in self.projectlayer_set.all().order_by("pk"): 375 for l in self.projectlayer_set.all().order_by("pk"):
352 commit = l.layercommit.get_vcs_reference() 376 commit = l.layercommit.get_vcs_reference()
353 print("ii Building layer ", l.layercommit.layer.name, " at vcs point ", commit) 377 logger.debug("Adding layer to build %s" %
378 l.layercommit.layer.name)
354 BRLayer.objects.create( 379 BRLayer.objects.create(
355 req=br, 380 req=br,
356 name=l.layercommit.layer.name, 381 name=l.layercommit.layer.name,
@@ -361,25 +386,16 @@ class Project(models.Model):
361 local_source_dir=l.layercommit.layer.local_source_dir 386 local_source_dir=l.layercommit.layer.local_source_dir
362 ) 387 )
363 388
364 br.state = BuildRequest.REQ_QUEUED
365 now = timezone.now()
366 br.build = Build.objects.create(project = self,
367 completed_on=now,
368 started_on=now,
369 )
370 for t in self.projecttarget_set.all():
371 BRTarget.objects.create(req = br, target = t.target, task = t.task)
372 Target.objects.create(build = br.build, target = t.target, task = t.task)
373
374 for v in self.projectvariable_set.all(): 389 for v in self.projectvariable_set.all():
375 BRVariable.objects.create(req = br, name = v.name, value = v.value) 390 BRVariable.objects.create(req=br, name=v.name, value=v.value)
376
377 391
378 try: 392 try:
379 br.build.machine = self.projectvariable_set.get(name = 'MACHINE').value 393 br.build.machine = self.projectvariable_set.get(
394 name='MACHINE').value
380 br.build.save() 395 br.build.save()
381 except ProjectVariable.DoesNotExist: 396 except ProjectVariable.DoesNotExist:
382 pass 397 pass
398
383 br.save() 399 br.save()
384 signal_runbuilds() 400 signal_runbuilds()
385 401