summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index a3401ceda9..e428e4c649 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -117,15 +117,14 @@ class ORMWrapper(object):
117 117
118 if brbe is not None: 118 if brbe is not None:
119 from bldcontrol.models import BuildEnvironment, BuildRequest 119 from bldcontrol.models import BuildEnvironment, BuildRequest
120 try: 120 br, be = brbe.split(":")
121 br, be = brbe.split(":") 121
122 buildrequest = BuildRequest.objects.get(pk = br) 122 buildrequest = BuildRequest.objects.get(pk = br)
123 buildrequest.build = build 123 buildrequest.build = build
124 buildrequest.save() 124 buildrequest.save()
125 build.project_id = buildrequest.project_id 125
126 build.save() 126 build.project_id = buildrequest.project_id
127 except BuildRequest.DoesNotExist: 127 build.save()
128 pass
129 return build 128 return build
130 129
131 def create_target_objects(self, target_info): 130 def create_target_objects(self, target_info):
@@ -250,17 +249,30 @@ class ORMWrapper(object):
250 249
251 return layer_version_object 250 return layer_version_object
252 251
253 def get_update_layer_object(self, layer_information): 252 def get_update_layer_object(self, layer_information, brbe):
254 assert 'name' in layer_information 253 assert 'name' in layer_information
255 assert 'local_path' in layer_information 254 assert 'local_path' in layer_information
256 assert 'layer_index_url' in layer_information 255 assert 'layer_index_url' in layer_information
257 256
258 layer_object, created = Layer.objects.get_or_create( 257 if brbe is None:
258 layer_object, created = Layer.objects.get_or_create(
259 name=layer_information['name'], 259 name=layer_information['name'],
260 local_path=layer_information['local_path'], 260 local_path=layer_information['local_path'],
261 layer_index_url=layer_information['layer_index_url']) 261 layer_index_url=layer_information['layer_index_url'])
262 return layer_object
263 else:
264 # we are under managed mode; we must match the layer used in the Project Layer
265 from bldcontrol.models import BuildEnvironment, BuildRequest
266 br, be = brbe.split(":")
267
268 buildrequest = BuildRequest.objects.get(pk = br)
269
270 # we might have a race condition here, as the project layers may change between the build trigger and the actual build execution
271 # but we can only match on the layer name, so the worst thing can happen is a mis-identification of the layer, not a total failure
272 layer_object = buildrequest.project.projectlayer_set.get(layercommit__layer__name=layer_information['name']).layercommit.layer
273
274 return layer_object
262 275
263 return layer_object
264 276
265 def save_target_file_information(self, build_obj, target_obj, filedata): 277 def save_target_file_information(self, build_obj, target_obj, filedata):
266 assert isinstance(build_obj, Build) 278 assert isinstance(build_obj, Build)
@@ -689,7 +701,7 @@ class BuildInfoHelper(object):
689 layerinfos = event._localdata 701 layerinfos = event._localdata
690 self.internal_state['lvs'] = {} 702 self.internal_state['lvs'] = {}
691 for layer in layerinfos: 703 for layer in layerinfos:
692 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer])] = layerinfos[layer]['version'] 704 self.internal_state['lvs'][self.orm_wrapper.get_update_layer_object(layerinfos[layer], self.brbe)] = layerinfos[layer]['version']
693 705
694 706
695 def store_started_build(self, event): 707 def store_started_build(self, event):