land: Add --revision argument.
[ddiss/samba.git] / script / autobuild.py
index 4e3bc5101f0eed70a9eafed026c0f357d80bdade..a0c2d9f4e664bd9cd3fc76cc8ca60914f7403294 100755 (executable)
@@ -22,12 +22,12 @@ tasks = {
                   ("make basics", "make basics", "text/plain"),
                   ("make", "make -j 4 everything", "text/plain"), # don't use too many processes
                   ("install", "make install", "text/plain"),
-                  ("test", "TDB_NO_FSYNC=1 make subunit-test FAIL_IMMEDIATELY=1", "text/x-subunit") ],
+                  ("test", "TDB_NO_FSYNC=1 make test FAIL_IMMEDIATELY=1", "text/plain") ],
 
     "source4" : [ ("configure", "./configure.developer ${PREFIX}", "text/plain"),
                   ("make", "make -j", "text/plain"),
                   ("install", "make install", "text/plain"),
-                  ("test", "TDB_NO_FSYNC=1 make subunit-test FAIL_IMMEDIATELY=1", "text/x-subunit") ],
+                  ("test", "TDB_NO_FSYNC=1 make test FAIL_IMMEDIATELY=1", "text/plain") ],
 
     "source4/lib/ldb" : [ ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"),
                           ("make", "make -j", "text/plain"),
@@ -58,7 +58,8 @@ tasks = {
                      ("test", "make test", "text/plain"), ],
 }
 
-retry_task = [ '''set -e
+retry_task = [ ( "retry",
+                 '''set -e
                 git remote add -t master master %s
                 git fetch master
                 while :; do
@@ -68,7 +69,7 @@ retry_task = [ '''set -e
                   git describe master/master > master.desc
                   diff old_master.desc master.desc
                 done
-               ''' % samba_master]
+               ''' % samba_master, "test/plain" ) ]
 
 def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True):
     if show is None:
@@ -123,8 +124,8 @@ class builder(object):
             return
         (self.stage, self.cmd, self.output_mime_type) = self.sequence[self.next]
         self.cmd = self.cmd.replace("${PREFIX}", "--prefix=%s" % self.prefix)
-        if self.output_mime_type == "text/x-subunit":
-            self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit"))
+#        if self.output_mime_type == "text/x-subunit":
+#            self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit"))
         print '%s: [%s] Running %s' % (self.name, self.stage, self.cmd)
         cwd = os.getcwd()
         os.chdir("%s/%s" % (self.sdir, self.dir))
@@ -199,7 +200,7 @@ class buildlist(object):
             if options.retry and self.need_retry:
                 self.kill_kids()
                 print("retry needed")
-                return (0, "retry")
+                return (0, None, None, None, "retry")
             if b is None:
                 break
             if os.WIFSIGNALED(b.status) or os.WEXITSTATUS(b.status) != 0:
@@ -214,6 +215,7 @@ class buildlist(object):
         for b in self.tlist:
             tar.add(b.stdout_path, arcname="%s.stdout" % b.tag)
             tar.add(b.stderr_path, arcname="%s.stderr" % b.tag)
+        tar.add("autobuild.log")
         tar.close()
 
     def remove_logs(self):
@@ -342,11 +344,19 @@ You can see logs of the failed task here:
   http://git.samba.org/%s/samba-autobuild/%s.stdout
   http://git.samba.org/%s/samba-autobuild/%s.stderr
 
+A summary of the autobuild process is here:
+
+  http://git.samba.org/%s/samba-autobuild/autobuild.log
+
 or you can get full logs of all tasks in this job here:
 
   http://git.samba.org/%s/samba-autobuild/logs.tar.gz
 
-''' % (failed_task, errstr, user, failed_tag, user, failed_tag, user)
+The top commit for the tree that was built was:
+
+%s
+
+''' % (failed_task, errstr, user, failed_tag, user, failed_tag, user, user, top_commit_msg)
     msg = MIMEText(text)
     msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage)
     msg['From'] = 'autobuild@samba.org'
@@ -374,7 +384,14 @@ you can get full logs of all tasks in this job here:
 
   http://git.samba.org/%s/samba-autobuild/logs.tar.gz
 
-''' % (user,)
+''' % user
+
+    text += '''
+The top commit for the tree that was built was:
+
+%s
+''' % top_commit_msg
+
     msg = MIMEText(text)
     msg['Subject'] = 'autobuild success'
     msg['From'] = 'autobuild@samba.org'
@@ -399,6 +416,9 @@ gitroot = find_git_root()
 if gitroot is None:
     raise Exception("Failed to find git root")
 
+# get the top commit message, for emails
+top_commit_msg = run_cmd("git log -1", dir=gitroot, output=True)
+
 try:
     os.makedirs(testbase)
 except Exception, reason: