phase1: support specifying repository source branch
[buildbot.git] / phase1 / master.cfg
index 1e8e54e0ac4a5041ff9de1083c4c462e5a757db5..750763ea877193fa9e3026ad4180b2e0669cdf90 100644 (file)
@@ -59,6 +59,10 @@ if ini.has_option("general", "expire"):
        tree_expire = ini.getint("general", "expire")
 
 repo_url = ini.get("repo", "url")
+repo_branch = "master"
+
+if ini.has_option("repo", "branch"):
+       repo_branch = ini.get_option("repo", "branch")
 
 rsync_bin_url = ini.get("rsync", "binary_url")
 rsync_bin_key = ini.get("rsync", "binary_password")
@@ -89,6 +93,7 @@ targets = [ ]
 
 if not os.path.isdir(home_dir+'/source.git'):
        subprocess.call(["git", "clone", "--depth=1", repo_url, home_dir+'/source.git'])
+       subprocess.call(["git", "checkout", repo_branch], cwd = home_dir+'/source.git')
 
 findtargets = subprocess.Popen([home_dir+'/dumpinfo.pl', 'targets'],
        stdout = subprocess.PIPE, cwd = home_dir+'/source.git')
@@ -264,7 +269,7 @@ for target in targets:
                ))
 
        # check out the source
-       factory.addStep(Git(repourl=repo_url, mode='update'))
+       factory.addStep(Git(repourl=repo_url, branch=repo_branch, mode='update'))
 
        factory.addStep(ShellCommand(
                name = "rmtmp",
@@ -355,7 +360,7 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
        factory.addStep(ShellCommand(
                name = "dldir",
                description = "Preparing dl/",
-               command = "mkdir -p $HOME/dl && ln -sf $HOME/dl ./dl",
+               command = "mkdir -p $HOME/dl && rm -rf ./dl && ln -sf $HOME/dl ./dl",
                logEnviron = False,
                want_stdout = False
        ))