summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-09-25 15:30:13 -0700
committerAndrew Tridgell <tridge@samba.org>2010-09-26 01:21:49 +0000
commit91b62a274411477f67f50f0f653dd17bf1e65c1d (patch)
tree0e13bbb684d149ba18cb3aaca317c6b8de62534d
parentf7fb272e953b743ca9830618af9b1c290701ffec (diff)
downloadsamba-91b62a274411477f67f50f0f653dd17bf1e65c1d.tar.gz
samba-91b62a274411477f67f50f0f653dd17bf1e65c1d.tar.bz2
samba-91b62a274411477f67f50f0f653dd17bf1e65c1d.zip
autobuild: added a EDITOR script to mark successful autobuilds
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
-rwxr-xr-xscript/autobuild.py35
-rwxr-xr-xscript/commit_mark.sh9
2 files changed, 37 insertions, 7 deletions
diff --git a/script/autobuild.py b/script/autobuild.py
index a0954490fd..4a10092bce 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -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")
diff --git a/script/commit_mark.sh b/script/commit_mark.sh
new file mode 100755
index 0000000000..38328c4827
--- /dev/null
+++ b/script/commit_mark.sh
@@ -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