[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Sun Nov 21 14:36:31 MST 2010
The branch, master has been updated
via a5fd44e Make the fix script update revision details.
from 62a518e Look for timeouts harder.
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a5fd44e3535a5091bbae130704326ed2eb986fd5
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Nov 21 22:35:31 2010 +0100
Make the fix script update revision details.
-----------------------------------------------------------------------
Summary of changes:
buildfarm/data.py | 32 +++++++++++++++++-------------
tools/fix-status.py | 24 -----------------------
tools/fix.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+), 38 deletions(-)
delete mode 100644 tools/fix-status.py
create mode 100755 tools/fix.py
Changeset truncated at 500 lines:
diff --git a/buildfarm/data.py b/buildfarm/data.py
index d1b8f17..90345f8 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -45,7 +45,7 @@ BuildStageResult = collections.namedtuple("BuildStageResult", "name result")
class MissingRevisionInfo(Exception):
"""Revision info could not be found in the build log."""
- def __init__(self, build):
+ def __init__(self, build=None):
self.build = build
@@ -199,6 +199,19 @@ def build_status_from_logs(log, err):
return ret
+def revision_from_log(log):
+ revid = None
+ timestamp = None
+ for l in log:
+ if l.startswith("BUILD COMMIT REVISION: "):
+ revid = l.split(":", 1)[1].strip()
+ elif l.startswith("BUILD COMMIT TIME"):
+ timestamp = l.split(":", 1)[1].strip()
+ if revid is None:
+ raise MissingRevisionInfo()
+ return (revid, timestamp)
+
+
class NoSuchBuildError(Exception):
"""The build with the specified name does not exist."""
@@ -236,7 +249,9 @@ class Build(object):
return "<%s: %s on %s using %s>" % (self.__class__.__name__, self.tree, self.host, self.compiler)
def remove_logs(self):
- os.unlink(self.basename + ".log")
+ # In general, basename.log should *always* exist.
+ if os.path.exists(self.basename+".log"):
+ os.unlink(self.basename + ".log")
if os.path.exists(self.basename+".err"):
os.unlink(self.basename+".err")
@@ -286,23 +301,12 @@ class Build(object):
:return: Tuple with revision id and timestamp (if available)
"""
- revid = None
- timestamp = None
f = self.read_log()
try:
- for l in f:
- if l.startswith("BUILD COMMIT REVISION: "):
- revid = l.split(":", 1)[1].strip()
- elif l.startswith("BUILD COMMIT TIME"):
- timestamp = l.split(":", 1)[1].strip()
+ return revision_from_log(f)
finally:
f.close()
- if revid is None:
- raise MissingRevisionInfo(self)
-
- return (revid, timestamp)
-
def status(self):
"""get status of build
diff --git a/tools/fix-status.py b/tools/fix-status.py
deleted file mode 100644
index 958475f..0000000
--- a/tools/fix-status.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-
-from buildfarm.data import build_status_from_logs, LogFileMissing
-
-from buildfarm.sqldb import StormCachingBuildFarm, StormBuild
-
-x = StormCachingBuildFarm()
-
-store = x._get_store()
-for build in store.find(StormBuild, StormBuild.status_str == None):
- try:
- log = build.read_log()
- except LogFileMissing:
- log.remove()
- continue
- try:
- err = build.read_err()
- try:
- status = build_status_from_logs(log, err)
- finally:
- err.close()
- finally:
- log.close()
- build.status_str = status.__serialize__()
diff --git a/tools/fix.py b/tools/fix.py
new file mode 100755
index 0000000..c57cf6c
--- /dev/null
+++ b/tools/fix.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+
+import os
+import sys
+sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
+
+from buildfarm.data import (
+ build_status_from_logs,
+ LogFileMissing,
+ MissingRevisionInfo,
+ revision_from_log,
+ )
+
+from buildfarm.sqldb import StormCachingBuildFarm, StormBuild
+
+buildfarm = StormCachingBuildFarm()
+
+store = buildfarm._get_store()
+
+for build in store.find(StormBuild, StormBuild.status_str == None):
+ try:
+ log = build.read_log()
+ except LogFileMissing:
+ print "Killing build %r without status string or log." % build
+ log.remove()
+ continue
+ try:
+ err = build.read_err()
+ try:
+ status = build_status_from_logs(log, err)
+ finally:
+ err.close()
+ finally:
+ log.close()
+ build.status_str = status.__serialize__()
+ print "Updating status for %r" % build
+
+for build in store.find(StormBuild, StormBuild.revision == None):
+ try:
+ log = build.read_log()
+ except LogFileMissing:
+ print "Killing build %r without revision or log." % build
+ build.remove()
+ continue
+ try:
+ (revision, revision_time) = revision_from_log(log)
+ except MissingRevisionInfo:
+ continue
+ assert revision
+ build.revision = revision
+ print "Updating revision for %r" % build
+
+buildfarm.commit()
--
build.samba.org
More information about the samba-cvs
mailing list