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

Jelmer Vernooij jelmer at samba.org
Tue Nov 23 14:05:09 MST 2010


The branch, master has been updated
       via  26434f5 Remove build log from the upload directory when we're done.
       via  f1a1e73 Add test and test_result classes.
       via  59ef86e Add convenience method for host URIs.
       via  45b44da Add convenience function for getting at a build uri.
      from  d7ccd88 Fix parenthesis

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


- Log -----------------------------------------------------------------
commit 26434f52bbd5f143d58bab4c7d32e5b8be8e712a
Author: jelmer at samba.org <jelmer at samba.org>
Date:   Tue Nov 23 22:01:43 2010 +0100

    Remove build log from the upload directory when we're done.

commit f1a1e7358b2c95d263ef52582b40771c408dc0bd
Author: jelmer at samba.org <jelmer at samba.org>
Date:   Tue Nov 23 16:35:29 2010 +0100

    Add test and test_result classes.

commit 59ef86e4f70a2f33ebc04a496cdd9a521057494f
Author: jelmer at samba.org <jelmer at samba.org>
Date:   Tue Nov 23 15:42:59 2010 +0100

    Add convenience method for host URIs.

commit 45b44da0c25e126cd496216e046ff4e7fe36efe1
Author: jelmer at samba.org <jelmer at samba.org>
Date:   Tue Nov 23 15:41:34 2010 +0100

    Add convenience function for getting at a build uri.

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

Summary of changes:
 buildfarm/build.py        |   15 +++++++++++++++
 buildfarm/sqldb.py        |   35 ++++++++++++++++++++++++++++++++++-
 buildfarm/web/__init__.py |   14 ++++++++++----
 import-and-analyse.py     |   16 +++++++++-------
 mail-dead-hosts.py        |    6 +++---
 5 files changed, 71 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildfarm/build.py b/buildfarm/build.py
index 7f24a08..b0938dc 100644
--- a/buildfarm/build.py
+++ b/buildfarm/build.py
@@ -29,6 +29,21 @@ import re
 import time
 
 
+class Test(object):
+
+    def __init__(self, name):
+        self.name = name
+
+
+
+class TestResult(object):
+
+    def __init__(self, build, test, result):
+        self.build = build
+        self.test = test
+        self.result = result
+
+
 class BuildSummary(object):
 
     def __init__(self, host, tree, compiler, revision, status):
