#424 Adjust fedpkg for the new default branch in dist-git: rawhide
Merged 3 years ago by onosek. Opened 3 years ago by pingou.
pingou/fedpkg default_rawhide  into  master

file modified
+7 -7
@@ -168,9 +168,9 @@ 

                  "--define 'el%s 1'" % macros['rhel'],

                  "--define 'rhel %s'" % macros['rhel'],

              ]

-         # master

-         elif re.match(r'master$', self.branch_merge):

-             self._distval = self._findmasterbranch()

+         # rawhide (previously master branch)

+         elif re.match(r'(master|rawhide|main)$', self.branch_merge):

+             self._distval = self._findrawhidebranch()

              self._distvar = 'fedora'

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

              self.mockconfig = 'fedora-rawhide-%s' % self.localarch
@@ -204,13 +204,13 @@ 

              self._rpmdefines.extend(extra_rpmdefines)

  

      def build_target(self, release):

-         if release == 'master':

+         if release in ('rawhide', 'main', 'master'):

              return 'rawhide'

          else:

              return '%s-candidate' % release

  

      def load_container_build_target(self):

-         if self.branch_merge == 'master':

+         if self.branch_merge in ('rawhide', 'main', 'master'):

              self._container_build_target = 'rawhide-%s-candidate' % self.ns

          else:

              super(Commands, self).load_container_build_target()
@@ -244,8 +244,8 @@ 

  

          return macros

  

-     def _findmasterbranch(self):

-         """Find the right "fedora" for master"""

+     def _findrawhidebranch(self):

+         """Find the right "fedora" for rawhide (previously master branch)"""

  

          # If we already have a koji session, just get data from the source

          if self._kojisession:

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

          opt_release = self.parser._option_string_actions['--release']

          opt_release.help = 'Override the discovered release, e.g. f25, which has to match ' \

                             'the remote branch name created in package repository. ' \

-                            'Particularly, use master to build RPMs for rawhide.'

+                            'Particularly, use rawhide/main branch to build RPMs for rawhide.'

  

      def setup_fed_subparsers(self):

          """Register the fedora specific targets"""
@@ -622,7 +622,7 @@ 

              is named package.cfg in INI format. For example,

  

                  [koji]

-                 targets = master fedora epel7

+                 targets = rawhide fedora epel7

  

              You only need to put Fedora releases and EPEL in option targets and fedpkg will

              convert it to proper Koji build target for submitting builds. Beside regular
@@ -818,7 +818,7 @@ 

              logger=self.log,

              repo_name=self.args.name,

              ns=self.args.new_repo_namespace,

-             branch='master',

+             branch='rawhide',

              summary=self.args.summary,

              description=self.args.description,

              upstreamurl=self.args.upstreamurl,
@@ -863,7 +863,7 @@ 

          :param config: A dict containing the configuration, loaded from file.

              Typically the value of `self.config`.

          :param branch: The git branch string when requesting a repo.

-             Typically 'master'.

+             Typically 'rawhide'.

          :param summary: A string, the summary of the new repo.  Typically

              takes the value of `self.args.summary`.

          :param upstreamurl: A string, the upstreamurl of the new repo.
