From: Thibaut VARÈNE Date: Wed, 26 Oct 2022 12:43:15 +0000 (+0200) Subject: phase1: fix ForceScheduler X-Git-Tag: v2~20 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=4841fd447921b23ce4c17978c90a88e47e582f1e;p=buildbot.git phase1: fix ForceScheduler Signed-off-by: Thibaut VARÈNE --- 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",