From 9af8c49a62d9dbdba38be02eb49dd2dfc0338338 Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jul 20 2015 02:43:56 +0000 Subject: add the target property, and change the initializer to handle the cases where common is specified in the git branch --- diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index df0e3e5..704f7d7 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -34,9 +34,30 @@ class DistGitDirectory(object): sigtobranchre = r'sig-(?P\w+)(?P\d)-?(?P\w+)?-?(?P\w+)?' match = re.match(sigtobranchre, branchtext) if match: - self.__dict__.update(match.groupdict()) - -class Commands(pyrpkg.Commands): + gd = match.groupdict() + self.signame = gd['signame'] + self.centosversion = gd['centosversion'] + + 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 '''