s3: Make open_file_ntcreate a bit easier to read
[kai/samba.git] / script / land-remote.py
index 8f87b87f684f8ad0b38e5068668772bfdb86361a..1009e6bd02bc3ee20143990057181936eb48f4d4 100755 (executable)
@@ -34,13 +34,19 @@ parser.add_option("--fail-slowly", help="continue running tests even after one h
 
 (opts, extra_args) = parser.parse_args()
 
+if opts.email is None and os.getenv("EMAIL") is not None:
+    opts.email = os.getenv("EMAIL")
+
+if opts.email:
+    print "Sending email to %s" % opts.email
+
 if not opts.foreground and not opts.email:
     print "Not running in foreground and --email not specified."
     sys.exit(1)
 
 if not opts.foreground and opts.push_master:
-    print "Unable to push to master when not running in foreground."
-    sys.exit(1)
+    print "Pushing to master, forcing run in foreground."
+    opts.foreground = True
 
 if not opts.remote_repo:
     print "%s$ mktemp -d" % opts.host
@@ -50,8 +56,9 @@ if not opts.remote_repo:
         sys.exit(1)
     remote_repo = stdout.rstrip()
     print "Remote tempdir: %s" % remote_repo
-    # Bootstrap, git.samba.org is close to sn-devel
-    remote_args = ["git", "clone", samba_master, remote_repo]
+    # Bootstrap, git.samba.org is usually more easily accessible.
+    #remote_args = ["git", "clone", samba_master, remote_repo]
+    remote_args = ["if [ -d /data/git/samba.git ]; then git clone --shared /data/git/samba.git %s; else git clone --shared %s %s; fi" % (remote_repo, samba_master, remote_repo)]
     #remote_args = ["git", "init", remote_repo]
     print "%s$ %s" % (opts.host, " ".join(remote_args))
     subprocess.check_call(["ssh", opts.host] + remote_args)
@@ -68,6 +75,11 @@ args = ["git", "push", "--force", "git+ssh://%s/%s" % (opts.host, remote_repo),
 print "$ " + " ".join(args)
 subprocess.check_call(args)
 remote_args = ["cd", remote_repo, ";", "git", "checkout", "land", ";", "python", "-u", "./script/land.py", "--repository=%s" % remote_repo]
+
+if (opts.email and not (opts.foreground or opts.pushto or opts.push_master)):
+    # Force always emailing if there's nothing else to do
+    opts.always_email = True
+
 if opts.email:
     remote_args.append("--email=%s" % opts.email)
 if opts.always_email:
@@ -92,6 +104,8 @@ if opts.pushto:
     remote_args.append("--pushto=%s" % opts.pushto)
 if opts.push_master:
     remote_args.append("--push-master")
+if opts.fail_slowly:
+    remote_args.append("--fail-slowly")
 
 remote_args += extra_args
 print "%s$ %s" % (opts.host, " ".join(remote_args))