]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: toasterui: fix task identification
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Wed, 5 Mar 2014 14:59:55 +0000 (14:59 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Mar 2014 19:24:02 +0000 (12:24 -0700)
This patch adds extra checks when selecting and writing
task and recipe objects to the database.

The patch fixes several issues where tasks may have been
misidentified between virtual-native and target tasks,
or spurious task objects may have been created.

(Bitbake rev: a6e597e690b3c6c6fa2af6db8cd871c02fc80421)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/ui/buildinfohelper.py

index f221daca5afdab3c81957d9ed402d6d6b09c2b97..d7b526a2f2458f9857e05cb56c1d7c9eec4d2256 100644 (file)
@@ -105,7 +105,8 @@ class ORMWrapper(object):
                                 )
 
         if must_exist and created:
-            raise Exception("Task object created when expected to exist")
+            task_information['debug'] = "build id %d, recipe id %d" % (task_information['build'].pk, task_information['recipe'].pk)
+            raise Exception("Task object created when expected to exist", task_information)
 
         for v in vars(task_object):
             if v in task_information.keys():
@@ -132,7 +133,7 @@ class ORMWrapper(object):
         return task_object
 
 
-    def get_update_recipe_object(self, recipe_information):
+    def get_update_recipe_object(self, recipe_information, must_exist = False):
         assert 'layer_version' in recipe_information
         assert 'file_path' in recipe_information
 
@@ -140,6 +141,9 @@ class ORMWrapper(object):
                                          layer_version=recipe_information['layer_version'],
                                          file_path=recipe_information['file_path'])
 
+        if must_exist and created:
+            raise Exception("Recipe object created when expected to exist", recipe_information)
+
         for v in vars(recipe_object):
             if v in recipe_information.keys():
                 vars(recipe_object)[v] = recipe_information[v]
@@ -539,7 +543,11 @@ class BuildInfoHelper(object):
             assert localfilepath.startswith("/")
 
             recipe_information = self._get_recipe_information_from_taskfile(taskfile)
-            recipe = self.orm_wrapper.get_update_recipe_object(recipe_information)
+            try:
+                recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
+            except Exception:
+                # we cannot find the recipe information for the task, we move on to the next task
+                continue
 
             task_information = {}
             task_information['build'] = self.internal_state['build']
@@ -555,10 +563,18 @@ class BuildInfoHelper(object):
         assert localfilepath.startswith("/")
 
         identifier = event.taskfile + ":" + event.taskname
-        assert identifier in self.internal_state['taskdata']
+        if not identifier in self.internal_state['taskdata']:
+            if isinstance(event, bb.build.TaskBase):
+                # we do a bit of guessing
+                candidates = [x for x in self.internal_state['taskdata'].keys() if x.endswith(identifier)]
+                if len(candidates) == 1:
+                    identifier = candidates[0]
 
-        recipe_information = self._get_recipe_information_from_taskfile(event.taskfile)
-        recipe = self.orm_wrapper.get_update_recipe_object(recipe_information)
+        assert identifier in self.internal_state['taskdata']
+        identifierlist = identifier.split(":")
+        realtaskfile = ":".join(identifierlist[0:len(identifierlist)-1])
+        recipe_information = self._get_recipe_information_from_taskfile(realtaskfile)
+        recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
         task_information = self._get_task_information(event,recipe)
 
         task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time']