Add +recent-ids.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 19 Dec 2010 23:37:34 +0000 (00:37 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 19 Dec 2010 23:37:34 +0000 (00:37 +0100)
buildfarm/build.py
buildfarm/web/__init__.py

index 7689364..e8f9664 100644 (file)
@@ -349,6 +349,15 @@ class Build(object):
         except IOError:
             raise LogFileMissing()
 
+    def has_log(self):
+        try:
+            f = self.read_log()
+        except LogFileMissing:
+            return False
+        else:
+            f.close()
+            return True
+
     def read_err(self):
         """read full err file"""
         try:
index e401a31..84e7bb3 100755 (executable)
@@ -987,14 +987,20 @@ class BuildFarmApp(object):
         else:
             fn = wsgiref.util.shift_path_info(environ)
             if fn == "tree":
-                start_response('200 OK', [
-                    ('Content-type', 'text/html; charset=utf-8')])
                 tree = wsgiref.util.shift_path_info(environ)
                 subfn = wsgiref.util.shift_path_info(environ)
                 if subfn in ("", None, "+recent"):
+                    start_response('200 OK', [
+                        ('Content-type', 'text/html; charset=utf-8')])
                     page = ViewRecentBuildsPage(self.buildfarm)
                     yield "".join(self.html_page(form, page.render(myself, tree, get_param(form, 'sortby') or 'age')))
+                elif subfn == "+recent-ids":
+                    start_response('200 OK', [
+                        ('Content-type', 'text/plain; charset=utf-8')])
+                    yield "".join([x.log_checksum()+"\n" for x in self.buildfarm.get_tree_builds(tree) if x.has_log()])
                 else:
+                    start_response('200 OK', [
+                        ('Content-type', 'text/html; charset=utf-8')])
                     yield "Unknown subfn %s" % subfn
             elif fn == "host":
                 start_response('200 OK', [