#335 Try to make epel8 and epel-playground8 work in fedpkg
Closed 4 years ago by smooge. Opened 4 years ago by smooge.
Unknown source master  into  master

file modified
+4 -3
@@ -59,9 +59,10 @@

  

      $ fedpkg scratch-build

  

- Repeat the steps above for all active branches (currently `f24`, `f23`, `f22`,

- `el6` and `epel7`). Instead of making a new commit simply merge `master`

- branch. Try to use fast forward to keep the history nice.

+ Repeat the steps above for all active branches (currently `f29`,

+ `f30`, `f31`, `el6`,`epel7`, `epel8` and `epel-playground8`). Instead

+ of making a new commit simply merge `master` branch. Try to use fast

+ forward to keep the history nice.

  

      $ git merge master

  

file modified
+1 -1
@@ -39,7 +39,7 @@

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  

  ``releases-info`` is helpful for packagers to know current active

- Fedora or EPEL rleases, or both. For example to show active Fedora

+ Fedora or EPEL releases, or both. For example to show active Fedora

  releases::

  

    fedpkg releases-info --fedora

file modified
+4 -2
@@ -127,9 +127,11 @@

              self.mockconfig = 'fedora-%s-%s' % (self._distval, self.localarch)

              self.override = 'f%s-override' % self._distval

              self._distunset = 'rhel'

-         # Works until RHEL 10

+         # Works until RHEL 10 

+         # Added in playground as the 'rawhide' for EPEL

          elif re.match(r'el\d$', self.branch_merge) or \

-                 re.match(r'epel\d$', self.branch_merge):

+                 re.match(r'epel\d$', self.branch_merge) or \

+                 re.match(r'epel-playground\d$', self.branch_merge):

              self._distval = self.branch_merge.split('el')[1]

              self._distvar = 'rhel'

              self._disttag = 'el%s' % self._distval

file modified
+2 -2
@@ -37,7 +37,7 @@

      assert_new_tests_repo, get_dist_git_url, get_stream_branches,

      expand_release)

  

- RELEASE_BRANCH_REGEX = r'^(f\d+|el\d+|epel\d+)$'

+ RELEASE_BRANCH_REGEX = r'^(f\d+|el\d+|epel\d+|epel-playground\d+)$'

  LOCAL_PACKAGE_CONFIG = 'package.cfg'

  

  BODHI_TEMPLATE = """\
@@ -565,7 +565,7 @@

  release names, option targets accepts two shortcut names as well, fedora and

  epel, as you can see in the above example. Name fedora stands for current

  active Fedora releases, and epel stands for the active EPEL releases, which are

- el6 and epel7 currently.

+ el6, epel7, epel8, and epel-playground8 currently.

  

  Note that the config file is a branch specific file. That means you could

  create package.cfg for each stream branch separately to indicate on which

file modified
+6 -6
@@ -161,7 +161,7 @@

          if not version.isdigit():

              continue

  

-         if short_name == 'epel':

+         if short_name == 'epel' or short_name == 'epel-playground':

              prefix = 'el' if version == '6' else 'epel'

          elif short_name == 'fedora':

              prefix = 'f'
@@ -246,7 +246,7 @@

      :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|epel-playground)\d+$', branch))

  

  

  def assert_valid_epel_package(name, branch):
@@ -356,7 +356,7 @@

      # should be ok to remove if from this list.

      return [

          item for item in branches

-         if not re.match(r'^(f|el|epel)\d+$', item['name']) and

+         if not re.match(r'^(f|el|epel|epel-playground)\d+$', item['name']) and

          item['name'] != 'master'

      ]

  
@@ -371,15 +371,15 @@

          fedora and epel, or concrete release names, e.g. f28, el6.

      :param dict active_releases: a mapping from release category to concrete

          release names. Fow now, it has two mappings, from name fedora to f\d\+,

-         and from epel to el6 and epel7. Value of this parameter should be

-         returned from `get_release_branches`.

+         and from epel to el6, epel7, epel8 and epel-playground8. Value of this 

+         parameter should be returned from `get_release_branches`.

      :return: list of releases, for example ``[f28]``, or ``[el6, epel7]``.

      """

      if rel == 'master':

          return ['master']

      elif rel == 'fedora':

          return active_releases['fedora']

-     elif rel == 'epel':

+     elif rel == 'epel' or rel == 'epel-playground':

          return active_releases['epel']

      elif rel in active_releases['fedora'] or rel in active_releases['epel']:

          return [rel]

file modified
+14 -14
@@ -878,7 +878,7 @@

      def test_request_branch(self, mock_grb, mock_request_post):

          """Tests request-branch"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          mock_rv = Mock()

          mock_rv.ok = True

          mock_rv.json.return_value = {'issue': {'id': 2}}
@@ -914,7 +914,7 @@

      def test_request_branch_override(self, mock_grb, mock_request_post):

          """Tests request-branch with an overriden package and branch name"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          mock_rv = Mock()

          mock_rv.ok = True

          mock_rv.json.return_value = {'issue': {'id': 2}}
@@ -948,7 +948,7 @@

      def test_request_branch_module(self, mock_grb, mock_request_post):

          """Tests request-branch for a new module branch"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          mock_rv = Mock()

          mock_rv.ok = True

          mock_rv.json.return_value = {'issue': {'id': 2}}
@@ -982,7 +982,7 @@

      def assert_request_branch_container(self, cli_cmd, mock_grb, mock_request_post):

          """Tests request-branch for a new container branch"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          mock_rv = Mock()

          mock_rv.ok = True

          mock_rv.json.return_value = {'issue': {'id': 2}}
@@ -1030,7 +1030,7 @@

                                  mock_request_post):

          """Tests request-branch with service levels"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          responses = []

          for idx in range(2, 5):

              mock_rv_post = Mock()
@@ -1118,7 +1118,7 @@

      def test_request_branch_all_releases(self, mock_grb, mock_request_post):

          """Tests request-branch with the '--all-releases' option """

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          post_side_effect = []

          for i in range(1, 4):

              mock_rv = Mock()
@@ -1205,7 +1205,7 @@

      def test_request_branch_sls_on_release_branch_error(self, mock_grb):

          """Tests request-branch with a release branch and service levels"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

  

          cli_cmd = ['fedpkg-stage', '--path', self.cloned_repo_path,

                     '--name', 'nethack', 'request-branch', 'f27', '--sl',
@@ -1302,7 +1302,7 @@

      def test_request_with_repo_option(self, mock_grb, mock_request_post):

          """Test request branch with option --repo"""

          mock_grb.return_value = {'fedora': ['f25', 'f26', 'f27'],

-                                  'epel': ['el6', 'epel7']}

+                                  'epel': ['el6', 'epel7', 'epel8']}

          mock_rv = Mock()

          mock_rv.ok = True

          mock_rv.json.return_value = {'issue': {'id': 2}}
@@ -2031,7 +2031,7 @@

          super(TestReadReleasesFromLocalConfig, self).setUp()

          self.active_releases = {

              'fedora': ['f28', 'f27'],

-             'epel': ['el6', 'epel7'],

+             'epel': ['el6', 'epel7', 'epel8'],

          }

          self.fake_cmd = ['fedpkg', '--path', self.cloned_repo_path, 'build']

  
@@ -2074,7 +2074,7 @@

  

          rels = cli.read_releases_from_local_config(self.active_releases)

          rels = sorted(rels)

-         self.assertEqual(['el6', 'epel7', 'f27', 'f28', 'master'], rels)

+         self.assertEqual(['el6', 'epel7','epel8', 'f27', 'f28', 'master'], rels)

  

  

  class TestIsStreamBranch(CliTestCase):
@@ -2136,7 +2136,7 @@

              self, get_release_branches, get_stream_branches, _build):

          get_release_branches.return_value = {

              'fedora': ['f28', 'f27'],

-             'epel': ['el6', 'epel7'],

+             'epel': ['el6', 'epel7', 'epel8'],

          }

          get_stream_branches.return_value = [{'name': '8', 'active': True}]

          self.checkout_branch(git.Repo(self.cloned_repo_path), '8')
@@ -2158,7 +2158,7 @@

              self, get_release_branches, get_stream_branches, _build):

          get_release_branches.return_value = {

              'fedora': ['f28', 'f27'],

-             'epel': ['el6', 'epel7'],

+             'epel': ['el6', 'epel7', 'epel8'],

          }

          get_stream_branches.return_value = [{'name': '8', 'active': True}]

          self.checkout_branch(git.Repo(self.cloned_repo_path), '8')
@@ -2185,7 +2185,7 @@

              _build):

          get_release_branches.return_value = {

              'fedora': ['f28', 'f27'],

-             'epel': ['el6', 'epel7'],

+             'epel': ['el6', 'epel7', 'epel8'],

          }

          get_stream_branches.return_value = [{'name': '8', 'active': True}]

          _build.side_effect = [1, 2]
@@ -2226,7 +2226,7 @@

                  self.assertEqual(expected_output, output)

  

      def test_print_epel_releases_only(self, mock_grb):

-         self.assert_output_releases('el6 epel7', option=['--epel'])

+         self.assert_output_releases('el6 epel7 epel8', option=['--epel'])

  

      def test_print_fedora_releases_only(self, mock_grb):

          self.assert_output_releases('f29 f28', option=['--fedora'])

file modified
+15
@@ -246,6 +246,21 @@

          self.assert_rpmdefines()

  

      @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)

+     def test_load_epel8_dist_tag(self, branch_merge):

+         branch_merge.return_value = 'epel8'

+ 

+         self.cmd.load_rpmdefines()

+ 

+         self.assertEqual('8', self.cmd._distval)

+         self.assertEqual('rhel', self.cmd._distvar)

+         self.assertEqual('el8', self.cmd._disttag)

+         self.assertEqual('epel-8-i686', self.cmd.mockconfig)

+         self.assertEqual('epel8-override', self.cmd.override)

+         self.assertTrue(hasattr(self.cmd, '_distunset'))

+ 

+         self.assert_rpmdefines()

+ 

+     @patch('pyrpkg.Commands.branch_merge', new_callable=PropertyMock)

      @patch('fedpkg.Commands._findmasterbranch')

      def test_load_master_dist_tag(self, _findmasterbranch, branch_merge):

          _findmasterbranch.return_value = '28'

file modified
+4 -3
@@ -137,6 +137,7 @@

              'results': [

                  {'short': 'epel', 'version': '6'},

                  {'short': 'epel', 'version': '7'},

+                 {'short': 'epel', 'version': '8'},

                  {'short': 'fedora', 'version': '25'},

                  {'short': 'fedora', 'version': '26'},

                  {'short': 'fedora', 'version': '27'},
@@ -145,9 +146,9 @@

              ]

          }

          mock_request_get.return_value = mock_rv

-         expected = set(['el6', 'epel7', 'f25', 'f26', 'f27', 'f28'])

+         expected = set(['el6', 'epel7', 'epel8', 'f25', 'f26', 'f27', 'f28'])

          expected = {

-             'epel': ['el6', 'epel7'],

+             'epel': ['el6', 'epel7', 'epel8'],

              'fedora': ['f25', 'f26', 'f27', 'f28'],

          }

          actual = utils.get_release_branches('http://pdc.local')
@@ -483,7 +484,7 @@

      def setUp(self):

          self.releases = {

              'fedora': ['f28', 'f27'],

-             'epel': ['el6', 'epel7']

+             'epel': ['el6', 'epel7', 'epel8']

          }

  

      def test_expand_fedora(self):

In trying to fix issue 334 I attempted to make changes which matched current code style maybe

@smooge I guess the easiest fix would be, this will consider epel8-playground as epel8

diff --git a/fedpkg/cli.py b/fedpkg/cli.py
index d7b0872..6336494 100644
--- a/fedpkg/cli.py
+++ b/fedpkg/cli.py
@@ -917,6 +917,9 @@ targets to build the package for a particular stream.
                         'names'.format('flatpak' if ns == 'flatpaks' else 'module'))
             release_branches = list(itertools.chain(
                 *list(get_release_branches(pdc_url).values())))
+            if 'epel' in branch and 'playground' in branch:
+                branch_playground = branch
+                branch = branch_testing.split("-")[0]
             if branch in release_branches:
                 if service_levels:
                     raise rpkgError(

And use branch_playground whenever needed.

I guess this should work

diff --git a/fedpkg/cli.py b/fedpkg/cli.py
index d7b0872..8c1d124 100644
--- a/fedpkg/cli.py
+++ b/fedpkg/cli.py
@@ -905,6 +905,9 @@ targets to build the package for a particular stream.

         pdc_url = config.get('{0}.pdc'.format(name), 'url')
         if branch:
+            if 'epel' in branch and 'playground' in branch:
+                branch_playground = branch
+                branch = branch.split("-")[0]
             if is_epel(branch):
                 assert_valid_epel_package(repo_name, branch)

@@ -942,7 +945,10 @@ targets to build the package for a particular stream.
             branches = [b for b in release_branches
                         if re.match(r'^(f\d+)$', b)]
         else:
-            branches = [branch]
+            if branch_playground:
+                branches = [branch_playground]
+            else:
+                branches = [branch]

         for b in sorted(list(branches), reverse=True):
             ticket_body = {

Okay, I tested in stage with my patch and it seems to be working - https://stg.pagure.io/releng/fedora-scm-requests/issue/202

diff --git a/fedpkg/cli.py b/fedpkg/cli.py
index d7b0872..c10f76b 100644
--- a/fedpkg/cli.py
+++ b/fedpkg/cli.py
@@ -905,6 +905,9 @@ targets to build the package for a particular stream.

         pdc_url = config.get('{0}.pdc'.format(name), 'url')
         if branch:
+            if 'epel' in branch and 'playground' in branch:
+                branch_playground = branch
+                branch = branch_testing.split("-")[0]
             if is_epel(branch):
                 assert_valid_epel_package(repo_name, branch)

@@ -942,7 +945,10 @@ targets to build the package for a particular stream.
             branches = [b for b in release_branches
                         if re.match(r'^(f\d+)$', b)]
         else:
-            branches = [branch]
+            if branch_playground:
+                branches = [branch_playground]
+            else
+                branches = [branch]

         for b in sorted(list(branches), reverse=True):
             ticket_body = {
@@ -965,11 +971,13 @@ targets to build the package for a particular stream.

             # For non-standard rpm branch requests, also request a matching new
             # module repo with a matching branch.
-            auto_module = (
-                ns == 'rpms'
-                and not re.match(RELEASE_BRANCH_REGEX, b)
-                and not no_auto_module
-            )
+            auto_module = None
+            if not branch_playground:
+                auto_module = (
+                    ns == 'rpms'
+                    and not re.match(RELEASE_BRANCH_REGEX, b)
+                    and not no_auto_module
+                )
             if auto_module:
                 summary = ('Automatically requested module for '
                            'rpms/%s:%s.' % (repo_name, b))

Created the PR with the above patch - https://pagure.io/fedpkg/pull-request/336

If its good, let me know and I will add some comments.

This failed jenkins and I think mohan's idea is better thought out.

Pull-Request has been closed by smooge

4 years ago