add the target property, and change the initializer to handle the cases where common is specified in the git branch

This commit is contained in:
Brian Stinson 2015-07-19 21:43:56 -05:00
parent 86b0d36840
commit 9af8c49a62

View file

@ -34,9 +34,30 @@ class DistGitDirectory(object):
sigtobranchre = r'sig-(?P<signame>\w+)(?P<centosversion>\d)-?(?P<projectname>\w+)?-?(?P<releasename>\w+)?'
match = re.match(sigtobranchre, branchtext)
if match:
self.__dict__.update(match.groupdict())
gd = match.groupdict()
self.signame = gd['signame']
self.centosversion = gd['centosversion']
class Commands(pyrpkg.Commands):
if gd['projectname'] != 'common':
self.projectname = gd['projectname']
if gd['releasename'] != 'common':
self.releasename = gd['releasename']
@property
def target(self):
projectorcommon = self.projectname
releaseorcommon = self.releasename
if not releaseorcommon:
if not projectorcommon or projectorcommon == 'common':
projectorcommon = 'common'
else:
releaseorcommon = 'common'
return '-'.join(filter(None, [self.signame+self.centosversion,
projectorcommon, releaseorcommon])) + '-el{0}'.format(self.centosversion)
class Commands(Commands):
'''
For the pyrpkg commands with centpkg behavior
'''