[bitbake-devel] [PATCH 3/8] toasterui: fix sstate task identification

Alex DAMIAN alexandru.damian at intel.com
Thu Feb 26 21:41:56 UTC 2015


From: Alexandru DAMIAN <alexandru.damian at intel.com>

This patch fixes a problem where set sstate scene tasks
were not identified, causing cache attempt not being recorded.

[YOCTO #7223]

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 lib/bb/ui/buildinfohelper.py |  4 ++--
 lib/toaster/orm/models.py    | 13 ++++---------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 967e4bd..c0f42d2 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -190,8 +190,8 @@ class ORMWrapper(object):
                     vars(task_object)[v] = task_information[v]
                     object_changed = True
 
-        # update setscene-related information if the task was just created
-        if created and task_object.outcome == Task.OUTCOME_COVERED and 1 == Task.objects.related_setscene(task_object).count():
+        # update setscene-related information if the task has a setscene
+        if task_object.outcome == Task.OUTCOME_COVERED and 1 == task_object.get_related_setscene().count():
             task_object.outcome = Task.OUTCOME_CACHED
             object_changed = True
 
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index d2b579f..03efac4 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -281,10 +281,6 @@ class Target_File(models.Model):
     sym_target = models.ForeignKey('Target_File', related_name="symlink_set", null=True)
 
 
-class TaskManager(models.Manager):
-    def related_setscene(self, task_object):
-        return Task.objects.filter(task_executed=True, build = task_object.build, recipe = task_object.recipe, task_name=task_object.task_name+"_setscene")
-
 class Task(models.Model):
 
     SSTATE_NA = 0
@@ -339,10 +335,8 @@ class Task(models.Model):
 
     search_allowed_fields = [ "recipe__name", "recipe__version", "task_name", "logfile" ]
 
-    objects = TaskManager()
-
     def get_related_setscene(self):
-        return Task.objects.related_setscene(self)
+        return Task.objects.filter(task_executed=True, build = self.build, recipe = self.recipe, task_name=self.task_name+"_setscene")
 
     def get_outcome_text(self):
         return Task.TASK_OUTCOME[self.outcome + 1][1]
@@ -377,7 +371,7 @@ class Task(models.Model):
     outcome = models.IntegerField(choices=TASK_OUTCOME, default=OUTCOME_NA)
     sstate_checksum = models.CharField(max_length=100, blank=True)
     path_to_sstate_obj = models.FilePathField(max_length=500, blank=True)
-    recipe = models.ForeignKey('Recipe', related_name='build_recipe')
+    recipe = models.ForeignKey('Recipe', related_name='tasks')
     task_name = models.CharField(max_length=100)
     source_url = models.FilePathField(max_length=255, blank=True)
     work_directory = models.FilePathField(max_length=255, blank=True)
@@ -394,7 +388,8 @@ class Task(models.Model):
     sstate_text  = property(get_sstate_text)
 
     def __unicode__(self):
-        return "%d %s:%s" % (self.id, self.recipe.name, self.task_name)
+        return "%d(%d) %s:%s" % (self.pk, self.build.pk, self.recipe.name, self.task_name)
+
     class Meta:
         ordering = ('order', 'recipe' ,)
         unique_together = ('build', 'recipe', 'task_name', )
-- 
1.9.1




More information about the bitbake-devel mailing list