1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00

script/autobuild.py: add log_base variable to avoid hardcoded values

metze
This commit is contained in:
Stefan Metzmacher 2012-09-22 02:34:38 +02:00
parent 23dbf63e2d
commit 1362bb548c

View File

@ -488,10 +488,11 @@ parser.add_option("", "--daemon", help="daemonize after initial setup",
parser.add_option("", "--branch", help="the branch to work on (default=master)", parser.add_option("", "--branch", help="the branch to work on (default=master)",
default="master", type='str') default="master", type='str')
def email_failure(status, failed_task, failed_stage, failed_tag, errstr, log_base=None):
def email_failure(status, failed_task, failed_stage, failed_tag, errstr):
'''send an email to options.email about the failure''' '''send an email to options.email about the failure'''
user = os.getenv("USER") user = os.getenv("USER")
if log_base is None:
log_base = "http://git.samba.org/%s/samba-autobuild" % user
text = ''' text = '''
Dear Developer, Dear Developer,
@ -502,25 +503,25 @@ the autobuild has been abandoned. Please fix the error and resubmit.
A summary of the autobuild process is here: A summary of the autobuild process is here:
http://git.samba.org/%s/samba-autobuild/autobuild.log %s/autobuild.log
''' % (failed_task, errstr, user) ''' % (failed_task, errstr, log_base)
if failed_task != 'rebase': if failed_task != 'rebase':
text += ''' text += '''
You can see logs of the failed task here: You can see logs of the failed task here:
http://git.samba.org/%s/samba-autobuild/%s.stdout %s/%s.stdout
http://git.samba.org/%s/samba-autobuild/%s.stderr %s/%s.stderr
or you can get full logs of all tasks in this job here: or you can get full logs of all tasks in this job here:
http://git.samba.org/%s/samba-autobuild/logs.tar.gz %s/logs.tar.gz
The top commit for the tree that was built was: The top commit for the tree that was built was:
%s %s
''' % (user, failed_tag, user, failed_tag, user, top_commit_msg) ''' % (log_base, failed_tag, log_base, failed_tag, log_base, top_commit_msg)
msg = MIMEText(text) msg = MIMEText(text)
msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage) msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage)
msg['From'] = 'autobuild@samba.org' msg['From'] = 'autobuild@samba.org'
@ -531,9 +532,11 @@ The top commit for the tree that was built was:
s.sendmail(msg['From'], [msg['To']], msg.as_string()) s.sendmail(msg['From'], [msg['To']], msg.as_string())
s.quit() s.quit()
def email_success(): def email_success(log_base=None):
'''send an email to options.email about a successful build''' '''send an email to options.email about a successful build'''
user = os.getenv("USER") user = os.getenv("USER")
if log_base is None:
log_base = "http://git.samba.org/%s/samba-autobuild" % user
text = ''' text = '''
Dear Developer, Dear Developer,
@ -546,9 +549,9 @@ Your autobuild has succeeded.
you can get full logs of all tasks in this job here: you can get full logs of all tasks in this job here:
http://git.samba.org/%s/samba-autobuild/logs.tar.gz %s/logs.tar.gz
''' % user ''' % log_base
text += ''' text += '''
The top commit for the tree that was built was: The top commit for the tree that was built was: