]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: toasterui: adding new task outcome empty
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Thu, 13 Feb 2014 13:12:39 +0000 (13:12 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Mar 2014 19:23:57 +0000 (12:23 -0700)
In order to separate tasks with invalid states from the
no exec tasks, we add a new value OUTCOME_EMPTY for the tasks.

OUTCOME_EMPTY has the same value as OUTCOME_NA as to maintain
compatibility with already existing builds. New value for
OUTCOME_NA can be used to detect tasks with invalid states, i.e.
it should never appear after finishing a build.

Fixing noexec tasks outcomes.

[YOCTO #5763]

(Bitbake rev: 475643ad78796835bf2e731b9d0fa5794ec80dd1)

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

index 0a8073f916f1dbc31ad30e19f924db3f1d1b78f0..4c9c96b1bc71e679ba780f1c0b9c53fb850a6165 100644 (file)
@@ -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)
 
index f96da9c3398e73b0c22382d8371472834612b612..af44d86ff37b929656e129c4757c560320d7dc9d 100644 (file)
@@ -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):