[buildbot] phase1: remove automatic triggering of clean targets

LEDE Commits lede-commits at lists.infradead.org
Fri Nov 4 08:01:37 PDT 2016


jow pushed a commit to buildbot.git, branch master:
https://git.lede-project.org/49d9859c052b95ce157d31eaf2906e32869522ad

commit 49d9859c052b95ce157d31eaf2906e32869522ad
Author: Jo-Philipp Wich <jo at mein.io>
AuthorDate: Fri Nov 4 15:59:50 2016 +0100

    phase1: remove automatic triggering of clean targets
    
    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 at mein.io>
---
 phase1/master.cfg | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 6030def..f92a080 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -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",



More information about the lede-commits mailing list