From 639034222f5070fc8256896bcd88f9b70dc4c75d Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jul 20 2015 03:17:01 +0000 Subject: add behavior to pick up the distro branches --- diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index 3d3c0b6..97c01be 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -29,12 +29,15 @@ class DistGitDirectory(object): centosversion = None projectname = None releasename = None + distrobranch = False def __init__(self, branchtext): sigtobranchre = r'sig-(?P\w+)(?P\d)-?(?P\w+)?-?(?P\w+)?' - match = re.match(sigtobranchre, branchtext) - if match: - gd = match.groupdict() + distrobranchre = r'c(?P\d+)-?(?P\w+)?' + sigmatch = re.match(sigtobranchre, branchtext) + distromatch = re.match(distrobranchre, branchtext) + if sigmatch: + gd = sigmatch.groupdict() self.signame = gd['signame'] self.centosversion = gd['centosversion'] @@ -45,12 +48,26 @@ class DistGitDirectory(object): self.projectname = gd['projectname'] if gd['releasename'] != 'common': self.releasename = gd['releasename'] + elif distromatch: + gd = distromatch.groupdict() + self.distrobranch = True + self.signame = 'centos' + self.centosversion = gd['centosversion'] + + if gd['projectname'] != 'common': + self.projectname = gd['projectname'] + else: + raise ValueError("Branchname: {0} is not valid".format(branchtext)) @property def target(self): projectorcommon = self.projectname releaseorcommon = self.releasename + if self.distrobranch: + return '-'.join(filter(None, ['c'+self.centosversion, + projectorcommon])) + if not releaseorcommon: if not projectorcommon or projectorcommon == 'common': projectorcommon = 'common' @@ -76,6 +93,8 @@ class Commands(Commands): branchre, kojiconfig, build_client, user, dist, target, quiet) + self.distgitdir = DistGitDirectory(self.branch_merge) + def _is_sigbranch(self): # if the current branch is not in the form c, c-plus, # or c-extras it's a sig branch