phase1: use buildinfo instead of prepare
[buildbot.git] / phase1 / master.cfg
index fa1b6b041c9f3c55f92ceafe804b2d6e595673bc..6675f2570a7e64c405bf3cf6a6b452b6ef4b8c5c 100644 (file)
@@ -34,7 +34,7 @@ c['titleURL'] = ini.get("general", "title_url")
 # with an externally-visible host name which the buildbot cannot figure out
 # without some help.
 
-c['buildbotURL'] = ini.get("general", "buildbot_url")
+c['buildbotURL'] = ini.get("phase1", "buildbot_url")
 
 ####### BUILDSLAVES
 
@@ -45,15 +45,16 @@ from buildbot.buildslave import BuildSlave
 
 slave_port = 9989
 
-if ini.has_option("general", "port"):
-       slave_port = ini.getint("general", "port")
+if ini.has_option("phase1", "port"):
+       slave_port = ini.getint("phase1", "port")
 
 c['slaves'] = []
 NetLocks = dict()
 
 for section in ini.sections():
        if section.startswith("slave "):
-               if ini.has_option(section, "name") and ini.has_option(section, "password"):
+               if ini.has_option(section, "name") and ini.has_option(section, "password") and \
+                  (not ini.has_option(section, "phase") or ini.getint(section, "phase") == 1):
                        sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False, 'max_builds':1, 'shared_wd':False }
                        name = ini.get(section, "name")
                        password = ini.get(section, "password")
@@ -61,6 +62,8 @@ for section in ini.sections():
                        if ini.has_option(section, "builds"):
                                max_builds = ini.getint(section, "builds")
                                sl_props['max_builds'] = max_builds
+                               if max_builds == 1:
+                                       sl_props['shared_wd'] = True
                        if ini.has_option(section, "cleanup"):
                                sl_props['do_cleanup'] = ini.getboolean(section, "cleanup")
                        if ini.has_option(section, "dl_lock"):
@@ -108,14 +111,14 @@ config_seed = ""
 git_ssh = False
 git_ssh_key = None
 
-if ini.has_option("general", "expire"):
-       tree_expire = ini.getint("general", "expire")
+if ini.has_option("phase1", "expire"):
+       tree_expire = ini.getint("phase1", "expire")
 
-if ini.has_option("general", "other_builds"):
-       other_builds = ini.getint("general", "other_builds")
+if ini.has_option("phase1", "other_builds"):
+       other_builds = ini.getint("phase1", "other_builds")
 
-if ini.has_option("general", "cc_version"):
-       cc_version = ini.get("general", "cc_version").split()
+if ini.has_option("phase1", "cc_version"):
+       cc_version = ini.get("phase1", "cc_version").split()
        if len(cc_version) == 1:
                cc_version = ["eq", cc_version[0]]
 
@@ -127,8 +130,8 @@ if ini.has_option("general", "git_ssh_key"):
 else:
        git_ssh = False
 
-if ini.has_option("general", "config_seed"):
-       config_seed = ini.get("general", "config_seed")
+if ini.has_option("phase1", "config_seed"):
+       config_seed = ini.get("phase1", "config_seed")
 
 repo_url = ini.get("repo", "url")
 repo_branch = "master"
@@ -250,9 +253,11 @@ def IsMakeCleanRequested(pattern):
 
        return CheckCleanProperty
 
+def IsSharedWorkdir(step):
+       return bool(step.getProperty("shared_wd"))
+
 def IsCleanupRequested(step):
-       shared_wd = step.getProperty("shared_wd")
-       if shared_wd:
+       if IsSharedWorkdir(step):
                return False
        do_cleanup = step.getProperty("do_cleanup")
        if do_cleanup:
@@ -261,8 +266,7 @@ def IsCleanupRequested(step):
                return False
 
 def IsExpireRequested(step):
-       shared_wd = step.getProperty("shared_wd")
-       if shared_wd:
+       if IsSharedWorkdir(step):
                return False
        else:
                return not IsCleanupRequested(step)
@@ -463,6 +467,15 @@ for target in targets:
 
        factory = BuildFactory()
 
+       # setup shared work directory if required
+       factory.addStep(ShellCommand(
+               name = "sharedwd",
+               description = "Setting up shared work directory",
+               command = 'test -L "$PWD" || (mkdir -p ../shared-workdir && rm -rf "$PWD" && ln -s shared-workdir "$PWD")',
+               workdir = ".",
+               haltOnFailure = True,
+               doStepIf = IsSharedWorkdir))
+
        # find number of cores
        factory.addStep(SetPropertyFromCommand(
                name = "nproc",
@@ -530,7 +543,7 @@ for target in targets:
        # cleanup.sh if needed
        factory.addStep(FileDownload(
                name = "dlcleanupsh",
-               mastersrc = scripts_dir + '/cleanup-phase1.sh',
+               mastersrc = scripts_dir + '/cleanup.sh',
                slavedest = "../cleanup.sh",
                mode = 0755,
                doStepIf = IsCleanupRequested))
@@ -568,7 +581,7 @@ for target in targets:
        factory.addStep(ShellCommand(
                name = "gitcheckout",
                description = "Ensure that Git HEAD is sane",
-               command = "if [ -d .git ]; then git checkout master; else exit 0; fi",
+               command = "if [ -d .git ]; then git checkout -f %s; git branch --set-upstream-to origin/%s; else exit 0; fi" %(repo_branch, repo_branch),
                haltOnFailure = True))
 
        # check out the source
@@ -905,9 +918,9 @@ for target in targets:
        ))
 
        factory.addStep(ShellCommand(
-               name = "diffconfig",
-               description = "Generating config.seed",
-               command=["make", "-j1", "diffconfig", "V=s"],
+               name = "buildinfo",
+               description = "Generating config.buildinfo, version.buildinfo and feeds.buildinfo",
+               command=["make", "-j1", "buildinfo", "V=s"],
                env = MakeEnv(),
                haltOnFailure = True
        ))
@@ -1170,12 +1183,12 @@ c['status'] = []
 from buildbot.status import html
 from buildbot.status.web import authz, auth
 
-if ini.has_option("status", "bind"):
-       if ini.has_option("status", "user") and ini.has_option("status", "password"):
+if ini.has_option("phase1", "status_bind"):
+       if ini.has_option("phase1", "status_user") and ini.has_option("phase1", "status_password"):
                authz_cfg=authz.Authz(
                        # change any of these to True to enable; see the manual for more
                        # options
-                       auth=auth.BasicAuth([(ini.get("status", "user"), ini.get("status", "password"))]),
+                       auth=auth.BasicAuth([(ini.get("phase1", "status_user"), ini.get("phase1", "status_password"))]),
                        gracefulShutdown = 'auth',
                        forceBuild = 'auth', # use this to test your slave once it is set up
                        forceAllBuilds = 'auth',
@@ -1184,9 +1197,9 @@ if ini.has_option("status", "bind"):
                        stopAllBuilds = 'auth',
                        cancelPendingBuild = 'auth',
                )
-               c['status'].append(html.WebStatus(http_port=ini.get("status", "bind"), authz=authz_cfg))
+               c['status'].append(html.WebStatus(http_port=ini.get("phase1", "status_bind"), authz=authz_cfg))
        else:
-               c['status'].append(html.WebStatus(http_port=ini.get("status", "bind")))
+               c['status'].append(html.WebStatus(http_port=ini.get("phase1", "status_bind")))
 
 
 from buildbot.status import words