phase1: avoid creating nested dl/ symlinks
[buildbot.git] / phase1 / master.cfg
index 4ff4ced47dc6ac2fda8286e5006d4db6a761e02f..91cc1a7409cf79c1fc1e270fbb633bd39b901de6 100644 (file)
@@ -25,6 +25,11 @@ c = BuildmasterConfig = {}
 # slave name and password must be configured on the slave.
 from buildbot.buildslave import BuildSlave
 
+slave_port = 9989
+
+if ini.has_option("general", "port"):
+       slave_port = ini.getint("general", "port")
+
 c['slaves'] = []
 
 for section in ini.sections():
@@ -40,7 +45,7 @@ for section in ini.sections():
 # 'slavePortnum' defines the TCP port to listen on for connections from slaves.
 # This must match the value configured into the buildslaves (with their
 # --master option)
-c['slavePortnum'] = 9989
+c['slavePortnum'] = slave_port
 
 # coalesce builds
 c['mergeRequests'] = True
@@ -141,67 +146,23 @@ from buildbot.steps.master import MasterShellCommand
 from buildbot.process.properties import WithProperties
 
 
-MakeTargetMap = {
-       "^tools/":                              "tools/clean",
-       "^toolchain/":                  "toolchain/clean",
-       "^target/linux/":               "target/linux/clean",
-       "^(config|include)/":   "dirclean"
-}
+CleanTargetMap = [
+       [ "tools",      "tools/clean"                   ],
+       [ "chain",      "toolchain/clean"               ],
+       [ "linux",      "target/linux/clean"    ],
+       [ "dir",        "dirclean"                              ],
+       [ "dist",       "distclean"                             ]
+]
 
-def IsAffected(pattern):
-       def CheckAffected(change):
-               for request in change.build.requests:
-                       for source in request.sources:
-                               for change in source.changes:
-                                       for file in change.files:
-                                               if re.match(pattern, file):
-                                                       return True
-               return False
-       return CheckAffected
-
-def isPathBuiltin(path):
-       incl = {}
-       pkgs = {}
-       conf = open(".config", "r")
-
-       while True:
-               line = conf.readline()
-               if line == '':
-                       break
-               m = re.match("^(CONFIG_PACKAGE_.+?)=y", line)
-               if m:
-                       incl[m.group(1)] = True
-
-       conf.close()
-
-       deps = open("tmp/.packagedeps", "r")
-
-       while True:
-               line = deps.readline()
-               if line == '':
-                       break
-               m = re.match("^package-\$\((CONFIG_PACKAGE_.+?)\) \+= (\S+)", line)
-               if m and incl.get(m.group(1)) == True:
-                       pkgs["package/%s" % m.group(2)] = True
-
-       deps.close()
-
-       while path != '':
-               if pkgs.get(path) == True:
+def IsCleanRequested(pattern):
+       def CheckCleanProperty(step):
+               val = step.getProperty("clean")
+               if val and re.match(pattern, val):
                        return True
-               path = os.path.dirname(path)
-
-       return False
+               else:
+                       return False
 
-def isChangeBuiltin(change):
-       return True
-#      for request in change.build.requests:
-#              for source in request.sources:
-#                      for change in source.changes:
-#                              for file in change.files:
-#                                      if isPathBuiltin(file):
-#                                              return True
-#      return False
+       return CheckCleanProperty
 
 
 c['builders'] = []
@@ -293,6 +254,15 @@ for target in targets:
                        haltOnFailure = True,
                        timeout = 2400))
 
+       # user-requested clean targets
+       for tuple in CleanTargetMap:
+               factory.addStep(ShellCommand(
+                       name = tuple[1],
+                       description = 'User-requested "make %s"' % tuple[1],
+                       command = ["make", tuple[1], "V=s"],
+                       doStepIf = IsCleanRequested(tuple[0])
+               ))
+
        # check out the source
        factory.addStep(Git(repourl=repo_url, mode='update'))
 
@@ -385,11 +355,19 @@ 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
        ))
 
+       # prepare tar
+       factory.addStep(ShellCommand(
+               name = "dltar",
+               description = "Building GNU tar",
+               command = ["make", WithProperties("-j%(nproc:~4)s"), "tools/tar/install", "V=s"],
+               haltOnFailure = True
+       ))
+
        # populate dl
        factory.addStep(ShellCommand(
                name = "dlrun",
@@ -405,14 +383,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                command=["make", "package/base-files/clean", "V=s"]
        ))
 
-       # optional clean steps
-       for pattern, maketarget in MakeTargetMap.items():
-               factory.addStep(ShellCommand(
-                       name = maketarget,
-                       description = maketarget,
-                       command=["make", maketarget, "V=s"], doStepIf=IsAffected(pattern)
-               ))
-
        # build
        factory.addStep(ShellCommand(
                name = "tools",
@@ -449,7 +419,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                name = "pkginstall",
                description = "Installing packages",
                command=["make", WithProperties("-j%(nproc:~4)s"), "package/install", "V=s"],
-               doStepIf = isChangeBuiltin,
                haltOnFailure = True
        ))
 
@@ -465,7 +434,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                name = "images",
                description = "Building images",
                command=["make", WithProperties("-j%(nproc:~4)s"), "target/install", "V=s"],
-               doStepIf = isChangeBuiltin,
                haltOnFailure = True
        ))
 
@@ -473,7 +441,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                name = "checksums",
                description = "Calculating checksums",
                command=["make", "-j1", "checksum", "V=s"],
-               doStepIf = isChangeBuiltin,
                haltOnFailure = True
        ))