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

Jelmer Vernooij jelmer at samba.org
Tue Nov 2 04:02:29 MDT 2010


The branch, master has been updated
       via  066ce8d remove htmlization of status handling in data.py.
      from  1fd8f4c Split off caching into a separate subclass.

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


- Log -----------------------------------------------------------------
commit 066ce8d7559b196a1188875afa0d7ce48053eaec
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Nov 2 11:02:24 2010 +0100

    remove htmlization of status handling in data.py.

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

Summary of changes:
 buildfarm/data.py |   81 +----------------------------------------------------
 web/build.py      |   30 +++++++++++++++++--
 2 files changed, 28 insertions(+), 83 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/data.py b/buildfarm/data.py
index 887ea6b..a825d0f 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -29,10 +29,6 @@ import time
 import util
 
 
-def span(classname, contents):
-    return "<span class=\"%s\">%s</span>" % (classname, contents)
-
-
 def check_dir_exists(kind, path):
     if not os.path.isdir(path):
         raise Exception("%s directory %s does not exist" % (kind, path))
@@ -137,7 +133,7 @@ class Build(object):
         log = self.read_log()
         err = self.read_err()
 
-        return self._store.html_build_status_from_logs(log, err)
+        return self._store.build_status_from_logs(log, err)
 
     def err_count(self):
         """get status of build"""
@@ -287,26 +283,6 @@ class BuildResultStore(object):
             return os.path.join(self.datadir, "oldrevs/build.%s.%s.%s-%s" % (tree, host, compiler, rev))
         return os.path.join(self.datadir, "upload/build.%s.%s.%s" % (tree, host, compiler))
 
-    def html_build_status_from_logs(self, log, err):
-        def span_status(st):
-            if st is None:
-                return span("status unknown", "?")
-            elif st == 0:
-                return span("status passed", "ok")
-            else:
-                return span("status failed", st)
-        (cstatus, bstatus, istatus, tstatus, sstatus, other_failures) = self.build_status_from_logs(log, err)
-        ostatus = ""
-        if "panic" in other_failures:
-            ostatus += "/"+span("status panic", "PANIC")
-        if "disk full" in other_failures:
-            ostatus += "/"+span("status failed", "disk full")
-        if "timeout" in other_failures:
-            ostatus += "/"+span("status failed", "timeout")
-        if sstatus is not None:
-            ostatus += "/".span("status checker", sstatus)
-        return "%s/%s/%s/%s%s" % (span_status(cstatus), span_status(bstatus), span_status(istatus), span_status(tstatus), ostatus)
-
     def build_status_from_logs(self, log, err):
         """get status of build"""
         m = re.search("TEST STATUS:(.*)", log)
@@ -361,61 +337,6 @@ class BuildResultStore(object):
 
         return (cstatus, bstatus, istatus, tstatus, sstatus, other_failures)
 
-    def build_status_info_from_string(self, rev_seq, rev, status_raw):
-        """find the build status as an object
-
-        the 'value' gets one point for passing each stage"""
-        status_split = status_raw.split("/")
-        status_str = ""
-        status_arr = []
-        status_val = 0
-
-        for r in status_split:
-            r = r.strip()
-
-            if r == "ok":
-                e = 0
-            elif r.isdigit():
-                e = int(r)
-                if e < 0:
-                    e = 1
-            else:
-                e = 1
-
-            if status_str != "":
-                status_str += "/"
-            status_str += "%d" % r
-
-            status_val += e
-
-            status_arr.append(e)
-
-        return {
-            "rev": rev,
-            "rev_seq": rev_seq,
-            "array": status_arr,
-            "string": status_str,
-            "value": status_val,
-            }
-
-    def build_status_info_from_html(self, rev_seq, rev, status_html):
-        """find the build status as an perl object
-
-        the 'value' gets one point for passing each stage
-        """
-        status_raw = util.strip_html(status_html)
-        return self.build_status_info_from_string(rev_seq, rev, status_raw)
-
-    def build_status_info(self, tree, host, compiler, rev_seq):
-        """find the build status as an object
-
-        the 'value' gets one point for passing each stage
-        """
-        build = self.get_build(tree, host, compiler, rev_seq)
-        rev, rev_time = build.revision_details()
-        status_html = build.status()
-        return self.build_status_info_from_html(rev_seq, rev, status_html)
-
     def lcov_status(self, tree):
         """get status of build"""
         cachefile = os.path.join(self.cachedir, "lcov.%s.%s.status" % (
diff --git a/web/build.py b/web/build.py
index 29cb741..7090654 100755
--- a/web/build.py
+++ b/web/build.py
@@ -78,9 +78,33 @@ def build_link(myself, tree, host, compiler, rev, status):
         myself, tree, host, compiler, opt_rev, status)
 
 
+def html_build_status(status):
+    (cstatus, bstatus, istatus, tstatus, sstatus, other_failures) = status
+    def span(classname, contents):
+        return "<span class=\"%s\">%s</span>" % (classname, contents)
+
+    def span_status(st):
+        if st is None:
+            return span("status unknown", "?")
+        elif st == 0:
+            return span("status passed", "ok")
+        else:
+            return span("status failed", st)
+    ostatus = ""
+    if "panic" in other_failures:
+        ostatus += "/"+span("status panic", "PANIC")
+    if "disk full" in other_failures:
+        ostatus += "/"+span("status failed", "disk full")
+    if "timeout" in other_failures:
+        ostatus += "/"+span("status failed", "timeout")
+    if sstatus is not None:
+        ostatus += "/".span("status checker", sstatus)
+    return "%s/%s/%s/%s%s" % (span_status(cstatus), span_status(bstatus), span_status(istatus), span_status(tstatus), ostatus)
+
+
 def build_status(myself, tree, host, compiler, rev):
     build = db.get_build(tree, host, compiler, rev)
-    status = build.build_status()
+    status = html_build_status(build.status())
     return build_link(myself, tree, host, compiler, rev, status)
 
 
@@ -326,13 +350,13 @@ def show_oldrevs(myself, tree, host, compiler):
 
     lastrev = ""
     for rev in revs:
-        s = rev["STATUS"]
+        s = html_build_status(rev["STATUS"])
         revision = rev["REVISION"]
         s = s.replace(revision, "0")
         if s == lastrev:
             continue
         lastrev = s
-        ret+= "<tr><td>%s</td><td>%s</td></tr>" % (revision_link(myself, revision, tree), build_link(myself, tree, host, compiler, rev["REVISION"], rev["STATUS"]))
+        ret+= "<tr><td>%s</td><td>%s</td></tr>" % (revision_link(myself, revision, tree), build_link(myself, tree, host, compiler, rev["REVISION"], html_build_status(rev["STATUS"])))
 
     if lastrev != "":
         # Only print table if there was any actual data


-- 
build.samba.org


More information about the samba-cvs mailing list