script/autobuild.py: mv find_git_root and gitroot to top
[vlendec/samba-autobuild/.git] / script / autobuild.py
index e1aea054e1f761bd95abb613caae767abb4c074d..aac42f41176f22102b12c102f9e33108703956dc 100755 (executable)
@@ -31,6 +31,22 @@ os.environ["PYTHONUNBUFFERED"] = "1"
 # This speeds up testing remarkably.
 os.environ['TDB_NO_FSYNC'] = '1'
 
+
+def find_git_root():
+    '''get to the top of the git repo'''
+    p = os.getcwd()
+    while p != '/':
+        if os.path.isdir(os.path.join(p, ".git")):
+            return p
+        p = os.path.abspath(os.path.join(p, '..'))
+    return None
+
+
+gitroot = find_git_root()
+if gitroot is None:
+    raise Exception("Failed to find git root")
+
+
 cleanup_list = []
 
 builddirs = {
@@ -383,7 +399,7 @@ tasks = {
 
     "samba-systemkrb5": [
                       ("random-sleep", "script/random-sleep.sh 900 1500", "text/plain"),
-                      ("configure", "./configure.developer " + samba_configure_params + " --with-system-mitkrb5 --without-ad-dc", "text/plain"),
+                      ("configure", "./configure.developer " + samba_configure_params + " --with-system-mitkrb5 --with-experimental-mit-ad-dc", "text/plain"),
                       ("make", "make -j", "text/plain"),
                       # we currently cannot run a full make test, a limited list of tests could be run
                       # via "make test TESTS=sometests"
@@ -405,6 +421,7 @@ tasks = {
                       ("configure", "./configure.developer --picky-developer ${PREFIX} --with-profiling-data --disable-python --without-ad-dc", "text/plain"),
                       ("make", "make -j", "text/plain"),
                       ("install", "make install", "text/plain"),
+                      ("find-python", "script/find_python.sh ${PREFIX}", "text/plain"),
                       ("test", "make test-nopython", "text/plain"),
                       ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"),
                       ("clean", "make clean", "text/plain"),
@@ -439,6 +456,7 @@ tasks = {
                       ("configure", "PYTHON=python2 ./configure.developer --picky-developer ${PREFIX} --with-profiling-data --disable-python --without-ad-dc", "text/plain"),
                       ("make", "PYTHON=python2 make -j", "text/plain"),
                       ("install", "PYTHON=python2 make install", "text/plain"),
+                      ("find-python", "script/find_python.sh ${PREFIX}", "text/plain"),
                       ("test", "make test-nopython", "text/plain"),
                       ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"),
                       ("clean", "PYTHON=python2 make clean", "text/plain"),
@@ -581,20 +599,20 @@ class builder(object):
         self.stdout = open(self.stdout_path, 'w')
         self.stderr = open(self.stderr_path, 'w')
         self.stdin  = open("/dev/null", 'r')
-        self.sdir = "%s/%s" % (testbase, self.tag)
+        self.test_source_dir = "%s/%s" % (testbase, self.tag)
         self.prefix = "%s/%s" % (test_prefix, self.tag)
-        run_cmd("rm -rf %s" % self.sdir)
+        run_cmd("rm -rf %s" % self.test_source_dir)
         run_cmd("rm -rf %s" % self.prefix)
         if cp:
-            run_cmd("cp --recursive --link --archive %s %s" % (test_master, self.sdir), dir=test_master, show=True)
+            run_cmd("cp --recursive --link --archive %s %s" % (test_master, self.test_source_dir), dir=test_master, show=True)
         else:
-            run_cmd("git clone --recursive --shared %s %s" % (test_master, self.sdir), dir=test_master, show=True)
+            run_cmd("git clone --recursive --shared %s %s" % (test_master, self.test_source_dir), dir=test_master, show=True)
         self.start_next()
 
     def start_next(self):
         if self.next == len(self.sequence):
             if not options.nocleanup:
-                run_cmd("rm -rf %s" % self.sdir)
+                run_cmd("rm -rf %s" % self.test_source_dir)
                 run_cmd("rm -rf %s" % self.prefix)
             do_print('%s: Completed OK' % self.name)
             self.done = True
@@ -607,7 +625,7 @@ class builder(object):
 #        if self.output_mime_type == "text/x-subunit":
 #            self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit"))
         cwd = os.getcwd()
-        os.chdir("%s/%s" % (self.sdir, self.dir))
+        os.chdir("%s/%s" % (self.test_source_dir, self.dir))
         do_print('%s: [%s] Running %s in %r' % (self.name, self.stage, self.cmd, os.getcwd()))
         self.proc = Popen(self.cmd, shell=True,
                           close_fds=True,
@@ -673,7 +691,7 @@ class buildlist(object):
             self.retry = None
         for b in self.tlist:
             if b.proc is not None:
-                run_cmd("killbysubdir %s > /dev/null 2>&1" % b.sdir, checkfail=False)
+                run_cmd("killbysubdir %s > /dev/null 2>&1" % b.test_source_dir, checkfail=False)
                 b.proc.terminate()
                 b.proc.wait()
                 b.proc = None
@@ -768,16 +786,6 @@ def cleanup():
         run_cmd("rm -rf %s" % d)
 
 
-def find_git_root():
-    '''get to the top of the git repo'''
-    p = os.getcwd()
-    while p != '/':
-        if os.path.isdir(os.path.join(p, ".git")):
-            return p
-        p = os.path.abspath(os.path.join(p, '..'))
-    return None
-
-
 def daemonize(logfile):
     pid = os.fork()
     if pid == 0:  # Parent
@@ -859,10 +867,6 @@ def push_to(push_url, push_branch="master"):
 
 def_testbase = os.getenv("AUTOBUILD_TESTBASE", "/memdisk/%s" % os.getenv('USER'))
 
-gitroot = find_git_root()
-if gitroot is None:
-    raise Exception("Failed to find git root")
-
 parser = OptionParser()
 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")