diff --git a/buildfarm/sqldb.py b/buildfarm/sqldb.py
index 8aa2cf8..bc1328f 100644
--- a/buildfarm/sqldb.py
+++ b/buildfarm/sqldb.py
@@ -26,6 +26,8 @@ from buildfarm.build import (
     BuildResultStore,
     BuildStatus,
     NoSuchBuildError,
+    Test,
+    TestResult,
     )
 from buildfarm.hostdb import (
     Host,
@@ -41,7 +43,7 @@ except ImportError:
     import sqlite3
 from storm.database import create_database
 from storm.expr import EXPR, FuncExpr, compile
-from storm.locals import Bool, Desc, Int, Unicode, RawStr
+from storm.locals import Bool, Desc, Int, RawStr, Reference, Unicode
 from storm.store import Store
 
 
@@ -325,6 +327,24 @@ class StormTree(Tree):
     scm = RawStr()
 
 
+class StormTest(Test):
+    __storm_table__ = "test"
+
+    id = Int(primary=True)
+    name = RawStr()
+
+
+class StormTestResult(TestResult):
+    __storm_table__ = "test_result"
+
+    id = Int(primary=True)
+    build_id = Int(name="build")
+    build = Reference(build_id, StormBuild)
+
+    test_id = Int(name="test")
+    test = Reference(test_id, StormTest)
+
+
 def setup_schema(db):
     db.execute("PRAGMA foreign_keys = 1;", noresult=True)
     db.execute("""
@@ -383,6 +403,19 @@ CREATE TABLE IF NOT EXISTS compiler (
     db.execute("""
 CREATE UNIQUE INDEX IF NOT EXISTS unique_compiler_name ON compiler(name);
 """, noresult=True)
+    db.execute("""
+CREATE TABLE IF NOT EXISTS test (
+    id integer primary key autoincrement,
+    name text not null);
+    """, noresult=True)
+    db.execute("CREATE UNIQUE INDEX IF NOT EXISTS test_name ON test(name);",
+        noresult=True)
+    db.execute("""CREATE TABLE IF NOT EXISTS test_result (
+        build int,
+        test int,
+        result int
+        );""", noresult=True)
+    db.execute("""CREATE UNIQUE INDEX IF NOT EXISTS build_test_result ON test_result(build, test);""", noresult=True)
 
 
 def memory_store():
diff --git a/buildfarm/web/__init__.py b/buildfarm/web/__init__.py
index bb2b2ff..55c2829 100755
--- a/buildfarm/web/__init__.py
+++ b/buildfarm/web/__init__.py
@@ -119,7 +119,7 @@ def html_build_status(status):
     return ret
 
 
-def build_link(myself, build):
+def build_uri(myself, build):
     params = {
         "host": build.host,
         "tree": build.tree,
@@ -128,12 +128,18 @@ def build_link(myself, build):
         }
     if build.revision:
         params["revision"] = build.revision
-    return "<a href='%s?function=View+Build;%s'>%s</a>" % (myself, ";".join(["%s=%s" % k for k in params.iteritems()]), html_build_status(build.status()))
+    return "%s?function=View+Build;%s'>%s</a>" % (myself, ";".join(["%s=%s" % k for k in params.iteritems()]))
+
+
+def build_link(myself, build):
+    return "<a href='%s'>%s</a>" % (build_uri(myself, build), html_build_status(build.status()))
+
 
+def host_uri(myself, host):
+    return "%s?function=View+Host;host=%s" % (myself, host)
 
 def host_link(myself, host):
-    return "<a href='%s?function=View+Host;host=%s'>%s</a>" % (
-        myself, host, host)
+    return "<a href='%s'>%s</a>" % (host_uri(myself, host), host)
 
 
 def revision_link(myself, revision, tree):
diff --git a/import-and-analyse.py b/import-and-analyse.py
index 3d54e65..e370ae3 100755
--- a/import-and-analyse.py
+++ b/import-and-analyse.py
@@ -15,6 +15,7 @@ from buildfarm.build import (
     NoSuchBuildError,
     )
 from buildfarm.sqldb import StormCachingBuildFarm
+from buildfarm.web import build_uri
 from email.mime.text import MIMEText
 import logging
 import optparse
@@ -31,8 +32,8 @@ buildfarm = StormCachingBuildFarm(timeout=40.0)
 smtp = smtplib.SMTP()
 smtp.connect()
 
-def check_and_send_mails(tree, host, compiler, cur, old):
-    t = buildfarm.trees[tree]
+def check_and_send_mails(cur, old):
+    t = buildfarm.trees[cur.tree]
 
     cur_rev = cur.revision_details()
     cur_status = cur.status()
@@ -67,13 +68,13 @@ Tree %(tree)s is %(scm)s branch %(branch)s.
 Build status for new revision %(cur_rev)s is %(cur_status)s
 Build status for old revision %(old_rev)s was %(old_status)s
 
-See http://build.samba.org/?function=View+Build;host=%(host)s;tree=%(tree)s;compiler=%(compiler)s
+See %s 
 
 The build may have been broken by one of the following commits:
 
 %(change_log)s
     """ % {
-        "tree": tree, "host": host, "compiler": compiler,
+        "tree": cur.tree, "host": cur.host, "compiler": cur.compiler,
         "change_log": change_log,
         "scm": t.scm,
         "branch": t.branch,
@@ -81,10 +82,11 @@ The build may have been broken by one of the following commits:
         "old_rev": old_rev,
         "cur_status": cur_status,
         "old_status": 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" % (tree, t.branch, host, 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, cur_rev)
     msg["From"] = "\"Build Farm\" <build at samba.org>"
     msg["To"] = ",".join(recipients)
     if not opts.dry_run:
@@ -132,11 +134,11 @@ for build in buildfarm.get_new_builds():
             if opts.verbose >= 1:
                 print "Previous build %s has disappeared" % prev_build
         else:
-            check_and_send_mails(build.tree, build.host, build.compiler, build, prev_build)
+            check_and_send_mails(build, prev_build)
 
     if not opts.dry_run:
         # When the new web script is introduced, kill the build here:
-        # build.remove()
+        build.remove()
         buildfarm.commit()
 
 smtp.quit()
diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 35777f5..22f7bca 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -18,6 +18,7 @@
 #
 
 from buildfarm.sqldb import StormCachingBuildFarm
+from buildfarm.web import host_uri
 import optparse
 import smtplib
 from email.MIMEText import MIMEText
@@ -41,7 +42,7 @@ for host in hosts:
 
     body = """
 Your host %s has been part of the Samba Build farm, hosted
-at http://build.samba.org.
+at http://build.samba.org/.
 
 Sadly however we have not heard from it since %s.
 
@@ -53,13 +54,12 @@ If you no longer wish your host to participate in the Samba Build
 Farm, then please let us know so we can remove its records.
 
 You can see the summary for your host at:
-http://build.samba.org/?function=View+Host;host=%s
 
 Thanks,
 
 The Build Farm administration team.
 
-""" % (host.name, last_update, host.name)
+""" % (host.name, last_update, host_uri("http://build.samba.org/build.cgi", host.name))
 
     msg = MIMEText(body)
 


-- 
build.samba.org


More information about the samba-cvs mailing list