From 4841fd447921b23ce4c17978c90a88e47e582f1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thibaut=20VAR=C3=88NE?= Date: Wed, 26 Oct 2022 14:43:15 +0200 Subject: [PATCH] phase1: fix ForceScheduler MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- 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", -- 2.30.2