diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-09-21 15:54:34 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-09-21 15:54:34 -0700 |
commit | 93c95824c754384f12891f1c8daf527e178a2bff (patch) | |
tree | 0e5127d3dd2ed6950ba80b3ff35372eacdfceb3f | |
parent | fd25d67d0d7a0837dfcba882cf60700189a41f37 (diff) | |
download | samba-93c95824c754384f12891f1c8daf527e178a2bff.tar.gz samba-93c95824c754384f12891f1c8daf527e178a2bff.tar.bz2 samba-93c95824c754384f12891f1c8daf527e178a2bff.zip |
s4: Add script for landing a branch through a remote server, such as sn.
-rwxr-xr-x | source4/script/land-remote.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/script/land-remote.py b/source4/script/land-remote.py new file mode 100755 index 0000000000..2ac1eb6c1a --- /dev/null +++ b/source4/script/land-remote.py @@ -0,0 +1,40 @@ +#!/usr/bin/python +# Land a branch by building and testing it on sn-104 before landing it on master. +# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org> +# Published under the GPL, v3 or later + +import os +import optparse +import subprocess +import sys + +parser = optparse.OptionParser("land-remote [options]") +parser.add_option("--host", help="Host to land on (SSH connection string)", type=str, default="sn-devel-104.sn.samba.org") +parser.add_option("--dry-run", help="Dry run (don't actually land)", action="store_true", default=False) +parser.add_option("--foreground", help="Don't daemonize", action="store_true", default=False) +parser.add_option("--mail-to", help="Email address to send build/test output to", type=str, default=None, metavar="MAIL-TO") + +(opts, args) = parser.parse_args() + +f = subprocess.Popen(["ssh", opts.host, "mktemp", "-d"], stdout=subprocess.PIPE) +(stdout, stderr) = f.communicate() +remote_tmpdir = stdout.rstrip() + +print "Remote tempdir: %s" % remote_tmpdir + +if subprocess.call(["ssh", opts.host, "git", "clone", "git://git.samba.org/samba.git", "%s/repo" % remote_tmpdir]) != 0: + sys.exit(1) + +print "Pushing local branch" +subprocess.call(["git", "push", "--force", "git+ssh://%s/%s/repo" % (opts.host, remote_tmpdir), "HEAD:refs/heads/land"]) +args = ["ssh", "-A", opts.host, "python", "%s/repo/source4/script/land.py" % remote_tmpdir] +if opts.mail_to: + args.append("--mail-to=%s" % opts.mail_to) +if not opts.foreground: + args.append("--daemon") +if opts.dry_run: + args.append("--dry-run") +args.append("--branch=land") +args.append(os.path.join(remote_tmpdir, "repo")) +print "Running remotely: %s" % " ".join(args) +sys.exit(subprocess.call(args)) |