summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-09-28 21:45:27 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-29 14:11:38 +0100
commit922503f4c1d664edc5d3c0f66f262b3b4c3e5c56 (patch)
treeaf791653d208cc5674dd75b4ca3ca93896f42b6a /bitbake/lib/bb/ui
parent0bc0a44affe689422fb8d05b19e06338f6901629 (diff)
downloadpoky-922503f4c1d664edc5d3c0f66f262b3b4c3e5c56.tar.gz
bitbake: toaster: Create a relationship between build information and toaster layers
Previously this layer relationship was done by trying to match path information that came back to the buildinfohelper with trying to query for data in toaster's layers table. This rarely matched due to the lose coupling. (Bitbake rev: 838e77c7c3c4006abd1327343a004590ab652de9) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 5098448c97..d0efaa9778 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -94,8 +94,8 @@ class ORMWrapper(object):
94 94
95 created = False 95 created = False
96 if not key in vars(self)[dictname].keys(): 96 if not key in vars(self)[dictname].keys():
97 vars(self)[dictname][key] = clazz.objects.create(**kwargs) 97 vars(self)[dictname][key], created = \
98 created = True 98 clazz.objects.get_or_create(**kwargs)
99 99
100 return (vars(self)[dictname][key], created) 100 return (vars(self)[dictname][key], created)
101 101
@@ -271,6 +271,17 @@ class ORMWrapper(object):
271 return recipe_object 271 return recipe_object
272 272
273 def get_update_layer_version_object(self, build_obj, layer_obj, layer_version_information): 273 def get_update_layer_version_object(self, build_obj, layer_obj, layer_version_information):
274 if isinstance(layer_obj, Layer_Version):
275 # We already found our layer version for this build so just
276 # update it with the new build information
277 logger.debug("We found our layer from toaster")
278 layer_obj.build = build_obj
279 layer_obj.local_path = layer_version_information['local_path']
280 layer_obj.commit = layer_version_information['commit']
281 layer_obj.save()
282 self.layer_version_objects.append(layer_obj)
283 return layer_obj
284
274 assert isinstance(build_obj, Build) 285 assert isinstance(build_obj, Build)
275 assert isinstance(layer_obj, Layer) 286 assert isinstance(layer_obj, Layer)
276 assert 'branch' in layer_version_information 287 assert 'branch' in layer_version_information
@@ -320,8 +331,15 @@ class ORMWrapper(object):
320 localdirname = os.path.join(bc.be.sourcedir, localdirname) 331 localdirname = os.path.join(bc.be.sourcedir, localdirname)
321 #logger.debug(1, "Localdirname %s lcal_path %s" % (localdirname, layer_information['local_path'])) 332 #logger.debug(1, "Localdirname %s lcal_path %s" % (localdirname, layer_information['local_path']))
322 if localdirname.startswith(layer_information['local_path']): 333 if localdirname.startswith(layer_information['local_path']):
334 # If the build request came from toaster this field
335 # should contain the information from the layer_version
336 # That created this build request.
337 if brl.layer_version:
338 return brl.layer_version
339
323 # we matched the BRLayer, but we need the layer_version that generated this BR; reverse of the Project.schedule_build() 340 # we matched the BRLayer, but we need the layer_version that generated this BR; reverse of the Project.schedule_build()
324 #logger.debug(1, "Matched %s to BRlayer %s" % (pformat(layer_information["local_path"]), localdirname)) 341 #logger.debug(1, "Matched %s to BRlayer %s" % (pformat(layer_information["local_path"]), localdirname))
342
325 for pl in buildrequest.project.projectlayer_set.filter(layercommit__layer__name = brl.name): 343 for pl in buildrequest.project.projectlayer_set.filter(layercommit__layer__name = brl.name):
326 if pl.layercommit.layer.vcs_url == brl.giturl : 344 if pl.layercommit.layer.vcs_url == brl.giturl :
327 layer = pl.layercommit.layer 345 layer = pl.layercommit.layer
@@ -674,6 +692,7 @@ class BuildInfoHelper(object):
674 def __init__(self, server, has_build_history = False): 692 def __init__(self, server, has_build_history = False):
675 self.internal_state = {} 693 self.internal_state = {}
676 self.internal_state['taskdata'] = {} 694 self.internal_state['taskdata'] = {}
695 self.internal_state['targets'] = []
677 self.task_order = 0 696 self.task_order = 0
678 self.autocommit_step = 1 697 self.autocommit_step = 1
679 self.server = server 698 self.server = server
@@ -752,8 +771,15 @@ class BuildInfoHelper(object):
752 if not localdirname.startswith("/"): 771 if not localdirname.startswith("/"):
753 localdirname = os.path.join(bc.be.sourcedir, localdirname) 772 localdirname = os.path.join(bc.be.sourcedir, localdirname)
754 if path.startswith(localdirname): 773 if path.startswith(localdirname):
774 # If the build request came from toaster this field
775 # should contain the information from the layer_version
776 # That created this build request.
777 if brl.layer_version:
778 return brl.layer_version
779
755 #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname)) 780 #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname))
756 # we matched the BRLayer, but we need the layer_version that generated this br 781 # we matched the BRLayer, but we need the layer_version that generated this br
782
757 for lvo in self.orm_wrapper.layer_version_objects: 783 for lvo in self.orm_wrapper.layer_version_objects:
758 if brl.name == lvo.layer.name: 784 if brl.name == lvo.layer.name:
759 return lvo 785 return lvo