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

Jelmer Vernooij jelmer at samba.org
Fri Nov 12 11:54:15 MST 2010


The branch, master has been updated
       via  6b5ee74 Honor dry_run in import-and-analyse.
       via  0f899bb Simplify a bit.
       via  dd74e7b Add command line parsing to mail-dead-hosts.
      from  36bdf3c Support removing builds.

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


- Log -----------------------------------------------------------------
commit 6b5ee746808f98bffcdf8287a02af6c6673eb9e8
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Nov 12 19:55:06 2010 +0100

    Honor dry_run in import-and-analyse.

commit 0f899bb785925d073e4e6f8343b4ef5727fff042
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Nov 12 19:53:20 2010 +0100

    Simplify a bit.

commit dd74e7b3633093ca3e0d723ca9e53e28c83308f5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Nov 12 19:53:12 2010 +0100

    Add command line parsing to mail-dead-hosts.

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

Summary of changes:
 buildfarm/__init__.py |    2 +-
 import-and-analyse.py |   17 ++++++++---------
 mail-dead-hosts.py    |   10 +++++++---
 3 files changed, 16 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/__init__.py b/buildfarm/__init__.py
index d866db4..06b2d31 100644
--- a/buildfarm/__init__.py
+++ b/buildfarm/__init__.py
@@ -50,7 +50,7 @@ def read_trees_from_conf(path):
     """
     ret = {}
     cfp = ConfigParser.ConfigParser()
-    cfp.readfp(open(path))
+    cfp.read(path)
     for s in cfp.sections():
         ret[s] = Tree(name=s, **dict(cfp.items(s)))
     return ret
diff --git a/import-and-analyse.py b/import-and-analyse.py
index c468a82..f1b90f5 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -40,12 +40,8 @@ def check_and_send_mails(tree, host, compiler, cur, old):
     (old_rev, old_rev_timestamp) = old.revision_details()
     old_status = old.status()
 
-    if opts.dry_run:
-        print "rev=%s status=%s" % (cur_rev, cur_status)
-        print "old rev=%s status=%s" % (old_rev, old_status)
-
     if not cur_status.regressed_since(old_status):
-        if opts.dry_run:
+        if opts.verbose:
             print "the build didn't get worse since %r" % old_status
         return
 
@@ -83,14 +79,16 @@ The build may have been broken by one of the following commits:
     msg["Subject"] = "BUILD of %s:%s BROKEN on %s with %s AT REVISION %s" % (tree, t.branch, host, compiler, cur_rev)
     msg["From"] = "\"Build Farm\" <build at samba.org>"
     msg["To"] = ",".join(recipients.keys())
-    smtp.send(msg["From"], [msg["To"]], msg.as_string())
+    if not opts.dry_run:
+        smtp.send(msg["From"], [msg["To"]], msg.as_string())
 
 
 for build in buildfarm.get_new_builds():
-    if opts.verbose >= 2:
+    if opts.verbose >= 1:
         print "Processing %s..." % build
 
-    buildfarm.builds.upload_build(build)
+    if not opts.dry_run:
+        buildfarm.builds.upload_build(build)
 
     (rev, commit_rev, rev_timestamp) = build.revision_details()
 
@@ -103,6 +101,7 @@ for build in buildfarm.get_new_builds():
         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.remove()
+    if not opts.dry_run:
+        build.remove()
 
 smtp.quit()
diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 1a26264..1a73974 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -20,20 +20,24 @@
 from buildfarm import (
     BuildFarm,
     )
+import optparse
 import smtplib
 from email.MIMEText import MIMEText
 import time
 
+parser = optparse.OptionParser()
+parser.add_option("--dry-run", help="Don't actually send any emails.", action="store_true")
+(opts, args) = parser.parse_args()
+
 buildfarm = BuildFarm()
 db = buildfarm.hostdb
-dry_run = False
 
 hosts = db.dead_hosts(7 * 86400)
 for host in hosts:
     db.sent_dead_mail(host.name)
 
     if host.last_update:
-        last_update = time.strftime ("%a %b %e %H:%M:%S %Y", time.gmtime(host.last_update))
+        last_update = time.strftime("%a %b %e %H:%M:%S %Y", time.gmtime(host.last_update))
     else:
         last_update = "a long time"
 
@@ -66,7 +70,7 @@ The Build Farm administration team.
     msg["From"] = "\"Samba Build Farm\" <build at samba.org>"
     msg["To"] = "\"%s\" <%s>" % host.owner
 
-    if dry_run:
+    if opts.dry_run:
         print msg.as_string()
     else:
         s = smtplib.SMTP()


-- 
build.samba.org


More information about the samba-cvs mailing list