public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/fedpkg] 1.48-1: Patches
@ 2026-08-10 21:45
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-08-10 21:45 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : 212861f3bc73d18896f3e995797192355178edf3
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2020-03-30T15:54:39+00:00
Stats : +395/-2 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/212861f3bc73d18896f3e995797192355178edf3?branch=1.48-1
Log:
Patches
- Repair test of "retire" command after rpkg update
- Body changes for requesting new test repo
- Check missing config options more reliably
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0008-Repair-test-of-retire-command-after-rpkg-update.patch b/0008-Repair-test-of-retire-command-after-rpkg-update.patch
new file mode 100644
index 0000000..fdeade4
--- /dev/null
+++ b/0008-Repair-test-of-retire-command-after-rpkg-update.patch
@@ -0,0 +1,26 @@
+From 58533b8fb6e1eb7daa938ef2bc2b8a3d778469de Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 25 Mar 2020 23:27:39 +0100
+Subject: [PATCH 1/3] Repair test of "retire" command after rpkg update
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ test/test_retire.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_retire.py b/test/test_retire.py
+index 153dbc9..f6b40cc 100644
+--- a/test/test_retire.py
++++ b/test/test_retire.py
+@@ -105,7 +105,7 @@ class RetireTestCase(unittest.TestCase):
+ client.log = mock.Mock()
+ client.retire()
+ args, kwargs = client.log.warn.call_args
+- self.assertIn('dead.package found, package probably already retired',
++ self.assertIn('dead.package found, package or module is already retired',
+ args[0])
+
+ @mock.patch(
+--
+2.21.1
+
diff --git a/0009-Body-changes-for-requesting-new-test-repo.patch b/0009-Body-changes-for-requesting-new-test-repo.patch
new file mode 100644
index 0000000..83971b0
--- /dev/null
+++ b/0009-Body-changes-for-requesting-new-test-repo.patch
@@ -0,0 +1,74 @@
+From 5672d905e430dc599c4e1a9b2a3c447c225f63ab Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 25 Mar 2020 18:08:03 +0100
+Subject: [PATCH 1/2] Body changes for requesting new test repo
+
+Adds new fields 'bug_id' (optional) and 'monitor' (fixed)
+
+Relates: https://pagure.io/fedscm-admin/issue/22
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ fedpkg/cli.py | 8 +++++++-
+ test/test_cli.py | 4 +++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index e2291ff..c43fcff 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -359,6 +359,9 @@ class fedpkgClient(cliClient):
+ request_tests_repo_parser.add_argument(
+ 'description',
+ help='Description of the tests repository')
++ request_tests_repo_parser.add_argument(
++ '--bug', type=int,
++ help='Bugzilla bug ID of the package review request.')
+ request_tests_repo_parser.set_defaults(command=self.request_tests_repo)
+
+ def register_request_branch(self):
+@@ -801,6 +804,7 @@ class fedpkgClient(cliClient):
+ repo_name=self.args.name,
+ ns='tests',
+ description=self.args.description,
++ bug=self.args.bug,
+ name=self.name,
+ config=self.config,
+ anongiturl=self.cmd.anongiturl
+@@ -862,7 +866,7 @@ class fedpkgClient(cliClient):
+ .format(repo_name))
+
+ summary_from_bug = ''
+- if bug and ns not in ['tests', 'modules', 'flatpaks']:
++ if bug and ns not in ['modules', 'flatpaks']:
+ bz_url = config.get('{0}.bugzilla'.format(name), 'url')
+ bz_client = BugzillaClient(bz_url)
+ bug_obj = bz_client.get_review_bug(bug, ns, repo_name)
+@@ -875,6 +879,8 @@ class fedpkgClient(cliClient):
+ ticket_body = {
+ 'action': 'new_repo',
+ 'branch': 'master',
++ 'bug_id': bug or '',
++ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
+ 'repo': repo_name,
+ 'description': description,
+diff --git a/test/test_cli.py b/test/test_cli.py
+index e78edc7..c25f6bb 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -1452,8 +1452,10 @@ class TestRequestTestsRepo(CliTestCase):
+ expected_issue_content = {
+ 'action': 'new_repo',
+ 'branch': 'master',
+- 'repo': 'foo',
++ 'bug_id': '',
++ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
++ 'repo': 'foo',
+ 'description': 'Some description'
+ }
+
+--
+2.21.1
+
diff --git a/0010-Check-missing-config-options-more-reliably.patch b/0010-Check-missing-config-options-more-reliably.patch
new file mode 100644
index 0000000..ca85f3a
--- /dev/null
+++ b/0010-Check-missing-config-options-more-reliably.patch
@@ -0,0 +1,284 @@
+From dcfdb9f532be3a05971982726d70d357bd2b7760 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Mon, 30 Mar 2020 04:01:52 +0200
+Subject: [PATCH] Check missing config options more reliably
+
+User's config file is not always updated with freshly added config
+options in fedpkg release. The reason could be the user's own changes
+in the config file prior to the upgrade. It needs user's action
+and this fix provides a hint when this problem is detected.
+
+Resolves: rhbz#1813338
+JIRA: COMPOSE-4228
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ conf/etc/rpkg/fedpkg.conf | 1 +
+ fedpkg/cli.py | 42 +++++++++++++----------
+ fedpkg/utils.py | 72 ++++++++++++++++++++++-----------------
+ test/test_utils.py | 15 ++++----
+ 4 files changed, 74 insertions(+), 56 deletions(-)
+
+diff --git a/conf/etc/rpkg/fedpkg.conf b/conf/etc/rpkg/fedpkg.conf
+index 0809aef..e3089bc 100644
+--- a/conf/etc/rpkg/fedpkg.conf
++++ b/conf/etc/rpkg/fedpkg.conf
+@@ -69,6 +69,7 @@ url = https://bugzilla.redhat.com/
+
+ [fedpkg.pagure]
+ url = https://pagure.io/
++token =
+
+ [fedpkg.pdc]
+ url = https://pdc.fedoraproject.org/
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index c43fcff..452026b 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -30,11 +30,10 @@ from six.moves.urllib_parse import urlparse
+
+ from fedpkg.bugzilla import BugzillaClient
+ from fedpkg.utils import (assert_new_tests_repo, assert_valid_epel_package,
+- do_fork, expand_release, get_dist_git_url,
+- get_distgit_token, get_fedora_release_state,
+- get_pagure_token, get_release_branches,
+- get_stream_branches, is_epel, new_pagure_issue,
+- sl_list_to_dict, verify_sls)
++ config_get_safely, do_fork, expand_release,
++ get_dist_git_url, get_fedora_release_state,
++ get_release_branches, get_stream_branches, is_epel,
++ new_pagure_issue, sl_list_to_dict, verify_sls)
+ from pyrpkg import rpkgError
+ from pyrpkg.cli import cliClient
+
+@@ -256,6 +255,9 @@ class fedpkgClient(cliClient):
+
+ def register_request_repo(self):
+ help_msg = 'Request a new dist-git repository'
++ pagure_section = '{0}.pagure'.format(self.name)
++ pagure_url = config_get_safely(self.config, pagure_section, 'url')
++ pagure_url_parsed = urlparse(pagure_url).netloc
+ description = textwrap.dedent('''
+ Request a new dist-git repository
+
+@@ -275,8 +277,7 @@ class fedpkgClient(cliClient):
+ Another example to request a module foo:
+
+ fedpkg request-repo --namespace modules foo
+- '''.format(self.name, urlparse(self.config.get(
+- '{0}.pagure'.format(self.name), 'url')).netloc))
++ '''.format(self.name, pagure_url_parsed))
+
+ request_repo_parser = self.subparsers.add_parser(
+ 'request-repo',
+@@ -322,8 +323,9 @@ class fedpkgClient(cliClient):
+
+ def register_request_tests_repo(self):
+ help_msg = 'Request a new tests dist-git repository'
+- pagure_url = urlparse(self.config.get(
+- '{0}.pagure'.format(self.name), 'url')).netloc
++ pagure_section = '{0}.pagure'.format(self.name)
++ pagure_url = config_get_safely(self.config, pagure_section, 'url')
++ pagure_url_parsed = urlparse(pagure_url).netloc
+ anongiturl = self.config.get(
+ self.name, 'anongiturl', vars={'repo': 'any', 'module': 'any'}
+ )
+@@ -346,7 +348,7 @@ class fedpkgClient(cliClient):
+
+ Note that the space name needs to reflect the intent of the tests and will
+ undergo a manual review.
+- '''.format(self.name, pagure_url, get_dist_git_url(anongiturl)))
++ '''.format(self.name, pagure_url_parsed, get_dist_git_url(anongiturl)))
+
+ request_tests_repo_parser = self.subparsers.add_parser(
+ 'request-tests-repo',
+@@ -441,6 +443,8 @@ class fedpkgClient(cliClient):
+
+ def register_do_fork(self):
+ help_msg = 'Create a new fork of the current repository'
++ distgit_section = '{0}.distgit'.format(self.name)
++ distgit_api_base_url = config_get_safely(self.config, distgit_section, "apibaseurl")
+ description = textwrap.dedent('''
+ Create a new fork of the current repository
+
+@@ -460,8 +464,7 @@ class fedpkgClient(cliClient):
+ username is taken. It could be overridden by reusing an argument:
+
+ {0} --user FAS_ID fork
+- '''.format(self.name, urlparse(self.config.get(
+- '{0}.distgit'.format(self.name), 'apibaseurl')).netloc))
++ '''.format(self.name, urlparse(distgit_api_base_url).netloc))
+
+ fork_parser = self.subparsers.add_parser(
+ 'fork',
+@@ -905,8 +908,9 @@ class fedpkgClient(cliClient):
+ ticket_body = '```\n{0}\n```'.format(ticket_body)
+ ticket_title = 'New Repo for "{0}/{1}"'.format(ns, repo_name)
+
+- pagure_url = config.get('{0}.pagure'.format(name), 'url')
+- pagure_token = get_pagure_token(config, name)
++ pagure_section = '{0}.pagure'.format(name)
++ pagure_url = config_get_safely(config, pagure_section, 'url')
++ pagure_token = config_get_safely(config, pagure_section, 'token')
+ print(new_pagure_issue(
+ pagure_url, pagure_token, ticket_title, ticket_body, name))
+
+@@ -1024,8 +1028,9 @@ class fedpkgClient(cliClient):
+ sl_dict = sl_list_to_dict(service_levels)
+ verify_sls(pdc_url, sl_dict)
+
+- pagure_url = config.get('{0}.pagure'.format(name), 'url')
+- pagure_token = get_pagure_token(config, name)
++ pagure_section = '{0}.pagure'.format(name)
++ pagure_url = config_get_safely(config, pagure_section, 'url')
++ pagure_token = config_get_safely(config, pagure_section, 'token')
+ if all_releases:
+ release_branches = list(itertools.chain(
+ *list(get_release_branches(pdc_url).values())))
+@@ -1097,13 +1102,14 @@ class fedpkgClient(cliClient):
+
+ def do_distgit_fork(self):
+ """create fork of the distgit repository"""
+- distgit_api_base_url = self.config.get('{0}.distgit'.format(self.name), "apibaseurl")
++ distgit_section = '{0}.distgit'.format(self.name)
++ distgit_api_base_url = config_get_safely(self.config, distgit_section, "apibaseurl")
+ distgit_remote_base_url = self.config.get(
+ '{0}'.format(self.name),
+ "gitbaseurl",
+ vars={'user': 'any', 'repo': 'any'},
+ )
+- distgit_token = get_distgit_token(self.config, self.name)
++ distgit_token = config_get_safely(self.config, distgit_section, 'token')
+
+ fork_url = do_fork(
+ base_url=distgit_api_base_url,
+diff --git a/fedpkg/utils.py b/fedpkg/utils.py
+index 3a1c04d..b639c4f 100644
+--- a/fedpkg/utils.py
++++ b/fedpkg/utils.py
+@@ -292,38 +292,6 @@ def verify_sls(pdc_url, sl_dict):
+ raise rpkgError('The SL "{0}" is not in PDC'.format(sl))
+
+
+-def get_pagure_token(config, cli_name):
+- """
+- Gets the Pagure token configured in the user's configuration file
+- :param config: ConfigParser object
+- :param cli_name: string of the CLI's name (e.g. fedpkg)
+- :return: string of the Pagure token
+- """
+- conf_section = '{0}.pagure'.format(cli_name)
+- try:
+- return config.get(conf_section, 'token')
+- except (NoSectionError, NoOptionError):
+- raise rpkgError(
+- 'Missing a Pagure token. Refer to the help of the current command '
+- '(-h/--help)" to set a token in your user configuration.')
+-
+-
+-def get_distgit_token(config, cli_name):
+- """
+- Gets the distgit token configured in the user's configuration file
+- :param config: ConfigParser object
+- :param cli_name: string of the CLI's name (e.g. fedpkg)
+- :return: string of the distgit token
+- """
+- conf_section = '{0}.distgit'.format(cli_name)
+- try:
+- return config.get(conf_section, 'token')
+- except (NoSectionError, NoOptionError):
+- raise rpkgError(
+- 'Missing a distgit token. Refer to the help of the current command '
+- '(-h/--help)" to set a token in your user configuration.')
+-
+-
+ def is_epel(branch):
+ """
+ Determines if this is or will be an epel branch
+@@ -524,3 +492,43 @@ def get_fedora_release_state(config, cli_name, release):
+ raise rpkgError(base_error_msg.format(rv.text))
+
+ return rv.json().get('state')
++
++
++def config_get_safely(config, section, option):
++ """
++ Returns option from the user's configuration file. In case of missing
++ section or option method throws an exception with a human-readable
++ warning and a possible hint.
++ The method should be used especially in situations when there are newly
++ added sections/options into the config. In this case, there is a risk that
++ the user's config wasn't properly upgraded.
++
++ :param config: ConfigParser object
++ :param section: section name in the config
++ :param option: name of the option
++ :return: option value from the right section
++ :rtype: str
++ """
++
++ hint = (
++ "First (if possible), refer to the help of the current command "
++ "(-h/--help).\n"
++ "There also might be a new version of the config after upgrade.\n"
++ "Hint: you can check if you have 'fedpkg.conf.rpmnew' or "
++ "'fedpkg.conf.rpmsave' in the config directory. If yes, try to merge "
++ "your changes to the config with the maintainer provided version "
++ "(or replace fedpkg.conf file with 'fedpkg.conf.rpmnew')."
++ )
++
++ try:
++ return config.get(section, option)
++ except NoSectionError:
++ msg = "Missing section '{0}' in the config file.".format(section)
++ raise rpkgError("{0}\n{1}".format(msg, hint))
++ except NoOptionError:
++ msg = "Missing option '{0}' in the section '{1}' of the config file.".format(
++ option, section
++ )
++ raise rpkgError("{0}\n{1}".format(msg, hint))
++ except Exception:
++ raise
+diff --git a/test/test_utils.py b/test/test_utils.py
+index f7db2e4..904b3cb 100644
+--- a/test/test_utils.py
++++ b/test/test_utils.py
+@@ -177,13 +177,13 @@ class TestAssertNewTestsRepo(unittest.TestCase):
+
+
+ class TestGetPagureToken(unittest.TestCase):
+- """Test get_pagure_token"""
++ """Test obtaining of Pagure token"""
+
+ def test_return_token(self):
+ config = Mock()
+ config.get.return_value = '123456'
+
+- token = utils.get_pagure_token(config, 'fedpkg')
++ token = utils.config_get_safely(config, 'fedpkg.pagure', 'token')
+
+ self.assertEqual('123456', token)
+ config.get.assert_called_once_with('fedpkg.pagure', 'token')
+@@ -192,12 +192,15 @@ class TestGetPagureToken(unittest.TestCase):
+ config = Mock()
+
+ config.get.side_effect = NoOptionError('token', 'fedpkg.pagure')
+- six.assertRaisesRegex(self, rpkgError, 'Missing a Pagure token',
+- utils.get_pagure_token, config, 'fedpkg')
++ six.assertRaisesRegex(self,
++ rpkgError, "Missing option 'token' in the section 'fedpkg.pagure'",
++ utils.config_get_safely,
++ config,
++ 'fedpkg.pagure', 'token')
+
+ config.get.side_effect = NoSectionError('fedpkg.pagure')
+- six.assertRaisesRegex(self, rpkgError, 'Missing a Pagure token',
+- utils.get_pagure_token, config, 'fedpkg')
++ six.assertRaisesRegex(self, rpkgError, "Missing section 'fedpkg.pagure'",
++ utils.config_get_safely, config, 'fedpkg.pagure', 'token')
+
+
+ @patch('requests.get')
+--
+2.21.1
+
diff --git a/fedpkg.spec b/fedpkg.spec
index 9c4a9af..6cf42d9 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,7 +5,7 @@
Name: fedpkg
Version: 1.38
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
@@ -15,9 +15,12 @@ Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2
BuildArch: noarch
Patch1: 0006-display_name-added-to-bodhi.template.patch
Patch2: 0007-Move-rpm-dependency-for-test-environment-only.patch
+Patch3: 0008-Repair-test-of-retire-command-after-rpkg-update.patch
+Patch4: 0009-Body-changes-for-requesting-new-test-repo.patch
+Patch5: 0010-Check-missing-config-options-more-reliably.patch
# fedpkg command switched to python3 on Fedora 29 and RHEL > 7:
-%if 0%{?fedora} > 28 || 0%{?rhel} > 7
+%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_with python2
%else
%bcond_without python2
@@ -165,6 +168,12 @@ nosetests
%changelog
+* Mon Mar 30 2020 Ondřej Nosek <onosek@redhat.com> - 1.38-3
+ Patches:
+ - Repair test of "retire" command after rpkg update
+ - Body changes for requesting new test repo
+ - Check missing config options more reliably
+
* Fri Mar 06 2020 Ondřej Nosek <onosek@redhat.com> - 1.38-2
- Patch: Move rpm dependency for test environment only
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [rpms/fedpkg] 1.48-1: Patches
@ 2026-08-10 21:45
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-08-10 21:45 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : caa66fd923c9ad7b689cf79b1a1a9333bb22e4be
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2021-01-21T23:03:10+00:00
Stats : +440/-5 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/caa66fd923c9ad7b689cf79b1a1a9333bb22e4be?branch=1.48-1
Log:
Patches
- Fedpkg update didn't read bug numbers from changelog
- New default dist-git branch: rawhide
- New default dist-git branch: rawhide - unittests
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0002-Fedpkg-update-didn-t-read-bug-numbers-from-changelog.patch b/0002-Fedpkg-update-didn-t-read-bug-numbers-from-changelog.patch
new file mode 100644
index 0000000..36b5667
--- /dev/null
+++ b/0002-Fedpkg-update-didn-t-read-bug-numbers-from-changelog.patch
@@ -0,0 +1,67 @@
+From 87e4a22aa965ad625ba063e81f03f3db87119e1a Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Mon, 11 Jan 2021 03:59:51 +0100
+Subject: [PATCH 1/3] Fedpkg update didn't read bug numbers from changelog
+
+Fixes the regular expression by accepting whitespaces at the beginning
+of the pattern which finds bug numbers.
+
+JIRA: RHELCMP-3685
+Resolves: rhbz#1912555
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ fedpkg/cli.py | 2 +-
+ test/test_cli.py | 9 +++++----
+ 2 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index 18a683f..c6ccd95 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -703,7 +703,7 @@ class fedpkgClient(cliClient):
+ id_pattern_raw = r'(?:fedora|epel|rh(?:bz)?)#(\d{5,})'
+ bz_pattern = re.compile(
+ # says: there is at least one complete (including prefix) Bugzilla bug occurrence
+- r'(?:fix(?:es)?|close(?:s)?|resolve(?:s)?)(?::|:\s+|\s+)' + id_pattern_raw,
++ r'\s*(?:fix(?:es)?|close(?:s)?|resolve(?:s)?)(?::|:\s+|\s+)' + id_pattern_raw,
+ re.IGNORECASE,
+ )
+ id_pattern = re.compile(id_pattern_raw, re.IGNORECASE)
+diff --git a/test/test_cli.py b/test/test_cli.py
+index 08bd7eb..b816558 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -123,8 +123,9 @@ class TestUpdate(CliTestCase):
+ 'New command update - #1000', # invalid bug id format
+ 'Fix tests - #2000, #notabug', # both invalid bug id format
+ '处理一些Unicode字符číář',
+- 'fix: rh#10001'
+- 'Fixes: rhbz#20001'
++ 'fix: rh#10001',
++ 'Fixes: rhbz#20001',
++ ' close: fedora#30001', # test whitespace at the beginning
+ ]))
+ clog_file = os.path.join(self.cloned_repo_path, 'clog')
+ with io.open(clog_file, 'w', encoding='utf-8') as f:
+@@ -190,7 +191,7 @@ class TestUpdate(CliTestCase):
+
+ expected_data = {
+ 'autokarma': 'True',
+- 'bugs': '10001,20001',
++ 'bugs': '10001,20001,30001',
+ 'display_name': six.u(''),
+ 'builds': ' {0} '.format(self.mock_nvr.return_value),
+ 'close_bugs': True,
+@@ -228,7 +229,7 @@ class TestUpdate(CliTestCase):
+ with io.open('bodhi.template', encoding='utf-8') as f:
+ bodhi_template = f.read()
+ self.assertTrue(self.mock_nvr.return_value in bodhi_template)
+- self.assertTrue('10001,20001' in bodhi_template)
++ self.assertTrue('10001,20001,30001' in bodhi_template)
+ if notes:
+ self.assertTrue(notes.replace('\n', '\n ') in bodhi_template)
+ else:
+--
+2.26.2
+
diff --git a/0003-New-default-dist-git-branch-rawhide.patch b/0003-New-default-dist-git-branch-rawhide.patch
new file mode 100644
index 0000000..0608def
--- /dev/null
+++ b/0003-New-default-dist-git-branch-rawhide.patch
@@ -0,0 +1,154 @@
+From 08a33c11754b79e190e8d469bc1067be62cee70a Mon Sep 17 00:00:00 2001
+From: Pierre-Yves Chibon <pingou@pingoured.fr>
+Date: Tue, 12 Jan 2021 21:54:23 +0100
+Subject: [PATCH 2/3] New default dist-git branch: rawhide
+
+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>
+Co-authored-by: Mohan Boddu <mboddu@bhujji.com>
+---
+ fedpkg/__init__.py | 14 +++++++-------
+ fedpkg/cli.py | 12 ++++++------
+ fedpkg/utils.py | 8 ++++----
+ 3 files changed, 17 insertions(+), 17 deletions(-)
+
+diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py
+index c070416..8eecc59 100644
+--- a/fedpkg/__init__.py
++++ b/fedpkg/__init__.py
+@@ -168,9 +168,9 @@ class Commands(pyrpkg.Commands):
+ "--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$', self.branch_merge) or re.match(r'rawhide$', self.branch_merge) or re.match(r'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 @@ class Commands(pyrpkg.Commands):
+ 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 @@ class Commands(pyrpkg.Commands):
+
+ 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:
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index c6ccd95..1d790ee 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -110,7 +110,7 @@ class fedpkgClient(cliClient):
+ 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 @@ class fedpkgClient(cliClient):
+ 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 @@ class fedpkgClient(cliClient):
+ 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 @@ class fedpkgClient(cliClient):
+ :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 @@ class fedpkgClient(cliClient):
+
+ ticket_body = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': bug or '',
+ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
+@@ -1097,7 +1097,7 @@ class fedpkgClient(cliClient):
+ logger=logger,
+ repo_name=repo_name,
+ ns='modules',
+- branch='master',
++ branch='rawhide',
+ summary=summary,
+ description=summary,
+ upstreamurl=None,
+diff --git a/fedpkg/utils.py b/fedpkg/utils.py
+index 2c790c7..6bf3d0a 100644
+--- a/fedpkg/utils.py
++++ b/fedpkg/utils.py
+@@ -430,13 +430,13 @@ def get_stream_branches(server_url, package_name):
+ 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 @@ def expand_release(rel, active_releases):
+ 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':
+--
+2.26.2
+
diff --git a/0004-New-default-dist-git-branch-rawhide-unittests.patch b/0004-New-default-dist-git-branch-rawhide-unittests.patch
new file mode 100644
index 0000000..37e1abb
--- /dev/null
+++ b/0004-New-default-dist-git-branch-rawhide-unittests.patch
@@ -0,0 +1,205 @@
+From 34a971b2b85a260e8df129a0ed2e2472edb29d3e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
+Date: Wed, 13 Jan 2021 10:13:38 +0100
+Subject: [PATCH 3/3] New default dist-git branch: rawhide - unittests
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
+Co-authored-by: Mohan Boddu <mboddu@bhujji.com>
+
+Merges: https://pagure.io/fedpkg/pull-request/424
+---
+ fedpkg/__init__.py | 2 +-
+ test/test_cli.py | 18 +++++++++---------
+ test/test_commands.py | 20 ++++++++++----------
+ test/test_utils.py | 6 +++++-
+ 4 files changed, 25 insertions(+), 21 deletions(-)
+
+diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py
+index 8eecc59..2ec2d6e 100644
+--- a/fedpkg/__init__.py
++++ b/fedpkg/__init__.py
+@@ -169,7 +169,7 @@ class Commands(pyrpkg.Commands):
+ "--define 'rhel %s'" % macros['rhel'],
+ ]
+ # rawhide (previously master branch)
+- elif re.match(r'master$', self.branch_merge) or re.match(r'rawhide$', self.branch_merge) or re.match(r'main$', self.branch_merge):
++ elif re.match(r'(master|rawhide|main)$', self.branch_merge):
+ self._distval = self._findrawhidebranch()
+ self._distvar = 'fedora'
+ self._disttag = 'fc%s' % self._distval
+diff --git a/test/test_cli.py b/test/test_cli.py
+index b816558..a20357f 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -468,7 +468,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': 1441813,
+ 'description': '',
+ 'exception': False,
+@@ -505,7 +505,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': 1441813,
+ 'description': '',
+ 'exception': False,
+@@ -545,7 +545,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': '',
+ 'description': '',
+ 'exception': False,
+@@ -586,7 +586,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': 1441813,
+ 'description': '',
+ 'exception': False,
+@@ -627,7 +627,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': 1441813,
+ 'description': 'a description',
+ 'exception': False,
+@@ -663,7 +663,7 @@ class TestRequestRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': '',
+ 'description': '',
+ 'exception': True,
+@@ -1192,7 +1192,7 @@ class TestRequestBranch(CliTestCase):
+ 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 @@ class TestRequestTestsRepo(CliTestCase):
+
+ expected_issue_content = {
+ 'action': 'new_repo',
+- 'branch': 'master',
++ 'branch': 'rawhide',
+ 'bug_id': '',
+ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
+@@ -2189,7 +2189,7 @@ class TestReadReleasesFromLocalConfig(CliTestCase):
+
+ 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):
+diff --git a/test/test_commands.py b/test/test_commands.py
+index 3e9be98..c45d251 100644
+--- a/test/test_commands.py
++++ b/test/test_commands.py
+@@ -262,9 +262,9 @@ class TestLoadRpmDefines(CommandTestCase):
+ 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 @@ class TestLoadRpmDefines(CommandTestCase):
+ 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 @@ class TestFindMasterBranch(CommandTestCase):
+ 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 @@ class TestFindMasterBranch(CommandTestCase):
+ 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 @@ class TestFindMasterBranch(CommandTestCase):
+ # 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 @@ class TestFindMasterBranch(CommandTestCase):
+
+ six.assertRaisesRegex(
+ self, rpkgError, 'Unable to find rawhide target',
+- self.cmd._findmasterbranch)
++ self.cmd._findrawhidebranch)
+
+
+ class TestOverrideBuildURL(CommandTestCase):
+diff --git a/test/test_utils.py b/test/test_utils.py
+index 9697512..939f60b 100644
+--- a/test/test_utils.py
++++ b/test/test_utils.py
+@@ -505,7 +505,11 @@ class TestExpandRelease(unittest.TestCase):
+
+ 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)
+--
+2.26.2
+
diff --git a/fedpkg.spec b/fedpkg.spec
index e1793f7..6e22fec 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,7 +5,7 @@
Name: fedpkg
Version: 1.40
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
@@ -14,6 +14,9 @@ Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2
BuildArch: noarch
Patch1: 0001-Do-not-use-pytest-related-dependencies-temporarily.patch
+Patch2: 0002-Fedpkg-update-didn-t-read-bug-numbers-from-changelog.patch
+Patch3: 0003-New-default-dist-git-branch-rawhide.patch
+Patch4: 0004-New-default-dist-git-branch-rawhide-unittests.patch
# RHEL7 is currently the only release that is built for Python 2.
%if 0%{?fedora} || 0%{?rhel} > 7
@@ -36,7 +39,7 @@ Requires: redhat-rpm-config
BuildRequires: python2-devel
# We br these things for man page generation due to imports
-BuildRequires: python2-rpkg >= 1.61-1
+BuildRequires: python2-rpkg >= 1.62-1
BuildRequires: python2-distro
BuildRequires: python2-fedora
# For testing
@@ -50,7 +53,7 @@ BuildRequires: python-bugzilla
Requires: bodhi-client >= 2.0
Requires: python-bugzilla
-Requires: python2-rpkg >= 1.61-1
+Requires: python2-rpkg >= 1.62-1
Requires: python2-distro
Requires: python2-fedora
Requires: python2-openidc-client >= 0.6.0
@@ -61,7 +64,7 @@ Requires: python2-openidc-client >= 0.6.0
%global __python %{__python3}
BuildRequires: python3-devel
-BuildRequires: python3-rpkg >= 1.61-1
+BuildRequires: python3-rpkg >= 1.62-1
BuildRequires: python3-distro
BuildRequires: python3-fedora
# For testing
@@ -74,7 +77,7 @@ BuildRequires: python3-bodhi-client
Requires: python3-bugzilla
-Requires: python3-rpkg >= 1.61-1
+Requires: python3-rpkg >= 1.62-1
Requires: python3-distro
Requires: python3-fedora
Requires: python3-openidc-client >= 0.6.0
@@ -143,6 +146,12 @@ mv %{buildroot}%{compdir}/fedpkg.bash %{buildroot}%{compdir}/fedpkg
%changelog
+* Thu Jan 21 2021 Ondřej Nosek <onosek@redhat.com> - 1.40-2
+- Patches:
+- Fedpkg update didn't read bug numbers from changelog
+- New default dist-git branch: rawhide
+- New default dist-git branch: rawhide - unittests
+
* Fri Dec 04 2020 Ondřej Nosek <onosek@redhat.com> - 1.40-1
- Tests for "--release eln" (onosek)
- Add support for using "--release eln" (mmathesi)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [rpms/fedpkg] 1.48-1: Patches
@ 2026-08-10 21:45
0 siblings, 0 replies; 3+ messages in thread
From: @ 2026-08-10 21:45 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : 959fe284c39064856d1ca5cb851e373d42e7a427
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2020-03-30T15:59:20+00:00
Stats : +396/-2 in 4 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/959fe284c39064856d1ca5cb851e373d42e7a427?branch=1.48-1
Log:
Patches
- Repair test of "retire" command after rpkg update
- Body changes for requesting new test repo
- Check missing config options more reliably
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0008-Repair-test-of-retire-command-after-rpkg-update.patch b/0008-Repair-test-of-retire-command-after-rpkg-update.patch
new file mode 100644
index 0000000..fdeade4
--- /dev/null
+++ b/0008-Repair-test-of-retire-command-after-rpkg-update.patch
@@ -0,0 +1,26 @@
+From 58533b8fb6e1eb7daa938ef2bc2b8a3d778469de Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 25 Mar 2020 23:27:39 +0100
+Subject: [PATCH 1/3] Repair test of "retire" command after rpkg update
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ test/test_retire.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_retire.py b/test/test_retire.py
+index 153dbc9..f6b40cc 100644
+--- a/test/test_retire.py
++++ b/test/test_retire.py
+@@ -105,7 +105,7 @@ class RetireTestCase(unittest.TestCase):
+ client.log = mock.Mock()
+ client.retire()
+ args, kwargs = client.log.warn.call_args
+- self.assertIn('dead.package found, package probably already retired',
++ self.assertIn('dead.package found, package or module is already retired',
+ args[0])
+
+ @mock.patch(
+--
+2.21.1
+
diff --git a/0009-Body-changes-for-requesting-new-test-repo.patch b/0009-Body-changes-for-requesting-new-test-repo.patch
new file mode 100644
index 0000000..83971b0
--- /dev/null
+++ b/0009-Body-changes-for-requesting-new-test-repo.patch
@@ -0,0 +1,74 @@
+From 5672d905e430dc599c4e1a9b2a3c447c225f63ab Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Wed, 25 Mar 2020 18:08:03 +0100
+Subject: [PATCH 1/2] Body changes for requesting new test repo
+
+Adds new fields 'bug_id' (optional) and 'monitor' (fixed)
+
+Relates: https://pagure.io/fedscm-admin/issue/22
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ fedpkg/cli.py | 8 +++++++-
+ test/test_cli.py | 4 +++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index e2291ff..c43fcff 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -359,6 +359,9 @@ class fedpkgClient(cliClient):
+ request_tests_repo_parser.add_argument(
+ 'description',
+ help='Description of the tests repository')
++ request_tests_repo_parser.add_argument(
++ '--bug', type=int,
++ help='Bugzilla bug ID of the package review request.')
+ request_tests_repo_parser.set_defaults(command=self.request_tests_repo)
+
+ def register_request_branch(self):
+@@ -801,6 +804,7 @@ class fedpkgClient(cliClient):
+ repo_name=self.args.name,
+ ns='tests',
+ description=self.args.description,
++ bug=self.args.bug,
+ name=self.name,
+ config=self.config,
+ anongiturl=self.cmd.anongiturl
+@@ -862,7 +866,7 @@ class fedpkgClient(cliClient):
+ .format(repo_name))
+
+ summary_from_bug = ''
+- if bug and ns not in ['tests', 'modules', 'flatpaks']:
++ if bug and ns not in ['modules', 'flatpaks']:
+ bz_url = config.get('{0}.bugzilla'.format(name), 'url')
+ bz_client = BugzillaClient(bz_url)
+ bug_obj = bz_client.get_review_bug(bug, ns, repo_name)
+@@ -875,6 +879,8 @@ class fedpkgClient(cliClient):
+ ticket_body = {
+ 'action': 'new_repo',
+ 'branch': 'master',
++ 'bug_id': bug or '',
++ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
+ 'repo': repo_name,
+ 'description': description,
+diff --git a/test/test_cli.py b/test/test_cli.py
+index e78edc7..c25f6bb 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -1452,8 +1452,10 @@ class TestRequestTestsRepo(CliTestCase):
+ expected_issue_content = {
+ 'action': 'new_repo',
+ 'branch': 'master',
+- 'repo': 'foo',
++ 'bug_id': '',
++ 'monitor': 'no-monitoring',
+ 'namespace': 'tests',
++ 'repo': 'foo',
+ 'description': 'Some description'
+ }
+
+--
+2.21.1
+
diff --git a/0010-Check-missing-config-options-more-reliably.patch b/0010-Check-missing-config-options-more-reliably.patch
new file mode 100644
index 0000000..ca85f3a
--- /dev/null
+++ b/0010-Check-missing-config-options-more-reliably.patch
@@ -0,0 +1,284 @@
+From dcfdb9f532be3a05971982726d70d357bd2b7760 Mon Sep 17 00:00:00 2001
+From: Ondrej Nosek <onosek@redhat.com>
+Date: Mon, 30 Mar 2020 04:01:52 +0200
+Subject: [PATCH] Check missing config options more reliably
+
+User's config file is not always updated with freshly added config
+options in fedpkg release. The reason could be the user's own changes
+in the config file prior to the upgrade. It needs user's action
+and this fix provides a hint when this problem is detected.
+
+Resolves: rhbz#1813338
+JIRA: COMPOSE-4228
+
+Signed-off-by: Ondrej Nosek <onosek@redhat.com>
+---
+ conf/etc/rpkg/fedpkg.conf | 1 +
+ fedpkg/cli.py | 42 +++++++++++++----------
+ fedpkg/utils.py | 72 ++++++++++++++++++++++-----------------
+ test/test_utils.py | 15 ++++----
+ 4 files changed, 74 insertions(+), 56 deletions(-)
+
+diff --git a/conf/etc/rpkg/fedpkg.conf b/conf/etc/rpkg/fedpkg.conf
+index 0809aef..e3089bc 100644
+--- a/conf/etc/rpkg/fedpkg.conf
++++ b/conf/etc/rpkg/fedpkg.conf
+@@ -69,6 +69,7 @@ url = https://bugzilla.redhat.com/
+
+ [fedpkg.pagure]
+ url = https://pagure.io/
++token =
+
+ [fedpkg.pdc]
+ url = https://pdc.fedoraproject.org/
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index c43fcff..452026b 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -30,11 +30,10 @@ from six.moves.urllib_parse import urlparse
+
+ from fedpkg.bugzilla import BugzillaClient
+ from fedpkg.utils import (assert_new_tests_repo, assert_valid_epel_package,
+- do_fork, expand_release, get_dist_git_url,
+- get_distgit_token, get_fedora_release_state,
+- get_pagure_token, get_release_branches,
+- get_stream_branches, is_epel, new_pagure_issue,
+- sl_list_to_dict, verify_sls)
++ config_get_safely, do_fork, expand_release,
++ get_dist_git_url, get_fedora_release_state,
++ get_release_branches, get_stream_branches, is_epel,
++ new_pagure_issue, sl_list_to_dict, verify_sls)
+ from pyrpkg import rpkgError
+ from pyrpkg.cli import cliClient
+
+@@ -256,6 +255,9 @@ class fedpkgClient(cliClient):
+
+ def register_request_repo(self):
+ help_msg = 'Request a new dist-git repository'
++ pagure_section = '{0}.pagure'.format(self.name)
++ pagure_url = config_get_safely(self.config, pagure_section, 'url')
++ pagure_url_parsed = urlparse(pagure_url).netloc
+ description = textwrap.dedent('''
+ Request a new dist-git repository
+
+@@ -275,8 +277,7 @@ class fedpkgClient(cliClient):
+ Another example to request a module foo:
+
+ fedpkg request-repo --namespace modules foo
+- '''.format(self.name, urlparse(self.config.get(
+- '{0}.pagure'.format(self.name), 'url')).netloc))
++ '''.format(self.name, pagure_url_parsed))
+
+ request_repo_parser = self.subparsers.add_parser(
+ 'request-repo',
+@@ -322,8 +323,9 @@ class fedpkgClient(cliClient):
+
+ def register_request_tests_repo(self):
+ help_msg = 'Request a new tests dist-git repository'
+- pagure_url = urlparse(self.config.get(
+- '{0}.pagure'.format(self.name), 'url')).netloc
++ pagure_section = '{0}.pagure'.format(self.name)
++ pagure_url = config_get_safely(self.config, pagure_section, 'url')
++ pagure_url_parsed = urlparse(pagure_url).netloc
+ anongiturl = self.config.get(
+ self.name, 'anongiturl', vars={'repo': 'any', 'module': 'any'}
+ )
+@@ -346,7 +348,7 @@ class fedpkgClient(cliClient):
+
+ Note that the space name needs to reflect the intent of the tests and will
+ undergo a manual review.
+- '''.format(self.name, pagure_url, get_dist_git_url(anongiturl)))
++ '''.format(self.name, pagure_url_parsed, get_dist_git_url(anongiturl)))
+
+ request_tests_repo_parser = self.subparsers.add_parser(
+ 'request-tests-repo',
+@@ -441,6 +443,8 @@ class fedpkgClient(cliClient):
+
+ def register_do_fork(self):
+ help_msg = 'Create a new fork of the current repository'
++ distgit_section = '{0}.distgit'.format(self.name)
++ distgit_api_base_url = config_get_safely(self.config, distgit_section, "apibaseurl")
+ description = textwrap.dedent('''
+ Create a new fork of the current repository
+
+@@ -460,8 +464,7 @@ class fedpkgClient(cliClient):
+ username is taken. It could be overridden by reusing an argument:
+
+ {0} --user FAS_ID fork
+- '''.format(self.name, urlparse(self.config.get(
+- '{0}.distgit'.format(self.name), 'apibaseurl')).netloc))
++ '''.format(self.name, urlparse(distgit_api_base_url).netloc))
+
+ fork_parser = self.subparsers.add_parser(
+ 'fork',
+@@ -905,8 +908,9 @@ class fedpkgClient(cliClient):
+ ticket_body = '```\n{0}\n```'.format(ticket_body)
+ ticket_title = 'New Repo for "{0}/{1}"'.format(ns, repo_name)
+
+- pagure_url = config.get('{0}.pagure'.format(name), 'url')
+- pagure_token = get_pagure_token(config, name)
++ pagure_section = '{0}.pagure'.format(name)
++ pagure_url = config_get_safely(config, pagure_section, 'url')
++ pagure_token = config_get_safely(config, pagure_section, 'token')
+ print(new_pagure_issue(
+ pagure_url, pagure_token, ticket_title, ticket_body, name))
+
+@@ -1024,8 +1028,9 @@ class fedpkgClient(cliClient):
+ sl_dict = sl_list_to_dict(service_levels)
+ verify_sls(pdc_url, sl_dict)
+
+- pagure_url = config.get('{0}.pagure'.format(name), 'url')
+- pagure_token = get_pagure_token(config, name)
++ pagure_section = '{0}.pagure'.format(name)
++ pagure_url = config_get_safely(config, pagure_section, 'url')
++ pagure_token = config_get_safely(config, pagure_section, 'token')
+ if all_releases:
+ release_branches = list(itertools.chain(
+ *list(get_release_branches(pdc_url).values())))
+@@ -1097,13 +1102,14 @@ class fedpkgClient(cliClient):
+
+ def do_distgit_fork(self):
+ """create fork of the distgit repository"""
+- distgit_api_base_url = self.config.get('{0}.distgit'.format(self.name), "apibaseurl")
++ distgit_section = '{0}.distgit'.format(self.name)
++ distgit_api_base_url = config_get_safely(self.config, distgit_section, "apibaseurl")
+ distgit_remote_base_url = self.config.get(
+ '{0}'.format(self.name),
+ "gitbaseurl",
+ vars={'user': 'any', 'repo': 'any'},
+ )
+- distgit_token = get_distgit_token(self.config, self.name)
++ distgit_token = config_get_safely(self.config, distgit_section, 'token')
+
+ fork_url = do_fork(
+ base_url=distgit_api_base_url,
+diff --git a/fedpkg/utils.py b/fedpkg/utils.py
+index 3a1c04d..b639c4f 100644
+--- a/fedpkg/utils.py
++++ b/fedpkg/utils.py
+@@ -292,38 +292,6 @@ def verify_sls(pdc_url, sl_dict):
+ raise rpkgError('The SL "{0}" is not in PDC'.format(sl))
+
+
+-def get_pagure_token(config, cli_name):
+- """
+- Gets the Pagure token configured in the user's configuration file
+- :param config: ConfigParser object
+- :param cli_name: string of the CLI's name (e.g. fedpkg)
+- :return: string of the Pagure token
+- """
+- conf_section = '{0}.pagure'.format(cli_name)
+- try:
+- return config.get(conf_section, 'token')
+- except (NoSectionError, NoOptionError):
+- raise rpkgError(
+- 'Missing a Pagure token. Refer to the help of the current command '
+- '(-h/--help)" to set a token in your user configuration.')
+-
+-
+-def get_distgit_token(config, cli_name):
+- """
+- Gets the distgit token configured in the user's configuration file
+- :param config: ConfigParser object
+- :param cli_name: string of the CLI's name (e.g. fedpkg)
+- :return: string of the distgit token
+- """
+- conf_section = '{0}.distgit'.format(cli_name)
+- try:
+- return config.get(conf_section, 'token')
+- except (NoSectionError, NoOptionError):
+- raise rpkgError(
+- 'Missing a distgit token. Refer to the help of the current command '
+- '(-h/--help)" to set a token in your user configuration.')
+-
+-
+ def is_epel(branch):
+ """
+ Determines if this is or will be an epel branch
+@@ -524,3 +492,43 @@ def get_fedora_release_state(config, cli_name, release):
+ raise rpkgError(base_error_msg.format(rv.text))
+
+ return rv.json().get('state')
++
++
++def config_get_safely(config, section, option):
++ """
++ Returns option from the user's configuration file. In case of missing
++ section or option method throws an exception with a human-readable
++ warning and a possible hint.
++ The method should be used especially in situations when there are newly
++ added sections/options into the config. In this case, there is a risk that
++ the user's config wasn't properly upgraded.
++
++ :param config: ConfigParser object
++ :param section: section name in the config
++ :param option: name of the option
++ :return: option value from the right section
++ :rtype: str
++ """
++
++ hint = (
++ "First (if possible), refer to the help of the current command "
++ "(-h/--help).\n"
++ "There also might be a new version of the config after upgrade.\n"
++ "Hint: you can check if you have 'fedpkg.conf.rpmnew' or "
++ "'fedpkg.conf.rpmsave' in the config directory. If yes, try to merge "
++ "your changes to the config with the maintainer provided version "
++ "(or replace fedpkg.conf file with 'fedpkg.conf.rpmnew')."
++ )
++
++ try:
++ return config.get(section, option)
++ except NoSectionError:
++ msg = "Missing section '{0}' in the config file.".format(section)
++ raise rpkgError("{0}\n{1}".format(msg, hint))
++ except NoOptionError:
++ msg = "Missing option '{0}' in the section '{1}' of the config file.".format(
++ option, section
++ )
++ raise rpkgError("{0}\n{1}".format(msg, hint))
++ except Exception:
++ raise
+diff --git a/test/test_utils.py b/test/test_utils.py
+index f7db2e4..904b3cb 100644
+--- a/test/test_utils.py
++++ b/test/test_utils.py
+@@ -177,13 +177,13 @@ class TestAssertNewTestsRepo(unittest.TestCase):
+
+
+ class TestGetPagureToken(unittest.TestCase):
+- """Test get_pagure_token"""
++ """Test obtaining of Pagure token"""
+
+ def test_return_token(self):
+ config = Mock()
+ config.get.return_value = '123456'
+
+- token = utils.get_pagure_token(config, 'fedpkg')
++ token = utils.config_get_safely(config, 'fedpkg.pagure', 'token')
+
+ self.assertEqual('123456', token)
+ config.get.assert_called_once_with('fedpkg.pagure', 'token')
+@@ -192,12 +192,15 @@ class TestGetPagureToken(unittest.TestCase):
+ config = Mock()
+
+ config.get.side_effect = NoOptionError('token', 'fedpkg.pagure')
+- six.assertRaisesRegex(self, rpkgError, 'Missing a Pagure token',
+- utils.get_pagure_token, config, 'fedpkg')
++ six.assertRaisesRegex(self,
++ rpkgError, "Missing option 'token' in the section 'fedpkg.pagure'",
++ utils.config_get_safely,
++ config,
++ 'fedpkg.pagure', 'token')
+
+ config.get.side_effect = NoSectionError('fedpkg.pagure')
+- six.assertRaisesRegex(self, rpkgError, 'Missing a Pagure token',
+- utils.get_pagure_token, config, 'fedpkg')
++ six.assertRaisesRegex(self, rpkgError, "Missing section 'fedpkg.pagure'",
++ utils.config_get_safely, config, 'fedpkg.pagure', 'token')
+
+
+ @patch('requests.get')
+--
+2.21.1
+
diff --git a/fedpkg.spec b/fedpkg.spec
index e3aa81f..6cf42d9 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,7 +5,7 @@
Name: fedpkg
Version: 1.38
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
@@ -13,10 +13,14 @@ URL: https://pagure.io/fedpkg
Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2
BuildArch: noarch
+Patch1: 0006-display_name-added-to-bodhi.template.patch
Patch2: 0007-Move-rpm-dependency-for-test-environment-only.patch
+Patch3: 0008-Repair-test-of-retire-command-after-rpkg-update.patch
+Patch4: 0009-Body-changes-for-requesting-new-test-repo.patch
+Patch5: 0010-Check-missing-config-options-more-reliably.patch
# fedpkg command switched to python3 on Fedora 29 and RHEL > 7:
-%if 0%{?fedora} > 28 || 0%{?rhel} > 7
+%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_with python2
%else
%bcond_without python2
@@ -164,6 +168,12 @@ nosetests
%changelog
+* Mon Mar 30 2020 Ondřej Nosek <onosek@redhat.com> - 1.38-3
+ Patches:
+ - Repair test of "retire" command after rpkg update
+ - Body changes for requesting new test repo
+ - Check missing config options more reliably
+
* Fri Mar 06 2020 Ondřej Nosek <onosek@redhat.com> - 1.38-2
- Patch: Move rpm dependency for test environment only
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-10 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:45 [rpms/fedpkg] 1.48-1: Patches
-- strict thread matches above, loose matches on Subject: below --
2026-08-10 21:45
2026-08-10 21:45
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox