diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 0a8073f916..4c9c96b1bc 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -458,7 +458,7 @@ class BuildInfoHelper(object): task_information['task_executed'] = True if 'noexec' in vars(event) and event.noexec == True: task_information['task_executed'] = False - task_information['outcome'] = Task.OUTCOME_NA + task_information['outcome'] = Task.OUTCOME_EMPTY task_information['script_type'] = Task.CODING_NA # do not assign order numbers to scene tasks @@ -468,7 +468,10 @@ class BuildInfoHelper(object): task_obj = self.orm_wrapper.get_update_task_object(task_information) - self.internal_state[identifier] = {'start_time': datetime.datetime.now()} + self.internal_state[identifier] = { + 'start_time': datetime.datetime.now(), + 'outcome': task_information['outcome'], + } def store_tasks_stats(self, event): @@ -489,10 +492,9 @@ class BuildInfoHelper(object): recipe_information = self._get_recipe_information_from_taskfile(event.taskfile) recipe = self.orm_wrapper.get_update_recipe_object(recipe_information) task_information = self._get_task_information(event,recipe) - try: - task_information['start_time'] = self.internal_state[identifier]['start_time'] - except: - pass + + task_information['start_time'] = self.internal_state[identifier]['start_time'] + task_information['outcome'] = self.internal_state[identifier]['outcome'] if 'logfile' in vars(event): task_information['logfile'] = event.logfile @@ -507,13 +509,14 @@ class BuildInfoHelper(object): else: task_information['script_type'] = Task.CODING_SHELL - if isinstance(event, (bb.runqueue.runQueueTaskCompleted, bb.runqueue.sceneQueueTaskCompleted)): - task_information['outcome'] = Task.OUTCOME_SUCCESS - del self.internal_state[identifier] + if task_information['outcome'] == Task.OUTCOME_NA: + if isinstance(event, (bb.runqueue.runQueueTaskCompleted, bb.runqueue.sceneQueueTaskCompleted)): + task_information['outcome'] = Task.OUTCOME_SUCCESS + del self.internal_state[identifier] - if isinstance(event, (bb.runqueue.runQueueTaskFailed, bb.runqueue.sceneQueueTaskFailed)): - task_information['outcome'] = Task.OUTCOME_FAILED - del self.internal_state[identifier] + if isinstance(event, (bb.runqueue.runQueueTaskFailed, bb.runqueue.sceneQueueTaskFailed)): + task_information['outcome'] = Task.OUTCOME_FAILED + del self.internal_state[identifier] self.orm_wrapper.get_update_task_object(task_information) diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index f96da9c339..af44d86ff3 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -93,20 +93,22 @@ class Task(models.Model): (CODING_SHELL, 'Shell'), ) + OUTCOME_NA = -1 OUTCOME_SUCCESS = 0 OUTCOME_COVERED = 1 OUTCOME_CACHED = 2 OUTCOME_PREBUILT = 3 OUTCOME_FAILED = 4 - OUTCOME_NA = 5 + OUTCOME_EMPTY = 5 TASK_OUTCOME = ( + (OUTCOME_NA, 'Not Available'), (OUTCOME_SUCCESS, 'Succeeded'), (OUTCOME_COVERED, 'Covered'), (OUTCOME_CACHED, 'Cached'), (OUTCOME_PREBUILT, 'Prebuilt'), (OUTCOME_FAILED, 'Failed'), - (OUTCOME_NA, 'Not Available'), + (OUTCOME_EMPTY, 'Empty'), ) search_allowed_fields = [ "recipe__name", "task_name" ] @@ -142,6 +144,7 @@ class Task(models.Model): class Meta: ordering = ('order', 'recipe' ,) + unique_together = ('build', 'recipe', 'task_name', ) class Task_Dependency(models.Model):