@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, '')
name = "target",
label = "Build target",
default = "all",
- choices = set( "all" ) | targets
+ choices = [ "all" ] + list(targets)
),
TagChoiceParameter(
name = "tag",