1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

autobuild: added a EDITOR script to mark successful autobuilds

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Tridgell 2010-09-25 15:30:13 -07:00
parent f7fb272e95
commit 91b62a2744
2 changed files with 37 additions and 7 deletions

View File

@ -64,6 +64,9 @@ class builder:
'''handle build of one directory'''
def __init__(self, name, sequence):
self.name = name
self.dir = self.name
if name == 'pass' or name == 'fail':
self.dir = "."
self.tag = self.name.replace('/', '_')
self.sequence = sequence
self.next = 0
@ -93,7 +96,7 @@ class builder:
self.cmd = self.sequence[self.next].replace("${PREFIX}", "--prefix=%s" % self.prefix)
print '%s: Running %s' % (self.name, self.cmd)
cwd = os.getcwd()
os.chdir("%s/%s" % (self.sdir, self.name))
os.chdir("%s/%s" % (self.sdir, self.dir))
self.proc = Popen(self.cmd, shell=True,
stdout=self.stdout, stderr=self.stderr, stdin=self.stdin)
os.chdir(cwd)
@ -105,6 +108,10 @@ class buildlist:
def __init__(self, tasklist, tasknames):
self.tlist = []
self.tail_proc = None
if tasknames == ['pass']:
tasks = { 'pass' : [ '/bin/true' ]}
if tasknames == ['fail']:
tasks = { 'fail' : [ '/bin/false' ]}
if tasknames == []:
tasknames = tasklist
for n in tasknames:
@ -171,6 +178,8 @@ class buildlist:
def cleanup():
if options.nocleanup:
return
print("Cleaning up ....")
for d in cleanup_list:
run_cmd("rm -rf %s" % d)
@ -197,21 +206,30 @@ def rebase_tree(url):
run_cmd("git fetch master", show=True, dir=test_master)
run_cmd("git rebase master/master", show=True, dir=test_master)
def push_to(url):
print("Pushing to %s" % url)
if options.mark:
run_cmd("EDITOR=script/commit_mark.sh git commit --amend -c HEAD", dir=test_master)
run_cmd("git remote add -t master pushto %s" % url, show=True, dir=test_master)
run_cmd("git push pushto +HEAD:master", show=True, dir=test_master)
def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER'))
def_passcmd = os.getenv("AUTOBUILD_PASSCMD",
"git push %s/master-passed +HEAD:master" % os.getenv("HOME"))
parser = OptionParser()
parser.add_option("", "--tail", help="show output while running", default=False, action="store_true")
parser.add_option("", "--keeplogs", help="keep logs", default=False, action="store_true")
parser.add_option("", "--nocleanup", help="don't remove test tree", default=False, action="store_true")
parser.add_option("", "--testbase", help="base directory to run tests in (default %s)" % def_testbase,
default=def_testbase)
parser.add_option("", "--passcmd", help="command to run on success (default %s)" % def_passcmd,
default=def_passcmd)
parser.add_option("", "--passcmd", help="command to run on success", default=None)
parser.add_option("", "--verbose", help="show all commands as they are run",
default=False, action="store_true")
parser.add_option("", "--rebase", help="rebase on the given tree before testing",
default=None, type='str')
parser.add_option("", "--pushto", help="push to a git url on success",
default=None, type='str')
parser.add_option("", "--mark", help="add a Tested-By signoff before pushing",
default=False, action="store_true")
(options, args) = parser.parse_args()
@ -255,8 +273,11 @@ if options.tail:
if status == 0:
print errstr
print("Running passcmd: %s" % options.passcmd)
run_cmd(options.passcmd, dir=test_master)
if options.passcmd is not None:
print("Running passcmd: %s" % options.passcmd)
run_cmd(options.passcmd, dir=test_master)
if options.pushto is not None:
push_to(options.pushto)
if options.keeplogs:
blist.tarlogs("logs.tar.gz")
print("Logs in logs.tar.gz")

9
script/commit_mark.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
# add a autobuild message to the HEAD commit
fullname=$(getent passwd $USER | cut -d: -f5| cut -d',' -f1)
cat <<EOF >> "$1"
Autobuild-User: $fullname <$USER@samba.org>
Autobuild-Date: $(date) on $(hostname)
EOF
exit 0