summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-03-05 14:59:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 12:24:02 -0700
commitd32701381503275c13bd78c49e947ca25e2c8dcc (patch)
tree54a0e7030a8fa4ef9d1930677ae0d0c8f0eddcd9 /bitbake/lib/bb/ui
parentf3294d8da91de03b6354743326322318580cf05b (diff)
downloadpoky-d32701381503275c13bd78c49e947ca25e2c8dcc.tar.gz
bitbake: toasterui: fix task identification
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>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index f221daca5a..d7b526a2f2 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -105,7 +105,8 @@ class ORMWrapper(object):
105 ) 105 )
106 106
107 if must_exist and created: 107 if must_exist and created:
108 raise Exception("Task object created when expected to exist") 108 task_information['debug'] = "build id %d, recipe id %d" % (task_information['build'].pk, task_information['recipe'].pk)
109 raise Exception("Task object created when expected to exist", task_information)
109 110
110 for v in vars(task_object): 111 for v in vars(task_object):
111 if v in task_information.keys(): 112 if v in task_information.keys():
@@ -132,7 +133,7 @@ class ORMWrapper(object):
132 return task_object 133 return task_object
133 134
134 135
135 def get_update_recipe_object(self, recipe_information): 136 def get_update_recipe_object(self, recipe_information, must_exist = False):
136 assert 'layer_version' in recipe_information 137 assert 'layer_version' in recipe_information
137 assert 'file_path' in recipe_information 138 assert 'file_path' in recipe_information
138 139
@@ -140,6 +141,9 @@ class ORMWrapper(object):
140 layer_version=recipe_information['layer_version'], 141 layer_version=recipe_information['layer_version'],
141 file_path=recipe_information['file_path']) 142 file_path=recipe_information['file_path'])
142 143
144 if must_exist and created:
145 raise Exception("Recipe object created when expected to exist", recipe_information)
146
143 for v in vars(recipe_object): 147 for v in vars(recipe_object):
144 if v in recipe_information.keys(): 148 if v in recipe_information.keys():
145 vars(recipe_object)[v] = recipe_information[v] 149 vars(recipe_object)[v] = recipe_information[v]
@@ -539,7 +543,11 @@ class BuildInfoHelper(object):
539 assert localfilepath.startswith("/") 543 assert localfilepath.startswith("/")
540 544
541 recipe_information = self._get_recipe_information_from_taskfile(taskfile) 545 recipe_information = self._get_recipe_information_from_taskfile(taskfile)
542 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) 546 try:
547 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
548 except Exception:
549 # we cannot find the recipe information for the task, we move on to the next task
550 continue
543 551
544 task_information = {} 552 task_information = {}
545 task_information['build'] = self.internal_state['build'] 553 task_information['build'] = self.internal_state['build']
@@ -555,10 +563,18 @@ class BuildInfoHelper(object):
555 assert localfilepath.startswith("/") 563 assert localfilepath.startswith("/")
556 564
557 identifier = event.taskfile + ":" + event.taskname 565 identifier = event.taskfile + ":" + event.taskname
558 assert identifier in self.internal_state['taskdata'] 566 if not identifier in self.internal_state['taskdata']:
567 if isinstance(event, bb.build.TaskBase):
568 # we do a bit of guessing
569 candidates = [x for x in self.internal_state['taskdata'].keys() if x.endswith(identifier)]
570 if len(candidates) == 1:
571 identifier = candidates[0]
559 572
560 recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) 573 assert identifier in self.internal_state['taskdata']
561 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) 574 identifierlist = identifier.split(":")
575 realtaskfile = ":".join(identifierlist[0:len(identifierlist)-1])
576 recipe_information = self._get_recipe_information_from_taskfile(realtaskfile)
577 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
562 task_information = self._get_task_information(event,recipe) 578 task_information = self._get_task_information(event,recipe)
563 579
564 task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time'] 580 task_information['start_time'] = self.internal_state['taskdata'][identifier]['start_time']