diff options
| -rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 18 |
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 | |||
| 33 | from toaster.orm.models import Recipe_Dependency | 33 | from toaster.orm.models import Recipe_Dependency |
| 34 | from bb.msg import BBLogFormatter as format | 34 | from bb.msg import BBLogFormatter as format |
| 35 | 35 | ||
| 36 | class NotExisting(Exception): | ||
| 37 | pass | ||
| 38 | |||
| 36 | class ORMWrapper(object): | 39 | class 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'] |
