[buildbot] phase1: make populateTargets() branch aware

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 08:39:20 PDT 2023


ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/6fa2ac2abfec22671f6d14e5dd6fc7e266596034

commit 6fa2ac2abfec22671f6d14e5dd6fc7e266596034
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Mon Oct 24 16:17:03 2022 +0200

    phase1: make populateTargets() branch aware
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 phase1/master.cfg | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 1064efc..9453958 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -247,27 +247,29 @@ c['prioritizeBuilders'] = prioritizeBuilders
 branchNames = [branches[b]["name"] for b in branches]
 
 # find targets
-targets = [ ]
+targets = set()
 
 def populateTargets():
+	log.msg("Populating targets, this will take time")
 	sourcegit = work_dir + '/source.git'
-	if os.path.isdir(sourcegit):
-		subprocess.call(["rm", "-rf", sourcegit])
+	for branch in branchNames:
+		if os.path.isdir(sourcegit):
+			subprocess.call(["rm", "-rf", sourcegit])
 
-	subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, sourcegit])
+		subprocess.call(["git", "clone", "--depth=1", "--branch="+branch, repo_url, sourcegit])
 
-	os.makedirs(sourcegit + '/tmp', exist_ok=True)
-	findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'],
-		stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = sourcegit)
+		os.makedirs(sourcegit + '/tmp', exist_ok=True)
+		findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'],
+			stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = sourcegit)
 
-	while True:
-		line = findtargets.stdout.readline()
-		if not line:
-			break
-		ta = line.decode().strip().split(' ')
-		targets.append(ta[0])
+		while True:
+			line = findtargets.stdout.readline()
+			if not line:
+				break
+			ta = line.decode().strip().split(' ')
+			targets.add(ta[0])
 
-	subprocess.call(["rm", "-rf", sourcegit])
+		subprocess.call(["rm", "-rf", sourcegit])
 
 populateTargets()
 
@@ -332,7 +334,7 @@ c['schedulers'].append(SingleBranchScheduler(
 	name            = "all",
 	change_filter   = filter.ChangeFilter(branch=repo_branch),
 	treeStableTimer = 60,
-	builderNames    = targets))
+	builderNames    = list(targets)))
 
 c['schedulers'].append(ForceScheduler(
 	name         = "force",
@@ -369,7 +371,7 @@ c['schedulers'].append(ForceScheduler(
 					name    = "target",
 					label   = "Build target",
 					default = "all",
-					choices = [ "all" ] + targets
+					choices = set( "all" ) | targets
 				),
 				TagChoiceParameter(
 					name    = "tag",




More information about the lede-commits mailing list