summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-03-14 16:59:27 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-17 13:59:36 +0000
commitbe778cdded6b09066be5c5d326852da9a3ae0642 (patch)
treead7ebbc41c52df1ad78d39fef105cb3ffe904155 /bitbake/lib/bb/ui
parent513722d9ca833671caa8e3f106d60ad5a6d740cc (diff)
downloadpoky-be778cdded6b09066be5c5d326852da9a3ae0642.tar.gz
bitbake: toaster: improve recipe matching for native tasks
This patch improves the recipe matching algorithm for for matching recipes for native tasks. (Bitbake rev: c350e4924abab8688c539608fd7f3af687d7265a) 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.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index b5e75d97bb..15bc069b8f 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -33,6 +33,9 @@ from toaster.orm.models import Task_Dependency, Package_Dependency
33from toaster.orm.models import Recipe_Dependency 33from toaster.orm.models import Recipe_Dependency
34from bb.msg import BBLogFormatter as format 34from bb.msg import BBLogFormatter as format
35 35
36class NotExisting(Exception):
37 pass
38
36class ORMWrapper(object): 39class ORMWrapper(object):
37 """ This class creates the dictionaries needed to store information in the database 40 """ This class creates the dictionaries needed to store information in the database
38 following the format defined by the Django models. It is also used to save this 41 following the format defined by the Django models. It is also used to save this
@@ -111,7 +114,8 @@ class ORMWrapper(object):
111 114
112 if must_exist and created: 115 if must_exist and created:
113 task_information['debug'] = "build id %d, recipe id %d" % (task_information['build'].pk, task_information['recipe'].pk) 116 task_information['debug'] = "build id %d, recipe id %d" % (task_information['build'].pk, task_information['recipe'].pk)
114 raise Exception("Task object created when expected to exist", task_information) 117 task_object.delete()
118 raise NotExisting("Task object created when expected to exist", task_information)
115 119
116 for v in vars(task_object): 120 for v in vars(task_object):
117 if v in task_information.keys(): 121 if v in task_information.keys():
@@ -142,12 +146,14 @@ class ORMWrapper(object):
142 assert 'layer_version' in recipe_information 146 assert 'layer_version' in recipe_information
143 assert 'file_path' in recipe_information 147 assert 'file_path' in recipe_information
144 148
149
145 recipe_object, created = Recipe.objects.get_or_create( 150 recipe_object, created = Recipe.objects.get_or_create(
146 layer_version=recipe_information['layer_version'], 151 layer_version=recipe_information['layer_version'],
147 file_path=recipe_information['file_path']) 152 file_path=recipe_information['file_path'])
148 153
149 if must_exist and created: 154 if must_exist and created:
150 raise Exception("Recipe object created when expected to exist", recipe_information) 155 recipe_object.delete()
156 raise NotExisting("Recipe object created when expected to exist", recipe_information)
151 157
152 for v in vars(recipe_object): 158 for v in vars(recipe_object):
153 if v in recipe_information.keys(): 159 if v in recipe_information.keys():
@@ -639,7 +645,7 @@ class BuildInfoHelper(object):
639 identifier = event.taskfile + ":" + event.taskname 645 identifier = event.taskfile + ":" + event.taskname
640 646
641 recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) 647 recipe_information = self._get_recipe_information_from_taskfile(event.taskfile)
642 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) 648 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
643 649
644 task_information = self._get_task_information(event, recipe) 650 task_information = self._get_task_information(event, recipe)
645 task_information['outcome'] = Task.OUTCOME_NA 651 task_information['outcome'] = Task.OUTCOME_NA
@@ -679,9 +685,9 @@ class BuildInfoHelper(object):
679 recipe_information = self._get_recipe_information_from_taskfile(taskfile) 685 recipe_information = self._get_recipe_information_from_taskfile(taskfile)
680 try: 686 try:
681 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True) 687 recipe = self.orm_wrapper.get_update_recipe_object(recipe_information, True)
682 except Exception: 688 except NotExisting:
683 # we cannot find the recipe information for the task, we move on to the next task 689 recipe = Recipe.objects.get(layer_version = recipe_information['layer_version'],
684 continue 690 file_path__endswith = recipe_information['file_path'])
685 691
686 task_information = {} 692 task_information = {}
687 task_information['build'] = self.internal_state['build'] 693 task_information['build'] = self.internal_state['build']