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

Jelmer Vernooij jelmer at samba.org
Sun Dec 19 17:18:57 MST 2010


The branch, master has been updated
       via  642e09c Move some of the build diff logic to the buildfarm package.
      from  2ec2d06 Add +recent-ids.

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


- Log -----------------------------------------------------------------
commit 642e09c0e2b37001c794feb1edfb9bc435cfcf94
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Dec 20 01:17:38 2010 +0100

    Move some of the build diff logic to the buildfarm package.

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

Summary of changes:
 buildfarm/build.py    |   23 +++++++++++++++++++++++
 import-and-analyse.py |   25 ++++++++++---------------
 2 files changed, 33 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/build.py b/buildfarm/build.py
index e8f9664..fae37a1 100644
--- a/buildfarm/build.py
+++ b/buildfarm/build.py
@@ -614,3 +614,26 @@ class BuildResultStore(object):
         if build is None:
             raise NoSuchBuildError(tree, host, compiler)
         return build
+
+
+class BuildDiff(object):
+    """Represents the difference between two builds."""
+
+    def __init__(self, tree, old, new):
+        self.tree = tree
+        self.old = old
+        self.new = new
+        self.new_rev = new.revision_details()
+        self.new_status = new.status()
+
+        self.old_rev = old.revision_details()
+        self.old_status = old.status()
+
+    def is_regression(self):
+        """Is there a regression in new build since old build?"""
+        return self.new_status.regressed_since(self.old_status)
+
+    def revisions(self):
+        """Returns the revisions introduced since old in new."""
+        branch = self.tree.get_branch()
+        return branch.log(from_rev=self.new.revision, exclude_revs=set([self.old.revision]))
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 9df77a3..375c4ba 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -11,6 +11,7 @@ on recent commits.
 """
 
 from buildfarm.build import (
+    BuildDiff,
     MissingRevisionInfo,
     NoSuchBuildError,
     )
@@ -37,23 +38,17 @@ smtp.connect()
 
 def check_and_send_mails(cur, old):
     t = buildfarm.trees[cur.tree]
+    diff = BuildDiff(t, old, cur)
 
-    cur_rev = cur.revision_details()
-    cur_status = cur.status()
-
-    old_rev = old.revision_details()
-    old_status = old.status()
-
-    if not cur_status.regressed_since(old_status):
+    if not diff.is_regression():
         if opts.verbose >= 3:
-            print "... hasn't regressed since %s: %s" % (old_rev, old_status)
+            print "... hasn't regressed since %s: %s" % (diff.old_rev, diff.old_status)
         return
 
-    branch = t.get_branch()
     recipients = set()
     change_log = ""
 
-    for rev in branch.log(from_rev=cur.revision, exclude_revs=set([old.revision])):
+    for rev in diff.revisions():
         recipients.add(rev.author)
         recipients.add(rev.committer)
         change_log += """
@@ -82,15 +77,15 @@ The build may have been broken by one of the following commits:
         "change_log": change_log,
         "scm": t.scm,
         "branch": t.branch,
-        "cur_rev": cur_rev,
-        "old_rev": old_rev,
-        "cur_status": cur_status,
-        "old_status": old_status,
+        "cur_rev": diff.new_rev,
+        "old_rev": diff.old_rev,
+        "cur_status": diff.new_status,
+        "old_status": diff.old_status,
         "build_link": build_uri("http://build.samba.org/build.cgi", cur)
         }
 
     msg = MIMEText(body)
-    msg["Subject"] = "BUILD of %s:%s BROKEN on %s with %s AT REVISION %s" % (cur.tree, t.branch, cur.host, cur.compiler, cur_rev)
+    msg["Subject"] = "BUILD of %s:%s BROKEN on %s with %s AT REVISION %s" % (cur.tree, t.branch, cur.host, cur.compiler, diff.new_rev)
     msg["From"] = "\"Build Farm\" <build at samba.org>"
     msg["To"] = ",".join(recipients)
     if not opts.dry_run:


-- 
build.samba.org


More information about the samba-cvs mailing list