aboutsummaryrefslogtreecommitdiffstats
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
parentb58b982eaf17b1cbe1b5ede1edda960d69cb5586 (diff)
downloadopenembedded-core-contrib-6f8df05e6e0640470472bc2e613611229e615dda.tar.gz
openembedded-core-contrib-6f8df05e6e0640470472bc2e613611229e615dda.tar.bz2
openembedded-core-contrib-6f8df05e6e0640470472bc2e613611229e615dda.zip
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>
-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 394c886973d..8816fe0ec91 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -337,20 +337,45 @@ class Project(models.Model):
return queryset
-
def schedule_build(self):
- from bldcontrol.models import BuildRequest, BRTarget, BRLayer, BRVariable, BRBitbake
- br = BuildRequest.objects.create(project = self)
+
+ from bldcontrol.models import BuildRequest, BRTarget, BRLayer
+ from bldcontrol.models import BRBitbake, BRVariable
+
try:
+ now = timezone.now()
+ build = Build.objects.create(project=self,
+ completed_on=now,
+ started_on=now)
+
+ br = BuildRequest.objects.create(project=self,
+ state=BuildRequest.REQ_QUEUED,
+ build=build)
+ BRBitbake.objects.create(req=br,
+ giturl=self.bitbake_version.giturl,
+ commit=self.bitbake_version.branch,
+ dirpath=self.bitbake_version.dirpath)
- BRBitbake.objects.create(req = br,
- giturl = self.bitbake_version.giturl,
- commit = self.bitbake_version.branch,
- dirpath = self.bitbake_version.dirpath)
+ for t in self.projecttarget_set.all():
+ BRTarget.objects.create(req=br, target=t.target, task=t.task)
+ Target.objects.create(build=br.build, target=t.target,
+ task=t.task)
+ # If we're about to build a custom image recipe make sure
+ # that layer is currently in the project before we create the
+ # BRLayer objects
+ customrecipe = CustomImageRecipe.objects.filter(
+ name=t.target,
+ project=self).first()
+ if customrecipe:
+ ProjectLayer.objects.get_or_create(
+ project=self,
+ layercommit=customrecipe.layer_version,
+ optional=False)
for l in self.projectlayer_set.all().order_by("pk"):
commit = l.layercommit.get_vcs_reference()
- print("ii Building layer ", l.layercommit.layer.name, " at vcs point ", commit)
+ logger.debug("Adding layer to build %s" %
+ l.layercommit.layer.name)
BRLayer.objects.create(
req=br,
name=l.layercommit.layer.name,
@@ -361,25 +386,16 @@ class Project(models.Model):
local_source_dir=l.layercommit.layer.local_source_dir
)
- br.state = BuildRequest.REQ_QUEUED
- now = timezone.now()
- br.build = Build.objects.create(project = self,
- completed_on=now,
- started_on=now,
- )
- for t in self.projecttarget_set.all():
- BRTarget.objects.create(req = br, target = t.target, task = t.task)
- Target.objects.create(build = br.build, target = t.target, task = t.task)
-
for v in self.projectvariable_set.all():
- BRVariable.objects.create(req = br, name = v.name, value = v.value)
-
+ BRVariable.objects.create(req=br, name=v.name, value=v.value)
try:
- br.build.machine = self.projectvariable_set.get(name = 'MACHINE').value
+ br.build.machine = self.projectvariable_set.get(
+ name='MACHINE').value
br.build.save()
except ProjectVariable.DoesNotExist:
pass
+
br.save()
signal_runbuilds()