[buildbot] phase1: fix ForceScheduler

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


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

commit 4841fd447921b23ce4c17978c90a88e47e582f1e
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Wed Oct 26 14:43:15 2022 +0200

    phase1: fix ForceScheduler
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 phase1/master.cfg | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index 70e2162..b65d3af 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -297,23 +297,28 @@ class TagChoiceParameter(BaseParameter):
 	@property
 	def choices(self):
 		taglist = []
-		basever = re.search(r'-([0-9]+\.[0-9]+)$', "master")	# XXX FIXME
+		branchvers = []
 
-		if basever:
-			findtags = subprocess.Popen(
-				['git', 'ls-remote', '--tags', repo_url],
-				stdout = subprocess.PIPE)
+		for b in branchNames:
+			basever = re.search(r'-([0-9]+\.[0-9]+)$', b)
+			if basever:
+				branchvers.append(basever[1])
 
-			while True:
-				line = findtags.stdout.readline()
+		alltags = subprocess.Popen(
+			['git', 'ls-remote', '--tags', repo_url],
+			stdout = subprocess.PIPE)
 
-				if not line:
-					break
+		while True:
+			line = alltags.stdout.readline()
+
+			if not line:
+				break
 
-				tagver = re.search(r'\brefs/tags/v([0-9]+\.[0-9]+\.[0-9]+(?:-rc[0-9]+)?)$', line.decode().strip())
+			tagver = re.search(r'\brefs/tags/v([0-9]+\.[0-9]+\.[0-9]+(?:-rc[0-9]+)?)$', line.decode().strip())
 
-				if tagver and tagver[1].find(basever[1]) == 0:
-					taglist.append(tagver[1])
+			# only list tags matching configured branches
+			if tagver and any(tagver[1].startswith(b) for b in branchvers):
+				taglist.append(tagver[1])
 
 		taglist.sort(reverse=True, key=lambda tag: tag if re.search(r'-rc[0-9]+$', tag) else tag + '-z')
 		taglist.insert(0, '')
@@ -369,7 +374,7 @@ c['schedulers'].append(ForceScheduler(
 					name    = "target",
 					label   = "Build target",
 					default = "all",
-					choices = set( "all" ) | targets
+					choices = [ "all" ] + list(targets)
 				),
 				TagChoiceParameter(
 					name    = "tag",




More information about the lede-commits mailing list