summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscript/autobuild-remote.py70
-rwxr-xr-xsource4/script/land-remote.py50
2 files changed, 70 insertions, 50 deletions
diff --git a/script/autobuild-remote.py b/script/autobuild-remote.py
new file mode 100755
index 0000000000..4abc8749ac
--- /dev/null
+++ b/script/autobuild-remote.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+# Ship a local branch to a remote host (sn-104?) over ssh and run autobuild in it.
+# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
+# Published under the GPL, v3 or later
+
+import optparse
+import subprocess
+import sys
+
+parser = optparse.OptionParser("autoland-remote [options]")
+parser.add_option("--remote-repo", help="Location of remote repository (default: temporary repository)", type=str, default=None)
+parser.add_option("--host", help="Host to land on (SSH connection string)", type=str, default="sn-devel-104.sn.samba.org")
+parser.add_option("--foreground", help="Don't daemonize", action="store_true", default=False)
+parser.add_option("--email", help="Email address to send build/test output to", type=str, default=None, metavar="EMAIL")
+parser.add_option("--rebase-master", help="rebase on master before testing", default=False, action='store_true')
+parser.add_option("--rebase", help="rebase on the given tree before testing", default=None, type='str')
+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("", "--fix-whitespace", help="fix whitespace on rebase",
+ default=False, action="store_true")
+
+(opts, args) = parser.parse_args()
+
+if not opts.foreground and not opts.email:
+ print "Not running in foreground and --email not specified."
+ sys.exit(1)
+
+if not opts.remote_repo:
+ print "%s$ mktemp -d" % opts.host
+ f = subprocess.Popen(["ssh", opts.host, "mktemp", "-d"], stdout=subprocess.PIPE)
+ (stdout, stderr) = f.communicate()
+ if f.returncode != 0:
+ sys.exit(1)
+ remote_repo = stdout.rstrip()
+ print "Remote tempdir: %s" % remote_repo
+ remote_args = ["git", "clone", "git://git.samba.org/samba.git", remote_repo]
+ #remote_args = ["git", "init", remote_repo]
+ print "%s$ %s" % (opts.host, " ".join(remote_args))
+ subprocess.check_call(["ssh", opts.host] + remote_args)
+else:
+ remote_repo = opts.remote_repo
+
+print "Pushing local branch"
+args = ["git", "push", "--force", "git+ssh://%s/%s" % (opts.host, remote_repo), "HEAD:HEAD"]
+print "$ " + " ".join(args)
+subprocess.check_call(args)
+remote_args = ["cd", remote_repo, "&&", "python", "./script/autobuild.py"]
+if opts.email:
+ remote_args.append("--email=%s" % opts.email)
+if not opts.foreground:
+ remote_args.append("--daemon")
+if opts.nocleanup:
+ remote_args.append("--nocleanup")
+if opts.fix_whitespace:
+ remote_args.append("--fix-whitespace")
+if opts.tail:
+ remote_args.append("--tail")
+if opts.keeplogs:
+ remote_args.append("--keeplogs")
+if opts.rebase_master:
+ remote_args.append("--rebase-master")
+if opts.rebase:
+ remote_args.append("--rebase=%s" % opts.rebase)
+if opts.passcmd:
+ remote_args.append("--passcmd=%s" % opts.passcmd)
+print "%s$ %s" % (opts.host, " ".join(remote_args))
+args = ["ssh", "-A", opts.host] + remote_args
+sys.exit(subprocess.call(args))
diff --git a/source4/script/land-remote.py b/source4/script/land-remote.py
deleted file mode 100755
index 3635e1b328..0000000000
--- a/source4/script/land-remote.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/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()
-
-if not opts.foreground and not opts.mail_to:
- print "Not running in foreground and --mail-to not specified."
- sys.exit(1)
-
-print "%s$ mktemp -d" % opts.host
-f = subprocess.Popen(["ssh", opts.host, "mktemp", "-d"], stdout=subprocess.PIPE)
-(stdout, stderr) = f.communicate()
-if f.returncode != 0:
- sys.exit(1)
-remote_tmpdir = stdout.rstrip()
-
-print "Remote tempdir: %s" % remote_tmpdir
-
-remote_args = ["git", "clone", "git://git.samba.org/samba.git", "%s/repo" % remote_tmpdir]
-print "%s$ %s" % (opts.host, " ".join(remote_args))
-subprocess.check_call(["ssh", opts.host] + remote_args)
-
-print "Pushing local branch"
-print "$ " + " ".join(args)
-subprocess.check_call(["git", "push", "--force", "git+ssh://%s/%s/repo" % (opts.host, remote_tmpdir), "HEAD:refs/heads/land"])
-remote_args = ["python", "%s/repo/source4/script/land.py" % remote_tmpdir]
-if opts.mail_to:
- remote_args.append("--mail-to=%s" % opts.mail_to)
-if not opts.foreground:
- remote_args.append("--daemon")
-if opts.dry_run:
- remote_args.append("--dry-run")
-remote_args.append("--branch=land")
-remote_args.append(os.path.join(remote_tmpdir, "repo"))
-print "%s$ %s" % (opts.host, " ".join(remote_args))
-args = ["ssh", "-A", opts.host] + remote_args
-sys.exit(subprocess.call(args))