[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Fri Nov 12 17:21:40 MST 2010
The branch, master has been updated
via a4a34ad Cope with import-and-analyse dry runs.
from fb29f3a Fix implementation of get_previous_revision.
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit a4a34ad0eef1d87c001840b24acb6d90ff8468ee
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sat Nov 13 01:22:21 2010 +0100
Cope with import-and-analyse dry runs.
-----------------------------------------------------------------------
Summary of changes:
buildfarm/data.py | 10 ++++++++++
buildfarm/tests/test_data.py | 9 +++++++++
import-and-analyse.py | 8 ++++++--
3 files changed, 25 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/buildfarm/data.py b/buildfarm/data.py
index 7e6497a..5518ce4 100644
--- a/buildfarm/data.py
+++ b/buildfarm/data.py
@@ -469,6 +469,9 @@ class BuildResultStore(object):
def get_previous_revision(self, tree, host, compiler, revision):
raise NoSuchBuildError(tree, host, compiler, revision)
+ def get_latest_revision(self, tree, host, compiler):
+ raise NoSuchBuildError(tree, host, compiler)
+
class CachingBuildResultStore(BuildResultStore):
@@ -514,6 +517,13 @@ class SQLCachingBuildResultStore(BuildResultStore):
raise NoSuchBuildError(tree, host, compiler, revision)
return row[0]
+ def get_latest_revision(self, tree, host, compiler):
+ cursor = self.db.execute("SELECT commit_revision FROM build WHERE tree = ? AND host = ? AND compiler = ? ORDER BY id DESC LIMIT 1", (tree, host, compiler))
+ row = cursor.fetchone()
+ if row is None:
+ raise NoSuchBuildError(tree, host, compiler)
+ return row[0]
+
def upload_build(self, build):
super(SQLCachingBuildResultStore, self).upload_build(build)
rev, timestamp = build.revision_details()
diff --git a/buildfarm/tests/test_data.py b/buildfarm/tests/test_data.py
index 60f6597..d432cfa 100755
--- a/buildfarm/tests/test_data.py
+++ b/buildfarm/tests/test_data.py
@@ -134,6 +134,8 @@ BUILD COMMIT REVISION: myrev
def test_get_previous_revision(self):
self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, "tdb", "charis", "cc", "12")
+ def test_get_latest_revision_none(self):
+ self.assertRaises(data.NoSuchBuildError, self.x.get_latest_revision, "tdb", "charis", "cc")
class BuildResultStoreTests(BuildFarmTestCase,BuildResultStoreTestBase):
@@ -181,6 +183,13 @@ BUILD COMMIT REVISION: myotherrev
self.assertRaises(data.NoSuchBuildError, self.x.get_previous_revision, "tdb", "charis", "cc", "myrev")
self.assertEquals("myrev", self.x.get_previous_revision("tdb", "charis", "cc", "myotherrev"))
+ def test_get_latest_revision(self):
+ path = self.create_mock_logfile("tdb", "charis", "cc", "22", contents="""
+BUILD COMMIT REVISION: myrev
+""")
+ self.x.upload_build(data.Build(None, path[:-4], "tdb", "charis", "cc"))
+ self.assertEquals("myrev", self.x.get_latest_revision("tdb", "charis", "cc"))
+
class BuildStatusFromLogs(testtools.TestCase):
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 726407e..fc24edf 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -99,8 +99,12 @@ for build in buildfarm.get_new_builds():
try:
prev_rev = buildfarm.builds.get_previous_revision(build.tree, build.host, build.compiler, rev)
except data.NoSuchBuildError:
- # Can't send a nastygram until there are 2 builds..
- continue
+ try:
+ # Perhaps this is a dry run and rev is not in the database yet?
+ prev_rev = buildfarm.builds.get_latest_revision(build.tree, build.host, build.compiler)
+ except data.NoSuchBuildError:
+ # Can't send a nastygram until there are 2 builds..
+ continue
else:
prev_build = buildfarm.get_build(build.tree, build.host, build.compiler, prev_rev)
check_and_send_mails(build.tree, build.host, build.compiler, build, prev_build)
--
build.samba.org
More information about the samba-cvs
mailing list