public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/fedpkg] 1.48-1: Patches
Date: Mon, 10 Aug 2026 21:45:51 GMT	[thread overview]
Message-ID: <178639835147.1.12931742330701773188.rpms-fedpkg-212861f3bc73@fedoraproject.org> (raw)

            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
 

             reply	other threads:[~2026-08-10 21:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 21:45  [this message]
2026-08-10 21:45 [rpms/fedpkg] 1.48-1: Patches 
2026-08-10 21:45 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178639835147.1.12931742330701773188.rpms-fedpkg-212861f3bc73@fedoraproject.org \
    --to=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox