From aee3833b6c2c37990080fec3b1fcd165df4f3848 Mon Sep 17 00:00:00 2001 From: Carl George Date: Jun 10 2021 23:10:10 +0000 Subject: Add support for epel*-next branches Signed-off-by: Carl George --- diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py index 155b6d7..0cbaebe 100644 --- a/fedpkg/__init__.py +++ b/fedpkg/__init__.py @@ -150,6 +150,13 @@ class Commands(pyrpkg.Commands): self.mockconfig = 'epel-%s-%s' % (self._distval, self.localarch) self.override = 'epel%s-override' % self._distval self._distunset = 'fedora' + elif re.match(r'epel\d+-next$', self.branch_merge): + self._distval = re.search(r'\d+', self.branch_merge).group(0) + self._distvar = 'rhel' + self._disttag = 'el%s.next' % self._distval + self.mockconfig = 'epel-next-%s-%s' % (self._distval, self.localarch) + self.override = 'epel%s-next-override' % self._distval + self._distunset = 'fedora' elif re.match(r'olpc\d$', self.branch_merge): self._distval = self.branch_merge.split('olpc')[1] self._distvar = 'olpc' diff --git a/fedpkg/cli.py b/fedpkg/cli.py index 4ff9195..2e9b4f9 100644 --- a/fedpkg/cli.py +++ b/fedpkg/cli.py @@ -1044,8 +1044,12 @@ class fedpkgClient(cliClient): *list(get_release_branches(pdc_url).values()))) # treat epel*-playground the same as epel* release branches playground_match = re.match(r'^(epel\d+)-playground$', branch) + # treat epel*-next the same as epel* release branches + next_match = re.match(r'^(epel\d+)-next$', branch) if playground_match: _branch = playground_match.groups()[0] + elif next_match: + _branch = next_match.groups()[0] else: _branch = branch if _branch in release_branches: @@ -1101,7 +1105,8 @@ class fedpkgClient(cliClient): auto_module = ( ns == 'rpms' and not re.match(RELEASE_BRANCH_REGEX, b) - and not playground_match # Dont run auto_module on epel requests + and not playground_match # Dont run auto_module on epel-playground requests + and not next_match # Dont run auto_module on epel-next requests and not no_auto_module ) if auto_module: diff --git a/fedpkg/utils.py b/fedpkg/utils.py index 046ead3..16bcfda 100644 --- a/fedpkg/utils.py +++ b/fedpkg/utils.py @@ -326,7 +326,7 @@ def is_epel(branch): :param branch: a string of the branch name :return: a boolean """ - return bool(re.match(r'^(?:el|epel)\d+$', branch)) + return bool(re.match(r'^(?:el|epel)\d+(?:-next)?$', branch)) def assert_valid_epel_package(name, branch): @@ -450,6 +450,10 @@ def get_stream_branches(server_url, package_name): # target to build. elif re.match(r'^epel\d+-playground$', item['name']): continue + # epel8-next and above branches should be considered as release branches + # so that it will use epelX-next-candidate target to build. + elif re.match(r'^epel\d+-next$', item['name']): + continue else: stream_branches.append(item) return stream_branches diff --git a/test/test_commands.py b/test/test_commands.py index 0c1a77d..ebfe196 100644 --- a/test/test_commands.py +++ b/test/test_commands.py @@ -262,6 +262,21 @@ class TestLoadRpmDefines(CommandTestCase): self.assert_rpmdefines() @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock) + def test_load_epel8_next_dist_tag(self, branch_merge): + branch_merge.return_value = 'epel8-next' + + self.cmd.load_rpmdefines() + + self.assertEqual('8', self.cmd._distval) + self.assertEqual('rhel', self.cmd._distvar) + self.assertEqual('el8.next', self.cmd._disttag) + self.assertEqual('epel-next-8-i686', self.cmd.mockconfig) + self.assertEqual('epel8-next-override', self.cmd.override) + self.assertTrue(hasattr(self.cmd, '_distunset')) + + self.assert_rpmdefines() + + @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock) @patch('fedpkg.Commands._findrawhidebranch') def test_load_rawhide_dist_tag(self, _findrawhidebranch, branch_merge): _findrawhidebranch.return_value = '28'