#44 Add support for RHEL style module stream branch names
Merged 2 years ago by carlwgeorge. Opened 2 years ago by merlinm.
centos/ merlinm/centpkg module-stream-branches  into  develop

file modified
+8 -1
@@ -45,13 +45,20 @@ 

          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']

file modified
+40
@@ -140,6 +140,46 @@ 

      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'

An initial test module (container-tools) and its components have been imported to the test namespace in GitLab (https://gitlab.com/redhat/centos-stream/temp). The current version of centpkg can be used to clone the module or components (eg., centpkg clone temp/buildah), but then many commands such as centpkg sources fail to work in the repo--aborting with a message such as Could not execute sources: Branchname: stream-container-tools-3.0-rhel-9.0.0-beta is not valid.

This PR is an initial pass at getting centpkg to recognize RHEL style module stream branch names used by the test module and components.

I'm not sure these changes are 100% correct or complete, but they do let centpkg start working with the RHEL style branches in the above referenced repos.

These changes look good to me. Can you rebase and resolve the conflicts?

rebased onto cbd56311511114e5da8469998e11cd229ce16840

2 years ago

These changes look good to me. Can you rebase and resolve the conflicts?

Thanks. Done!

rebased onto bb525ad

2 years ago

Pull-Request has been merged by carlwgeorge

2 years ago