@@ -912,7 +912,7 @@ 

  

              ticket_body = {

                  'action': 'new_repo',

-                 'branch': 'master',

+                 'branch': 'rawhide',

                  'bug_id': bug or '',

                  'monitor': 'no-monitoring',

                  'namespace': 'tests',
@@ -1097,7 +1097,7 @@ 

                      logger=logger,

                      repo_name=repo_name,

                      ns='modules',

-                     branch='master',

+                     branch='rawhide',

                      summary=summary,

                      description=summary,

                      upstreamurl=None,

file modified
+4 -4
@@ -430,13 +430,13 @@ 

      branches = query_pdc(

          server_url, 'component-branches', params=query_args)

      # When write this method, endpoint component-branches contains not only

-     # stream branches, but also regular release branches, e.g. master, f28.

+     # stream branches, but also regular release branches, e.g. rawhide/main, f28.

      # Please remember to review the data regularly, there are only stream

      # branches, or some new replacement of PDC fixes the issue as well, it

      # should be ok to remove if from this list.

      stream_branches = []

      for item in branches:

-         if item['name'] == 'master':

+         if item['name'] in ('master', 'rawhide', 'main'):

              continue

          elif re.match(r'^(f|el)\d+$', item['name']):

              continue
@@ -469,8 +469,8 @@ 

          returned from `get_release_branches`.

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

      """

-     if rel == 'master':

-         return ['master']

+     if rel in ('master', 'rawhide', 'main'):

+         return ['rawhide']

      elif rel == 'fedora':

          return active_releases['fedora']

      elif rel == 'epel':

file modified
+9 -9
@@ -468,7 +468,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': 1441813,

              'description': '',

              'exception': False,
@@ -505,7 +505,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': 1441813,

              'description': '',

              'exception': False,
@@ -545,7 +545,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': '',

              'description': '',

              'exception': False,
@@ -586,7 +586,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': 1441813,

              'description': '',

              'exception': False,
@@ -627,7 +627,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': 1441813,

              'description': 'a description',

              'exception': False,
@@ -663,7 +663,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': '',

              'description': '',

              'exception': True,
@@ -1192,7 +1192,7 @@ 

          summary = u'Automatically requested module for rpms/nethack:9.'

          expected_issue_content = {

              u'action': u'new_repo',

-             u'branch': u'master',

+             u'branch': u'rawhide',

              u'bug_id': u'',

              u'description': summary,

              u'exception': True,
@@ -1481,7 +1481,7 @@ 

  

          expected_issue_content = {

              'action': 'new_repo',

-             'branch': 'master',

+             'branch': 'rawhide',

              'bug_id': '',

              'monitor': 'no-monitoring',

              'namespace': 'tests',
@@ -2189,7 +2189,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', 'f27', 'f28', 'rawhide'], rels)

  

  

  class TestIsStreamBranch(CliTestCase):

file modified
+10 -10
@@ -262,9 +262,9 @@ 

          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'

+     @patch('fedpkg.Commands._findrawhidebranch')

+     def test_load_master_dist_tag(self, _findrawhidebranch, branch_merge):

+         _findrawhidebranch.return_value = '28'

          branch_merge.return_value = 'master'

  

          self.cmd.load_rpmdefines()
@@ -324,11 +324,11 @@ 

          self.assert_rpmdefines(extra_rpmdefines)

  

  

- class TestFindMasterBranch(CommandTestCase):

-     """Test Commands._findmasterbranch"""

+ class TestFindRawhideBranch(CommandTestCase):

+     """Test Commands._findrawhidebranch"""

  

      def setUp(self):

-         super(TestFindMasterBranch, self).setUp()

+         super(TestFindRawhideBranch, self).setUp()

  

          self.cmd = self.make_commands()

  
@@ -338,7 +338,7 @@ 

          koji_session = kojisession.return_value

          koji_session.getBuildTarget.return_value = {'dest_tag_name': 'f28'}

  

-         result = self.cmd._findmasterbranch()

+         result = self.cmd._findrawhidebranch()

  

          koji_session.getBuildTarget.assert_called_once_with('rawhide')

          self.assertEqual('28', result)
@@ -352,7 +352,7 @@ 

          koji_session = anon_kojisession.return_value

          koji_session.getBuildTarget.return_value = {'dest_tag_name': 'f29'}

  

-         result = self.cmd._findmasterbranch()

+         result = self.cmd._findrawhidebranch()

  

          koji_session.getBuildTarget.assert_called_once_with('rawhide')

          self.assertEqual('29', result)
@@ -363,7 +363,7 @@ 

          # As the code shows, any error will be caught

          koji_session.getBuildTarget.side_effect = ValueError

  

-         result = self.cmd._findmasterbranch()

+         result = self.cmd._findrawhidebranch()

          self.assertEqual(28, result)

  

      @patch('pyrpkg.Commands.anon_kojisession', new_callable=PropertyMock)
@@ -378,7 +378,7 @@ 

  

          six.assertRaisesRegex(

              self, rpkgError, 'Unable to find rawhide target',

-             self.cmd._findmasterbranch)

+             self.cmd._findrawhidebranch)

  

  

  class TestOverrideBuildURL(CommandTestCase):

file modified
+5 -1
@@ -505,7 +505,11 @@ 

  

      def test_expand_master(self):

          result = utils.expand_release('master', self.releases)

-         self.assertEqual(['master'], result)

+         self.assertEqual(['rawhide'], result)

+ 

+     def test_expand_rawhide(self):

+         result = utils.expand_release('rawhide', self.releases)

+         self.assertEqual(['rawhide'], result)

  

      def test_normal_release(self):

          result = utils.expand_release('f28', self.releases)

In some places we also reference main which will be a symlink to
the rawhide branch and we currently still reference master to be
backward compatible (even though once the rawhide branch appears
the master branch will be removed and blocked).

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

This is based on a quick git grep and quite un-tested. The test suite fails for me in tox as well as when running nosetests manually :(

rebased onto fb50218267327bbd09b4692fa17b7cf824e89d19

3 years ago

rebased onto 885043c

3 years ago

1 new commit added

  • More updates to 'rawhide' default branch
3 years ago

I added more changes, but this also needs changes to tests.

These changes to tests are sufficient to make them pass locally for me.
https://pagure.io/fork/lsedlar/fedpkg/c/6f9b0667800b8fad5fcec2afde2617f8c8e9d0fe?branch=fix-review-424

Is the tooling that handles new branches updated to handle requests for rawhide branches? This patch would change the JSON that is submitted to list rawhide instead of master.

These changes to tests are sufficient to make them pass locally for me.
https://pagure.io/fork/lsedlar/fedpkg/c/6f9b0667800b8fad5fcec2afde2617f8c8e9d0fe?branch=fix-review-424

I've enabled PRs on my fork so you can open a PR against my fork ;-)

Is the tooling that handles new branches updated to handle requests for rawhide branches? This patch would change the JSON that is submitted to list rawhide instead of master.

It's on the todo @humaton and @mohanboddu should be looking at this iirc

1 new commit added

  • Update tests for rawhide branch rename
3 years ago

considering the state of these two projects, I doubt we'll change their default branches

FTR I didn't mean the default branch of the request repo itself, but the content of submitted requests:
https://pagure.io/releng/fedora-scm-requests/issue/31722
With this patch, branch would switch from master to rawhide, which is probably a wanted change, and I just want to make sure tools processing the ticket can handle it.

pretty please pagure-ci rebuild

3 years ago

Isn't this should be rawhide as well and while we are at it, better change the test name as well.

Maybe keep this one as is as it shows the backward compatibility and add a new one?

Maybe keep this one as is as it shows the backward compatibility and add a new one?

Sounds good to me.

1 new commit added

  • Adding test_expand_rawhide test
3 years ago

4 new commits added

  • Adding test_expand_rawhide test
  • Update tests for rawhide branch rename
  • More updates to 'rawhide' default branch
  • Adjust fedpkg for the new default branch in dist-git: rawhide
3 years ago

Looks all good to me! :)

Code looks correct. Tests are also passing. Don't know why they were not exected automatically, but I run Jenkins manually. I took a patch to build fedpkg scratch build. I tried at least building functionality from dist-git branch which has old master branch. It worked.
My only concern is whether fedora-scm (already) creates rawhide branches for fedpkg requests. Will they create "symlink" branches or just a single one?
There are 4 commits in the PR. They look complicated because at least first two commits are interfering together. The best approach for me would be 2 commits for functionality and unittests. If you don't mind, I can try to transform it during the merge. I would like to preserve authors (in case of 2 authors, I would name one of you in the commit message).

OK, answering to myself :)
https://fedoraproject.org/wiki/Changes/GitRepos-master-to-main:
Along with the src.fedoraproject.org changes, we will update the branch filter list and forbid 'master' from being pushed at all. Additionally, we will establish a sym-ref between 'rawhide' and 'main' as a convenience for people who prefer to use 'main' branch for rawhide.

My only concern is whether fedora-scm (already) creates rawhide branches for fedpkg requests. Will they create "symlink" branches or just a single one?

@humaton @mohanboddu do you know the status of fedscm-admin?

My only concern is whether fedora-scm (already) creates rawhide branches for fedpkg requests. Will they create "symlink" branches or just a single one?

@humaton @mohanboddu do you know the status of fedscm-admin?

fedscm_admin creates the main "symlink".

fedscm_admin creates the main "symlink".

And can handle new package/branch requests asking for "rawhide" instead of "master"?

Commit 34a971b fixes this pull-request

Pull-Request has been merged by onosek

3 years ago

Didn't find where the fedora-scm-request execution code resides, so I hope it is working as expected.
I regrouped 4 commits - resulting in 2. And I am going to create and release a patch.
Thank you for the code, guys.