land: Add --repository option.
authorJelmer Vernooij <jelmer@samba.org>
Fri, 1 Oct 2010 19:34:31 +0000 (21:34 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 2 Oct 2010 11:14:51 +0000 (13:14 +0200)
script/land-remote.py
script/land.py

index 4abc8749ac2f804107478c634b93106c9463ca50..eeedcadc1e08660b8cfdd0c6b4fd21698eb0d20e 100755 (executable)
@@ -12,6 +12,7 @@ parser.add_option("--remote-repo", help="Location of remote repository (default:
 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("--always-email", help="always send email, even on success", action="store_true")
 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)
@@ -49,6 +50,8 @@ subprocess.check_call(args)
 remote_args = ["cd", remote_repo, "&&", "python", "./script/autobuild.py"]
 if opts.email:
     remote_args.append("--email=%s" % opts.email)
+if opts.always_email:
+    remote_args.append("--always-email")
 if not opts.foreground:
     remote_args.append("--daemon")
 if opts.nocleanup:
index cf3e6488ac7e81640f2ed0198ee82b2a03550bb0..d44704c8794655df8a936d2c587f77d1639c938f 100755 (executable)
@@ -247,9 +247,8 @@ def cleanup():
         run_cmd("rm -rf %s" % d)
 
 
-def find_git_root():
+def find_git_root(p):
     '''get to the top of the git repo'''
-    p=os.getcwd()
     while p != '/':
         if os.path.isdir(os.path.join(p, ".git")):
             return p
@@ -306,6 +305,7 @@ def push_to(url):
 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("", "--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")
@@ -405,9 +405,14 @@ if options.retry:
 testbase = "%s/b%u" % (options.testbase, os.getpid())
 test_master = "%s/master" % testbase
 
-gitroot = find_git_root()
+if options.repository is not None:
+    repository = options.repository
+else:
+    repository = os.getcwd()
+
+gitroot = find_git_root(repository)
 if gitroot is None:
-    raise Exception("Failed to find git root")
+    raise Exception("Failed to find git root under %s" % repository)
 
 try:
     os.makedirs(testbase)