[oe-commits] [bitbake] 12/40: toaster: add started property to Build

git at git.openembedded.org git at git.openembedded.org
Wed Aug 10 23:11:55 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit aa151a4d2de4a54fe3075a8c56a4935158398a18
Author: Elliot Smith <elliot.smith at intel.com>
AuthorDate: Wed Jul 13 14:39:47 2016 +0100

    toaster: add started property to Build
    
    Add a property to the Build model which records whether
    the BuildStarted event has occurred for the build.
    
    The proxy for this event is the presence of variables recorded
    against the Build: as the buildinfohelper only saves variables
    when the BuildStarted event occurs (as the variables aren't
    available on the bitbake server before that point), we can
    tell whether BuildStarted has happened by counting Variable
    objects on the Build.
    
    This can then be used to determine whether a Build "properly"
    started, enabling a different dashboard display (left-hand menu
    hidden) if the build didn't record any useful information (e.g.
    if it had a bad target).
    
    [YOCTO #8443]
    
    Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
 lib/toaster/orm/models.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index cfa243c..3da9a66 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -436,6 +436,21 @@ class Build(models.Model):
 
         return recent_builds
 
+    def started(self):
+        """
+        As build variables are only added for a build when its BuildStarted event
+        is received, a build with no build variables is counted as
+        "in preparation" and not properly started yet. This method
+        will return False if a build has no build variables (it never properly
+        started), or True otherwise.
+
+        Note that this is a temporary workaround for the fact that we don't
+        have a fine-grained state variable on a build which would allow us
+        to record "in progress" (BuildStarted received) vs. "in preparation".
+        """
+        variables = Variable.objects.filter(build=self)
+        return len(variables) > 0
+
     def completeper(self):
         tf = Task.objects.filter(build = self)
         tfc = tf.count()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list