The branch, master has been updated via 2b9b526 Fix a bug via 5c85dfd Make status easily marshallable and extensible, use the new format from 5fc89e9 try to force buildsamba02 to do what we want
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 2b9b526a47a334e37bb5e40d6c07f7e9a998f548 Author: Matthieu Patou <m...@matws.net> Date: Sat Nov 6 01:28:13 2010 +0300 Fix a bug commit 5c85dfda386f72ba2bc7714d9ae71e05e353bd21 Author: Matthieu Patou <m...@matws.net> Date: Sat Nov 6 01:27:54 2010 +0300 Make status easily marshallable and extensible, use the new format ----------------------------------------------------------------------- Summary of changes: buildfarm/data.py | 37 ++++++++++++++++++++++++++++++++++--- web/build.py | 9 +++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/buildfarm/data.py b/buildfarm/data.py index 0593923..e2502d2 100644 --- a/buildfarm/data.py +++ b/buildfarm/data.py @@ -86,7 +86,8 @@ def build_status_from_logs(log, err): else: sstatus = None - return ((cstatus, bstatus, istatus, tstatus, sstatus), other_failures) + return {"config": cstatus, "build": bstatus, "install": istatus,\ + "test": tstatus, "checker": sstatus, "other": other_failures} def lcov_extract_percentage(text): @@ -261,6 +262,34 @@ class CachingBuild(Build): return ret + def unmarshall_status(self, cnt): + tab = cnt.split('\n') + hash = {} + for l in tab: + tab2 = l.split(':', 1) + if tab2[0] == "other": + tab3 = [] + if len(tab2) > 1: + tab3 = tab2[1].split('%') + hash[tab2[0]] = tab3 + else: + if tab2[1] == "None": + hash[tab2[0]] = tab2[1] + else: + hash[tab2[0]] = None + + return hash + + def marshall_status(self, val): + tab = [] + for k in val.keys(): + if k != "other": + tab.append("%s:%s" % (k, val[k])) + else: + tab.append("%s:%s" % (k, "%".join(val[k]))) + + return "\n".join(tab) + def status(self): file = self._store.build_fname(self.tree, self.host, self.compiler, self.rev) cachefile = self._store.cache_fname(self.tree, self.host, self.compiler, self.rev)+".status" @@ -274,12 +303,14 @@ class CachingBuild(Build): st2 = None if st2 and st1.st_ctime <= st2.st_mtime: - return util.FileLoad(cachefile) + cnt = util.FileLoad(cachefile) + return self.unmarshall_status(cnt) ret = super(CachingBuild, self).status() if not self._store.readonly: - util.FileSave(cachefile, ret) + cnt = self.marshall_status(ret) + util.FileSave(cachefile, cnt) return ret diff --git a/web/build.py b/web/build.py index e31871d..399e005 100755 --- a/web/build.py +++ b/web/build.py @@ -79,7 +79,12 @@ def build_link(myself, tree, host, compiler, rev, status): def html_build_status(status): - ((cstatus, bstatus, istatus, tstatus, sstatus), other_failures) = status + cstatus = status.get("config") + bstatus = status.get("build") + istatus = status.get("install") + tstatus = status.get("test") + sstatus = status.get("checker") + other_failures = status.get("other") def span(classname, contents): return "<span class=\"%s\">%s</span>" % (classname, contents) @@ -98,7 +103,7 @@ def html_build_status(status): if "timeout" in other_failures: ostatus += "/"+span("status failed", "timeout") if sstatus is not None: - ostatus += "/".span("status checker", sstatus) + ostatus += "/"+span("status checker", sstatus) return "%s/%s/%s/%s%s" % (span_status(cstatus), span_status(bstatus), span_status(istatus), span_status(tstatus), ostatus) -- build.samba.org