[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Mon Nov 8 14:56:23 MST 2010
The branch, master has been updated
via 8fa1f09 Simplify build_status() code. Return all found revisions in revision_details().
from 0367b80 Force the string conversion to avoid write() argument must be string error
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8fa1f097b77493aaefb6e792f5ab97f666c5badc
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Nov 8 22:57:02 2010 +0100
Simplify build_status() code. Return all found revisions in revision_details().
-----------------------------------------------------------------------
Summary of changes:
buildfarm/data.py | 24 ++++++++++++++----------
buildfarm/tests/test_data.py | 4 ++--
web/build.py | 21 ++++++++++++---------
3 files changed, 28 insertions(+), 21 deletions(-)
Changeset truncated at 500 lines:
diff --git a/buildfarm/data.py b/buildfarm/data.py
index d5e936a..5fe1fea 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -196,20 +196,21 @@ class Build(object):
file = self._store.build_fname(self.tree, self.host, self.compiler, self.rev)
revid = None
+ commit_revid = None
timestamp = None
f = open("%s.log" % file, 'r')
try:
for l in f.readlines():
if l.startswith("BUILD COMMIT REVISION: "):
- revid = l.split(":", 1)[1].strip()
- elif l.startswith("BUILD REVISION: ") and not revid:
+ commit_revid = l.split(":", 1)[1].strip()
+ elif l.startswith("BUILD REVISION: "):
revid = l.split(":", 1)[1].strip()
elif l.startswith("BUILD COMMIT TIME"):
timestamp = l.split(":", 1)[1].strip()
finally:
f.close()
- return (revid, timestamp)
+ return (revid, commit_revid, timestamp)
def status(self):
"""get status of build
@@ -261,15 +262,18 @@ class CachingBuild(Build):
# the ctime/mtime asymmetry is needed so we don't get fooled by
# the mtime update from rsync
if st2 and st1.st_ctime <= st2.st_mtime:
- (revid, timestamp) = util.FileLoad("%s.revision" % cachef).split(":", 1)
+ (revid, commit_revid, timestamp) = util.FileLoad("%s.revision" % cachef).split(":", 2)
if timestamp == "":
- return (revid, None)
- else:
- return (revid, timestamp)
- (revid, timestamp) = super(CachingBuild, self).revision_details()
+ timestamp = None
+ if revid == "":
+ revid = None
+ if commit_revid == "":
+ commit_revid = None
+ return (revid, commit_revid, timestamp)
+ (revid, commit_revid, timestamp) = super(CachingBuild, self).revision_details()
if not self._store.readonly:
- util.FileSave("%s.revision" % cachef, "%s:%s" % (revid, timestamp or ""))
- return (revid, timestamp)
+ util.FileSave("%s.revision" % cachef, "%s:%s:%s" % (revid, commit_revid or "", timestamp or ""))
+ return (revid, commit_revid, timestamp)
def err_count(self):
file = self._store.build_fname(self.tree, self.host, self.compiler, self.rev)
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 3043b4c..6184a64 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -151,7 +151,7 @@ BUILD REVISION: 42
BUILD COMMIT TIME: 3 August 2010
""")
build = self.x.get_build("tdb", "charis", "cc")
- self.assertEquals(("43", "3 August 2010"), build.revision_details())
+ self.assertEquals(("42", "43", "3 August 2010"), build.revision_details())
def test_revision_details_no_timestamp(self):
self.create_mock_logfile("tdb", "charis", "cc", contents="""
@@ -160,7 +160,7 @@ BUILD REVISION: 42
BLA
""")
build = self.x.get_build("tdb", "charis", "cc")
- self.assertEquals(("43", None), build.revision_details())
+ self.assertEquals(("42", "43", None), build.revision_details())
def test_err_count(self):
self.create_mock_logfile("tdb", "charis", "cc")
diff --git a/web/build.py b/web/build.py
index 8f8a293..48239aa 100755
--- a/web/build.py
+++ b/web/build.py
@@ -112,11 +112,10 @@ def html_build_status(status):
return bstatus + ostatus
-def build_status(myself, tree, host, compiler, rev=None):
- build = db.get_build(tree, host, compiler, rev)
+def build_status_html(myself, build):
rawstatus = build.status()
status = html_build_status(rawstatus)
- return build_link(myself, tree, host, compiler, rev, status)
+ return build_link(myself, build.tree, build.host, build.compiler, build.rev, status)
def red_age(age):
@@ -168,7 +167,7 @@ def view_summary(myself, output_type):
for tree in trees:
try:
build = db.get_build(tree, host.name, compiler)
- status = build_status(myself, tree, host.name, compiler)
+ status = build_status_html(myself, build)
except data.NoSuchBuildError:
continue
age_mtime = build.age_mtime()
@@ -292,14 +291,16 @@ def view_recent_builds(myself, tree, sort_by):
for host in hosts.values():
for compiler in compilers:
try:
- status = build_status(myself, tree, host.name, compiler)
build = db.get_build(tree, host.name, compiler)
+ status = build_status_html(myself, build)
except data.NoSuchBuildError:
pass
else:
age_mtime = build.age_mtime()
age_ctime = build.age_ctime()
- (revision, revision_time) = build.revision_details()
+ (revision, commit_revision, revision_time) = build.revision_details()
+ if commit_revision:
+ revision = commit_revision
if revision:
all_builds.append([age_ctime, str(host.platform), "<a href='%s?function=View+Host;host=%s;tree=%s;compiler=%s#%s'>%s</a>" % (myself, host.name, tree, compiler, host.name, host.name), compiler, tree, status, revision_link(myself, revision, tree), revision_time])
@@ -400,8 +401,10 @@ def view_build(myself, tree, host, compiler, rev, plain_logs=False):
config = ""
build = db.get_build(tree, host, compiler, rev)
age_mtime = build.age_mtime()
- (revision, revision_time) = build.revision_details()
- status = build_status(myself, tree, host, compiler, rev)
+ (revision, commit_revision, revision_time) = build.revision_details()
+ if commit_revision:
+ revision = commit_revision
+ status = build_status_html(myself, build)
if rev:
assert re.match("^[0-9a-fA-F]*$", rev)
@@ -532,7 +535,7 @@ def view_host(myself, output_type, *requested_hosts):
age_mtime = build.age_mtime()
age_ctime = build.age_ctime()
warnings = build.err_count()
- status = build_status(myself, tree, host, compiler)
+ status = build_status_html(myself, build)
if row == 0:
if output_type == 'text':
yield "%-12s %-10s %-10s %-10s %-10s\n" % (
--
build.samba.org
More information about the samba-cvs
mailing list