[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Wed Apr 15 00:42:02 MDT 2015
The branch, master has been updated
via 15db9f6 autobuild: Add options to set mail host and send e-mail with logs
via bc5a4f5 autobuild: Do not consider IDL.pm and Expr.pm changes to make a build bad
via 1b0bfdf Improve output of check-clean-tree.sh script
via eeb90cf .gitignore: Ignore pidl/MYMETA.json
via d65675b autobuild: Do not wait when running just one target
from 9d695c7 Fix incorrect order of arguments in error string
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 15db9f6a2e143376db707b0426c5daf1746d144b
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Apr 14 17:18:02 2015 +1200
autobuild: Add options to set mail host and send e-mail with logs
This helps when running the script in a cloud instance as
it is cheapest to shut it down once run
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Wed Apr 15 08:41:37 CEST 2015 on sn-devel-104
commit bc5a4f5227917e05a8fc4922f9148b7c5a826a2c
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Apr 14 12:19:56 2015 +1200
autobuild: Do not consider IDL.pm and Expr.pm changes to make a build bad
This allows a different yapp to be installed on the build host without failing
the whole autobuild
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
commit 1b0bfdf64f40fd743c8257ebe8f2f82478c95dbb
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Apr 14 12:00:36 2015 +1200
Improve output of check-clean-tree.sh script
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
commit eeb90cfea2d5615ec3721387fba560a6663a3aaf
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Apr 14 12:03:43 2015 +1200
.gitignore: Ignore pidl/MYMETA.json
This is generated by newer versions of MakeMaker
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
commit d65675b2dfc319fa9991cbae085939000bd06b58
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Apr 14 11:59:57 2015 +1200
autobuild: Do not wait when running just one target
This avoids having to remember to specify AUTOBUILD_RANDOM_SLEEP_OVERRIDE manually
Signed-off-by: Andrew Bartlett <abartlet at samba.org>
Reviewed-by: Jelmer Vernooij <jelmer at samba.org>
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 1 +
script/autobuild.py | 74 +++++++++++++++++++++++++++++++--------------
script/clean-source-tree.sh | 4 +--
3 files changed, 54 insertions(+), 25 deletions(-)
Changeset truncated at 500 lines:
diff --git a/.gitignore b/.gitignore
index aa51a37..a4c2a69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ pidl/cover_db
pidl/Makefile
pidl/pm_to_blib
pidl/MYMETA.yml
+pidl/MYMETA.json
packaging/RHEL-CTDB/samba.spec
packaging/RHEL/samba.spec
packaging/RHEL/makerpms.sh
diff --git a/script/autobuild.py b/script/autobuild.py
index 6e1e3e0..b2303f7 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -7,8 +7,13 @@ from subprocess import call, check_call,Popen, PIPE
import os, tarfile, sys, time
from optparse import OptionParser
import smtplib
+import email
from email.mime.text import MIMEText
+from email.mime.base import MIMEBase
+from email.mime.application import MIMEApplication
+from email.mime.multipart import MIMEMultipart
from distutils.sysconfig import get_python_lib
+import platform
# This speeds up testing remarkably.
os.environ['TDB_NO_FSYNC'] = '1'
@@ -150,6 +155,7 @@ tasks = {
("make", "make", "text/plain"),
("test", "make test", "text/plain"),
("install", "make install", "text/plain"),
+ ("checkout-yapp-generated", "git checkout lib/Parse/Pidl/IDL.pm lib/Parse/Pidl/Expr.pm", "text/plain"),
("check-clean-tree", "../script/clean-source-tree.sh", "text/plain"),
("clean", "make clean", "text/plain") ],
@@ -230,6 +236,11 @@ class buildlist(object):
self.retry = None
if tasknames == []:
tasknames = defaulttasks
+ else:
+ # If we are only running one test,
+ # do not sleep randomly to wait for it to start
+ os.environ['AUTOBUILD_RANDOM_SLEEP_OVERRIDE'] = '1'
+
for n in tasknames:
b = builder(n, tasks[n])
self.tlist.append(b)
@@ -455,6 +466,10 @@ parser.add_option("", "--retry", help="automatically retry if master changes",
default=False, action="store_true")
parser.add_option("", "--email", help="send email to the given address on failure",
type='str', default=None)
+parser.add_option("", "--email-from", help="send email from the given address",
+ type='str', default="autobuild at samba.org")
+parser.add_option("", "--email-server", help="send email via the given server",
+ type='str', default='localhost')
parser.add_option("", "--always-email", help="always send email, even on success",
action="store_true")
parser.add_option("", "--daemon", help="daemonize after initial setup",
@@ -463,6 +478,29 @@ parser.add_option("", "--branch", help="the branch to work on (default=master)",
default="master", type='str')
parser.add_option("", "--log-base", help="location where the logs can be found (default=cwd)",
default=gitroot, type='str')
+parser.add_option("", "--attach-logs", help="Attach logs to mails sent on success/failure?",
+ default=False, action="store_true")
+
+def send_email(subject, text, log_tar):
+ outer = MIMEMultipart()
+ outer['Subject'] = subject
+ outer['To'] = options.email
+ outer['From'] = options.email_from
+ outer['Date'] = email.utils.formatdate(localtime = True)
+ outer.preamble = 'Autobuild mails are now in MIME because we optionally attach the logs.\n'
+ outer.attach(MIMEText(text, 'plain'))
+ if options.attach_logs:
+ fp = open(log_tar, 'rb')
+ msg = MIMEApplication(fp.read(), 'gzip', email.encoders.encode_base64)
+ fp.close()
+ # Set the filename parameter
+ msg.add_header('Content-Disposition', 'attachment', filename=os.path.basename(log_tar))
+ outer.attach(msg)
+ content = outer.as_string()
+ s = smtplib.SMTP(options.email_server)
+ s.sendmail(options.email_from, [options.email], content)
+ s.set_debuglevel(1)
+ s.quit()
def email_failure(status, failed_task, failed_stage, failed_tag, errstr, log_base=None):
'''send an email to options.email about the failure'''
@@ -472,7 +510,7 @@ def email_failure(status, failed_task, failed_stage, failed_tag, errstr, log_bas
text = '''
Dear Developer,
-Your autobuild failed when trying to test %s with the following error:
+Your autobuild on %s failed when trying to test %s with the following error:
%s
the autobuild has been abandoned. Please fix the error and resubmit.
@@ -480,7 +518,7 @@ the autobuild has been abandoned. Please fix the error and resubmit.
A summary of the autobuild process is here:
%s/autobuild.log
-''' % (failed_task, errstr, log_base)
+''' % (platform.node(), failed_task, errstr, log_base)
if failed_task != 'rebase':
text += '''
@@ -498,15 +536,11 @@ The top commit for the tree that was built was:
%s
''' % (log_base, failed_tag, log_base, failed_tag, log_base, top_commit_msg)
- msg = MIMEText(text)
- msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage)
- msg['From'] = 'autobuild at samba.org'
- msg['To'] = options.email
-
- s = smtplib.SMTP()
- s.connect()
- s.sendmail(msg['From'], [msg['To']], msg.as_string())
- s.quit()
+
+ logs = os.path.join(gitroot, 'logs.tar.gz')
+ send_email('autobuild failure on %s for task %s during %s'
+ % (platform.node(), failed_task, failed_stage),
+ text, logs)
def email_success(log_base=None):
'''send an email to options.email about a successful build'''
@@ -516,9 +550,9 @@ def email_success(log_base=None):
text = '''
Dear Developer,
-Your autobuild has succeeded.
+Your autobuild on %s has succeeded.
-'''
+''' % platform.node()
if options.keeplogs:
text += '''
@@ -535,15 +569,9 @@ The top commit for the tree that was built was:
%s
''' % top_commit_msg
- msg = MIMEText(text)
- msg['Subject'] = 'autobuild success'
- msg['From'] = 'autobuild at samba.org'
- msg['To'] = options.email
-
- s = smtplib.SMTP()
- s.connect()
- s.sendmail(msg['From'], [msg['To']], msg.as_string())
- s.quit()
+ logs = os.path.join(gitroot, 'logs.tar.gz')
+ send_email('autobuild sucess on %s ' % platform.node(),
+ text, logs)
(options, args) = parser.parse_args()
@@ -616,7 +644,7 @@ if status == 0:
run_cmd(options.passcmd, dir=test_master)
if options.pushto is not None:
push_to(options.pushto, push_branch=options.branch)
- if options.keeplogs:
+ if options.keeplogs or options.attach_logs:
blist.tarlogs("logs.tar.gz")
print("Logs in logs.tar.gz")
if options.always_email:
diff --git a/script/clean-source-tree.sh b/script/clean-source-tree.sh
index d0107f6..ea9e6e3 100755
--- a/script/clean-source-tree.sh
+++ b/script/clean-source-tree.sh
@@ -5,8 +5,8 @@ N=`git clean -n | wc -l`
C=`git diff --stat HEAD | wc -l`
test x"$N" != x"0" && {
- echo "The tree has uncommitted changes!!! see stderr"
- echo "The tree has uncommitted changes!!!" >&2
+ echo "The tree has $N new uncommitted files!!! see stderr"
+ echo "The tree has $N new uncommitted files!!!" >&2
echo "git clean -n" >&2
git clean -n >&2
--
Samba Shared Repository
More information about the samba-cvs
mailing list