phase1: remove automatic triggering of clean targets
authorJo-Philipp Wich <jo@mein.io>
Fri, 4 Nov 2016 14:59:50 +0000 (15:59 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 4 Nov 2016 14:59:50 +0000 (15:59 +0100)
Remove the automatic triggering of clean targets depending on the changed
files since the code for that is incompatible with BuildBot 0.8.9.

Instead, implement the ability to trigger specific clean steps through
build properties.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/master.cfg

index 6030def4622d8117b90af1329f8795ba437c2be3..f92a08079ac802b1263f8b373c8b0af0013f472d 100644 (file)
@@ -141,23 +141,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 IsCleanRequested(pattern):
+       def CheckCleanProperty(step):
+               val = step.getProperty("clean")
+               if val and re.match(pattern, val):
+                       return True
+               else:
+                       return False
+
+       return CheckCleanProperty
 
 
 c['builders'] = []
@@ -249,6 +249,16 @@ for target in targets:
                        haltOnFailure = True,
                        timeout = 2400))
 
+       # user-requested clean targets
+       else:
+               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'))
 
@@ -361,14 +371,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",