mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 08:12:55 +00:00
Add support for RHEL style module stream branch names
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
This commit is contained in:
parent
615d8f3e38
commit
bb525ad895
2 changed files with 48 additions and 1 deletions
|
@ -45,13 +45,20 @@ class DistGitDirectory(object):
|
|||
if repo_path:
|
||||
# self.repo = git.cmd.Git(repo_path)
|
||||
self.repo = git.repo.Repo(repo_path)
|
||||
rhelbranchre = r'rhel-(?P<major>\d+)\.(?P<minor>\d+)(?:\.(?P<appstream>\d+))?'
|
||||
sigtobranchre = r'c(?P<centosversion>\d+[s]?)-sig-(?P<signame>\w+)-?(?P<projectname>\w+)?-?(?P<releasename>\w+)?'
|
||||
distrobranchre = r'c(?P<centosversion>\d+)-?(?P<projectname>\w+)?'
|
||||
oldbranchre = r'(?P<signame>\w+)(?P<centosversion>\d)'
|
||||
rhelmatch = re.search(rhelbranchre, branchtext)
|
||||
sigmatch = re.match(sigtobranchre, branchtext)
|
||||
distromatch = re.match(distrobranchre, branchtext)
|
||||
oldbranchmatch = re.match(oldbranchre, branchtext)
|
||||
if sigmatch:
|
||||
if rhelmatch:
|
||||
gd = rhelmatch.groupdict()
|
||||
self.distrobranch = True
|
||||
self.signame = 'centos'
|
||||
self.centosversion = gd['major']
|
||||
elif sigmatch:
|
||||
gd = sigmatch.groupdict()
|
||||
self.signame = gd['signame']
|
||||
self.centosversion = gd['centosversion']
|
||||
|
|
|
@ -140,6 +140,46 @@ class TestDistgitC7DistroBranch(unittest.TestCase):
|
|||
def test_target_gets_set(self):
|
||||
self.assertEqual(self.d.target, 'c7')
|
||||
|
||||
class TestDistgitStream9Module(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.branchstring = '3.0-rhel-9.0.0-beta'
|
||||
self.d = DistGitDirectory(self.branchstring)
|
||||
|
||||
def test_signame_gets_set(self):
|
||||
self.assertEqual(self.d.signame, 'centos')
|
||||
|
||||
def test_centosversion_gets_set(self):
|
||||
self.assertEqual(self.d.centosversion, '9')
|
||||
|
||||
def test_projectname_gets_set(self):
|
||||
self.assertEqual(self.d.projectname, None)
|
||||
|
||||
def test_releasename_gets_set(self):
|
||||
self.assertEqual(self.d.releasename, None)
|
||||
|
||||
def test_target_gets_set(self):
|
||||
self.assertEqual(self.d.target, 'c9s-candidate')
|
||||
|
||||
class TestDistgitStream9ModuleComponent(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.branchstring = 'stream-container-tools-3.0-rhel-9.0.0-beta'
|
||||
self.d = DistGitDirectory(self.branchstring)
|
||||
|
||||
def test_signame_gets_set(self):
|
||||
self.assertEqual(self.d.signame, 'centos')
|
||||
|
||||
def test_centosversion_gets_set(self):
|
||||
self.assertEqual(self.d.centosversion, '9')
|
||||
|
||||
def test_projectname_gets_set(self):
|
||||
self.assertEqual(self.d.projectname, None)
|
||||
|
||||
def test_releasename_gets_set(self):
|
||||
self.assertEqual(self.d.releasename, None)
|
||||
|
||||
def test_target_gets_set(self):
|
||||
self.assertEqual(self.d.target, 'c9s-candidate')
|
||||
|
||||
class TestDistgitC6DistroBranch(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.branchstring = 'c6'
|
||||
|
|
Loading…
Add table
Reference in a new issue