summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-10-03 00:50:53 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-10-03 05:25:18 +0200
commitf6b254c65d5e0cf33c56c666fb6bde1058288edf (patch)
tree3ec7f3bb538d2b1170247847c5209ed0e7ba9615 /script
parentd8e81a19de99c6784267d45843b8295b4e40fc7c (diff)
downloadsamba-f6b254c65d5e0cf33c56c666fb6bde1058288edf.tar.gz
samba-f6b254c65d5e0cf33c56c666fb6bde1058288edf.tar.bz2
samba-f6b254c65d5e0cf33c56c666fb6bde1058288edf.zip
land: Add --revision argument.
Diffstat (limited to 'script')
-rwxr-xr-xscript/land-remote.py11
-rwxr-xr-xscript/land.py26
2 files changed, 29 insertions, 8 deletions
diff --git a/script/land-remote.py b/script/land-remote.py
index 975427ba7d..4c65a917a9 100755
--- a/script/land-remote.py
+++ b/script/land-remote.py
@@ -19,6 +19,7 @@ parser.add_option("--passcmd", help="command to run on success", default=None)
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("--revision", help="revision to compile if not HEAD", default=None, type=str)
parser.add_option("--fix-whitespace", help="fix whitespace on rebase",
default=False, action="store_true")
parser.add_option("--fail-slowly", help="continue running tests even after one has already failed",
@@ -47,10 +48,15 @@ else:
remote_repo = opts.remote_repo
print "Pushing local branch"
-args = ["git", "push", "--force", "git+ssh://%s/%s" % (opts.host, remote_repo), "HEAD:land"]
+
+if opts.revision is not None:
+ revision = opts.revision
+else:
+ revision = "HEAD"
+args = ["git", "push", "--force", "git+ssh://%s/%s" % (opts.host, remote_repo), "%s:land" % revision]
print "$ " + " ".join(args)
subprocess.check_call(args)
-remote_args = ["cd", remote_repo, ";", "git", "checkout", "land", ";", "./script/land.py", "--repository=%s" % remote_repo]
+remote_args = ["cd", remote_repo, ";", "git", "checkout", "land", ";", "python", "-u", "./script/land.py", "--repository=%s" % remote_repo]
if opts.email:
remote_args.append("--email=%s" % opts.email)
if opts.always_email:
@@ -71,6 +77,7 @@ if opts.rebase:
remote_args.append("--rebase=%s" % opts.rebase)
if opts.passcmd:
remote_args.append("--passcmd=%s" % opts.passcmd)
+
remote_args += extra_args
print "%s$ %s" % (opts.host, " ".join(remote_args))
args = ["ssh", "-A", opts.host] + remote_args
diff --git a/script/land.py b/script/land.py
index 28769486e2..1b389d20a7 100755
--- a/script/land.py
+++ b/script/land.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python -u
+#!/usr/bin/env python
# run tests on all Samba subprojects and push to a git tree on success
# Copyright Andrew Tridgell 2010
# Copyright Jelmer Vernooij 2010
@@ -93,6 +93,12 @@ def run_cmd(cmd, dir=None, show=None, output=False, checkfail=True, shell=False)
return call(cmd, cwd=dir, shell=shell)
+def clone_gitroot(test_master, revision="HEAD"):
+ run_cmd(["git", "clone", "--shared", gitroot, test_master])
+ if revision != "HEAD":
+ run_cmd(["git", "checkout", revision])
+
+
class TreeStageBuilder(object):
"""Handle building of a particular stage for a tree.
"""
@@ -238,7 +244,7 @@ class TreeBuilder(object):
cleanup_list.append(self.prefix)
os.makedirs(self.sdir)
run_cmd(["rm", "-rf", self.sdir])
- run_cmd(["git", "clone", "--shared", gitroot, self.sdir])
+ clone_gitroot(self.sdir, revision)
self.start_next()
def start_next(self):
@@ -445,6 +451,7 @@ def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER')
parser = OptionParser()
parser.add_option("", "--repository", help="repository to run tests for", default=None, type=str)
+parser.add_option("", "--revision", help="revision to compile if not HEAD", default=None, type=str)
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")
@@ -505,7 +512,8 @@ 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)
+''' % (failed_task, errstr, user, failed_tag, user, failed_tag, user, user,
+ get_top_commit_msg(test_master))
msg = MIMEText(text)
msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage)
msg['From'] = 'autobuild@samba.org'
@@ -539,7 +547,7 @@ you can get full logs of all tasks in this job here:
The top commit for the tree that was built was:
%s
-''' % top_commit_msg
+''' % (get_top_commit_msg(test_master),)
msg = MIMEText(text)
msg['Subject'] = 'autobuild success'
@@ -571,7 +579,13 @@ if gitroot is None:
raise Exception("Failed to find git root under %s" % repository)
# get the top commit message, for emails
-top_commit_msg = run_cmd(["git", "log", "-1"], dir=gitroot, output=True)
+if options.revision is not None:
+ revision = options.revision
+else:
+ revision = "HEAD"
+
+def get_top_commit_msg(reporoot):
+ return run_cmd(["git", "log", "-1"], dir=reporoot, output=True)
try:
os.makedirs(testbase)
@@ -588,7 +602,7 @@ while True:
try:
run_cmd(["rm", "-rf", test_master])
cleanup_list.append(test_master)
- run_cmd(["git", "clone", "--shared", gitroot, test_master])
+ clone_gitroot(test_master, revision)
except:
cleanup()
raise