[SCM] build.samba.org - branch master updated

Jelmer Vernooij jelmer at samba.org
Wed Nov 17 02:19:14 MST 2010


The branch, master has been updated
       via  d8b9cdd Implement sql-specific get_last_builds.
       via  ccf5ceb Add convenience function for finding all recent builds.
      from  2d03606 Simplify build status code a bit.

http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d8b9cddfc9b7ae49554398af747927eba1cabf94
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Nov 17 10:18:41 2010 +0100

    Implement sql-specific get_last_builds.

commit ccf5ceb19c105f6c79cda2de561fd40c40eb0c49
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Wed Nov 17 10:16:03 2010 +0100

    Add convenience function for finding all recent builds.

-----------------------------------------------------------------------

Summary of changes:
 buildfarm/__init__.py     |    5 +++
 buildfarm/sqldb.py        |    4 ++
 buildfarm/web/__init__.py |   75 ++++++++++++++++++++-------------------------
 3 files changed, 42 insertions(+), 42 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index 41df8d1..d185ed4 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -141,6 +141,11 @@ class BuildFarm(object):
             if build.tree in self.trees and build.compiler in self.compilers and build.host in hostnames:
                 yield build
 
+    def get_last_builds(self, tree=None):
+        for build in self.get_new_builds():
+            if tree is not None and build.tree == tree:
+                yield build
+
     def get_host_builds(self, host):
         from buildfarm import data
         for compiler in self.compilers:
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index fdee2dd..eebc7d8 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -246,6 +246,10 @@ class StormCachingBuildFarm(BuildFarm):
         return self._get_store().find(StormBuild,
             StormBuild.host == host).group_by(StormBuild.compiler, StormBuild.tree)
 
+    def get_last_builds(self, tree):
+        extra_expr = [StormBuild.tree == tree]
+        return self._get_store().find(StormBuild, *extra_expr)
+
     def commit(self):
         self.store.commit()
 
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index 2db0d05..5c771c3 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -612,36 +612,31 @@ class ViewRecentBuildsPage(BuildFarmPage):
         assert tree in self.buildfarm.trees, "not a build tree"
         assert sort_by in cmp_funcs, "not a valid sort"
 
-        t = self.buildfarm.trees[tree]
-
-        for host in self.buildfarm.hostdb.hosts():
-            for compiler in self.buildfarm.compilers:
-                try:
-                    build = self.buildfarm.get_build(tree, host.name.encode("utf-8"), compiler)
-                    status = build_status_html(myself, build)
-                except data.NoSuchBuildError:
-                    pass
-                else:
-                    age_mtime = build.age_mtime()
-                    age_ctime = build.age_ctime()
-                    try:
-                        (revision, revision_time) = build.revision_details()
-                    except data.MissingRevisionInfo:
-                        pass
-                    else:
-                        all_builds.append([
-                            age_ctime,
-                            host.platform.encode("utf-8"),
-                            "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>"
-                                % (myself, host.name.encode("utf-8"),
-                                   tree, compiler, host.name.encode("utf-8"),
-                                   host.name.encode("utf-8")),
-                            compiler, tree, status, build.status(),
-                            revision_link(myself, revision, tree),
-                            revision_time])
+        for build in self.buildfarm.get_last_builds(tree=tree):
+            host = self.buildfarm.hostdb.host(build.host)
+            status = build_status_html(myself, build)
+            age_mtime = build.age_mtime()
+            age_ctime = build.age_ctime()
+            try:
+                (revision, revision_time) = build.revision_details()
+            except data.MissingRevisionInfo:
+                pass
+            else:
+                all_builds.append([
+                    age_ctime,
+                    host.platform.encode("utf-8"),
+                    "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>"
+                        % (myself, host.name.encode("utf-8"),
+                           tree, build.compiler, host.name.encode("utf-8"),
+                           host.name.encode("utf-8")),
+                    build.compiler, tree, status, build.status(),
+                    revision_link(myself, revision, tree),
+                    revision_time])
 
         all_builds.sort(cmp_funcs[sort_by])
 
+        t = self.buildfarm.trees[tree]
+
         sorturl = "%s?tree=%s;function=Recent+Builds" % (myself, tree)
 
         yield "<div id='recent-builds' class='build-section'>"
@@ -785,21 +780,17 @@ class ViewSummaryPage(BuildFarmPage):
         broken_table = ""
         last_host = ""
 
-        for host in self.buildfarm.hostdb.hosts():
-            for compiler in self.buildfarm.compilers:
-                for tree in self.buildfarm.trees:
-                    try:
-                        build = self.buildfarm.get_build(tree, host.name, compiler)
-                    except data.NoSuchBuildError:
-                        continue
-                    age_mtime = build.age_mtime()
-                    host_count[tree]+=1
-                    status = build.status()
-
-                    if status.failed:
-                        broken_count[tree]+=1
-                        if "panic" in status.other_failures:
-                            panic_count[tree]+=1
+        builds = self.buildfarm.get_last_builds()
+
+        for build in builds:
+            age_mtime = build.age_mtime()
+            host_count[build.tree]+=1
+            status = build.status()
+
+            if status.failed:
+                broken_count[build.tree]+=1
+                if "panic" in status.other_failures:
+                    panic_count[build.tree]+=1
         return (host_count, broken_count, panic_count)
 
     def render_text(self, myself):


-- 
build.samba.org


More information about the samba-cvs mailing list