Simplify code a bit.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 21 Nov 2010 03:41:42 +0000 (04:41 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 21 Nov 2010 03:41:42 +0000 (04:41 +0100)
buildfarm/data.py
buildfarm/sqldb.py

index ceaabb748c7c65924ba4b34fb03e6bdf67bc14f1..53f38536a7297dab7d4adeaa11cadd23cf89f678 100644 (file)
@@ -248,7 +248,6 @@ class Build(object):
     @property
     def age(self):
         """get the age of build"""
-        st = os.stat("%s.log" % self.basename)
         return time.time() - self.upload_time
 
     def read_log(self):
index 2c3c932a545074588a5cf3a226ff5d680348a02e..bd3c81fbf3bd04f53e7ef6ebb78b2431512c16f3 100644 (file)
@@ -51,12 +51,14 @@ class StormBuild(Build):
     tree = RawStr()
     revision = RawStr()
     host = RawStr()
-    host_id = Int()
     compiler = RawStr()
     checksum = RawStr()
     upload_time = Int(name="age")
+    commit = Unicode()
     status_str = RawStr(name="status")
+    commit_revision = RawStr()
     basename = RawStr()
+    host_id = Int()
 
     def status(self):
         return BuildStatus.__deserialize__(self.status_str)
@@ -244,11 +246,11 @@ class StormCachingBuildFarm(BuildFarm):
 
     def get_host_builds(self, host):
         return self._get_store().find(StormBuild,
-            StormBuild.host == host).group_by(StormBuild.compiler, StormBuild.tree)
+            StormBuild.host==host).group_by(StormBuild.compiler, StormBuild.tree)
 
     def get_tree_builds(self, tree):
-        return self._get_store().find(StormBuild,
-            StormBuild.tree == tree).order_by(Desc(StormBuild.upload_time))
+        result = self._get_store().find(StormBuild, StormBuild.tree==tree)
+        return result.order_by(Desc(StormBuild.upload_time))
 
     def get_last_builds(self):
         return self._get_store().find(StormBuild).group_by(