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'] = []
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'))
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",