public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/fedpkg] 1.48-1: Few patches and dependency change
@ 2026-08-10 21:46
0 siblings, 0 replies; only message in thread
From: @ 2026-08-10 21:46 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/fedpkg
Branch : 1.48-1
Commit : 06ae89e8e6ecac85a476cb92cceba4bd187c7b57
Author : Ondřej Nosek <onosek@redhat.com>
Date : 2022-04-26T01:16:11+00:00
Stats : +479/-6 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/fedpkg/c/06ae89e8e6ecac85a476cb92cceba4bd187c7b57?branch=1.48-1
Log:
Few patches and dependency change
Patch: fedpkg update --suggest-logout option added
Patch: Add compatibility for Bodhi >= 6.0.0
fedora-packager rpm dependency is "Recommends"
Signed-off-by: Ondřej Nosek <onosek@redhat.com>
---
diff --git a/0003-fedpkg-update-suggest-logout-option-added.patch b/0003-fedpkg-update-suggest-logout-option-added.patch
new file mode 100644
index 0000000..794178c
--- /dev/null
+++ b/0003-fedpkg-update-suggest-logout-option-added.patch
@@ -0,0 +1,153 @@
+From 07e7c53b1471bfc2e45c82d5975433848d7f1e83 Mon Sep 17 00:00:00 2001
+From: Dominik Rumian <drumian@redhat.com>
+Date: Fri, 8 Apr 2022 13:13:05 +0200
+Subject: [PATCH 1/2] fedpkg update --suggest-logout option added
+
+Option --suggest-logout was not implemented although it
+is supported by Bodhi. This commit adds this option.
+
+Jira: RHELCMP-8704
+Fixes: https://pagure.io/fedpkg/issue/472
+
+Signed-off-by: Dominik Rumian <drumian@redhat.com>
+---
+ fedpkg/__init__.py | 4 ++++
+ fedpkg/cli.py | 34 +++++++++++++++++++++++++---------
+ test/test_cli.py | 15 ++++++++++++++-
+ 3 files changed, 43 insertions(+), 10 deletions(-)
+
+diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py
+index a52c70d..60a8193 100644
+--- a/fedpkg/__init__.py
++++ b/fedpkg/__init__.py
+@@ -62,6 +62,7 @@ if _BodhiClient is not None:
+
+ UPDATE_TYPES = ['bugfix', 'security', 'enhancement', 'newpackage']
+ REQUEST_TYPES = ['testing', 'stable']
++ SUGGEST_TYPES = ['unspecified', 'reboot', 'logout']
+
+ @clear_csrf_and_retry
+ def save(self, *args, **kwargs):
+@@ -359,6 +360,9 @@ class Commands(pyrpkg.Commands):
+ if detail['request'] not in BodhiClient.REQUEST_TYPES:
+ raise ValueError(
+ 'Incorrect request type {0}'.format(detail['request']))
++ if detail['suggest'] not in BodhiClient.SUGGEST_TYPES:
++ raise ValueError(
++ 'Incorrect suggest type {0}'.format(detail['suggest']))
+
+ try:
+ self.log.info(bodhi.update_str(bodhi.save(**detail), minimal=False))
+diff --git a/fedpkg/cli.py b/fedpkg/cli.py
+index 58fabbe..8fc8f8d 100644
+--- a/fedpkg/cli.py
++++ b/fedpkg/cli.py
+@@ -78,8 +78,10 @@ unstable_karma=%(unstable_karma)s
+ # Automatically close bugs when this marked as stable
+ close_bugs=%(close_bugs)s
+
+-# Suggest that users restart after update
+-suggest_reboot=%(suggest_reboot)s
++# Suggest that users performs one of the following actions after the update:
++# unspecified, restart, logout
++# The default value is unspecified
++suggest=%(suggest)s
+
+ # A boolean to require that all of the bugs in your update have been confirmed by testers.
+ require_bugs=%(require_bugs)s
+@@ -244,12 +246,6 @@ class fedpkgClient(cliClient):
+ help='By default, update will be created by enabling to close bugs'
+ ' automatically. If this is what you do not want, use this '
+ 'option to disable the default behavior.')
+- update_parser.add_argument(
+- '--suggest-reboot',
+- action='store_true',
+- default=False,
+- dest='suggest_reboot',
+- help='Suggest user to reboot after update. Default is False.')
+ update_parser.add_argument(
+ '--no-require-bugs',
+ action='store_false',
+@@ -264,6 +260,21 @@ class fedpkgClient(cliClient):
+ dest='require_testcases',
+ help='Disables the requirement that this update passes all test cases '
+ 'before reaching stable. Default is True.')
++
++ group = update_parser.add_mutually_exclusive_group()
++ group.add_argument(
++ '--suggest-reboot',
++ action='store_true',
++ default=False,
++ dest='suggest_reboot',
++ help='Suggest user to reboot after update. Default is False.')
++ group.add_argument(
++ '--suggest-logout',
++ action='store_true',
++ default=False,
++ dest='suggest_logout',
++ help='Suggest user to logout after update. Default is False.')
++
+ update_parser.set_defaults(command=self.update)
+
+ def get_distgit_namespaces(self):
+@@ -810,11 +821,16 @@ class fedpkgClient(cliClient):
+ 'stable_karma': self.args.stable_karma,
+ 'unstable_karma': self.args.unstable_karma,
+ 'close_bugs': str(self.args.close_bugs),
+- 'suggest_reboot': str(self.args.suggest_reboot),
++ 'suggest': 'unspecified',
+ 'require_bugs': str(self.args.require_bugs),
+ 'require_testcases': str(self.args.require_testcases),
+ }
+
++ if self.args.suggest_reboot:
++ bodhi_args['suggest'] = 'reboot'
++ elif self.args.suggest_logout:
++ bodhi_args['suggest'] = 'logout'
++
+ if self.args.update_type:
+ bodhi_args['type_'] = self.args.update_type
+ else:
+diff --git a/test/test_cli.py b/test/test_cli.py
+index 957cefe..6a9864d 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -169,7 +169,8 @@ class TestUpdate(CliTestCase):
+ @patch('fedora.client.OpenIdBaseClient._load_cookies')
+ def assert_bodhi_update(self, cli, _load_cookies, send_request, csrf,
+ update_type=None, request_type=None, notes=None,
+- stable_karma=None, unstable_karma=None):
++ stable_karma=None, unstable_karma=None,
++ suggest=None):
+ csrf.return_value = '123456'
+
+ def run_command_side_effect(command, shell):
+@@ -189,6 +190,10 @@ class TestUpdate(CliTestCase):
+ content = re.sub('request=[a-z]+\n',
+ 'request={0}\n'.format(request_type),
+ content)
++ if suggest:
++ content = re.sub('suggest=[a-z]+\n',
++ 'suggest={0}\n'.format(suggest),
++ content)
+ f.write(content)
+
+ self.mock_run_command.side_effect = run_command_side_effect
+@@ -327,6 +332,14 @@ class TestUpdate(CliTestCase):
+ update_type='enhancement',
+ request_type='xxx')
+
++ def test_incorrect_suggest_type_in_template(self):
++ cli_cmd = ['fedpkg-stage', '--path', self.cloned_repo_path, 'update']
++ cli = self.get_cli(cli_cmd)
++ six.assertRaisesRegex(self, rpkgError, 'Incorrect suggest type',
++ self.assert_bodhi_update, cli,
++ update_type='enhancement',
++ suggest='123')
++
+ def test_create_with_cli_options(self):
+ cli_cmd = [
+ 'fedpkg-stage', '--path', self.cloned_repo_path,
+--
+2.35.1
+
diff --git a/0004-Add-compatibility-for-Bodhi-6.0.0.patch b/0004-Add-compatibility-for-Bodhi-6.0.0.patch
new file mode 100644
index 0000000..69ef3b6
--- /dev/null
+++ b/0004-Add-compatibility-for-Bodhi-6.0.0.patch
@@ -0,0 +1,312 @@
+From 7dbe79dc9baaea045dd558430abfbaea13b4c36a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= <aurelien@bompard.org>
+Date: Mon, 28 Mar 2022 11:40:16 +0200
+Subject: [PATCH 2/2] Add compatibility for Bodhi >= 6.0.0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Compatibility with Bodhi 5.X is retained.
+JIRA: RHELCMP-8929
+Merges: https://pagure.io/fedpkg/pull-request/470
+
+Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
+---
+ fedpkg/__init__.py | 67 ++++++--------------------------------------
+ fedpkg/bodhi_5.py | 63 +++++++++++++++++++++++++++++++++++++++++
+ fedpkg/bodhi_6.py | 26 +++++++++++++++++
+ requirements-py2.txt | 1 +
+ requirements.txt | 1 +
+ test/test_cli.py | 13 ++++++---
+ 6 files changed, 109 insertions(+), 62 deletions(-)
+ create mode 100644 fedpkg/bodhi_5.py
+ create mode 100644 fedpkg/bodhi_6.py
+
+diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py
+index 60a8193..f041b97 100644
+--- a/fedpkg/__init__.py
++++ b/fedpkg/__init__.py
+@@ -21,11 +21,7 @@ from datetime import datetime, timedelta
+ from . import cli # noqa
+ from .lookaside import FedoraLookasideCache
+ from pyrpkg.utils import cached_property
+-
+-try:
+- from bodhi.client.bindings import BodhiClient as _BodhiClient
+-except ImportError:
+- _BodhiClient = None
++from pkg_resources import get_distribution, parse_version
+
+ try:
+ from distro import linux_distribution # noqa
+@@ -33,56 +29,11 @@ except ImportError:
+ from platform import linux_distribution # noqa
+
+
+-if _BodhiClient is not None:
+- from fedora.client import AuthError
+-
+- def clear_csrf_and_retry(func):
+- """Clear csrf token and retry
+-
+- fedpkg uses Bodhi Python binding API list_overrides first before other
+- save and extend APIs. That causes a readonly csrf token is received,
+- which will be got again when next time to construct request data to
+- modify updates. That is not expected and AuthError will be raised.
+-
+- So, the solution is to capture the AuthError error, clear the token and
+- try to modify update again by requesting another token with user's
+- credential.
+- """
+- def _decorator(self, *args, **kwargs):
+- try:
+- return func(self, *args, **kwargs)
+- except AuthError:
+- self._session.cookies.clear()
+- self.csrf_token = None
+- return func(self, *args, **kwargs)
+- return _decorator
+-
+- class BodhiClient(_BodhiClient):
+- """Customized BodhiClient for fedpkg"""
+-
+- UPDATE_TYPES = ['bugfix', 'security', 'enhancement', 'newpackage']
+- REQUEST_TYPES = ['testing', 'stable']
+- SUGGEST_TYPES = ['unspecified', 'reboot', 'logout']
+-
+- @clear_csrf_and_retry
+- def save(self, *args, **kwargs):
+- return super(BodhiClient, self).save(*args, **kwargs)
+-
+- @clear_csrf_and_retry
+- def save_override(self, *args, **kwargs):
+- return super(BodhiClient, self).save_override(*args, **kwargs)
+-
+- @clear_csrf_and_retry
+- def extend_override(self, override, expiration_date):
+- data = dict(
+- nvr=override['nvr'],
+- notes=override['notes'],
+- expiration_date=expiration_date,
+- edited=override['nvr'],
+- csrf_token=self.csrf(),
+- )
+- return self.send_request(
+- 'overrides/', verb='POST', auth=True, data=data)
++bodhi_version = get_distribution('bodhi-client').version
++if parse_version(bodhi_version) < parse_version("6.0.0"):
++ from .bodhi_5 import BodhiClient, UPDATE_TYPES, REQUEST_TYPES, SUGGEST_TYPES
++else:
++ from .bodhi_6 import BodhiClient, UPDATE_TYPES, REQUEST_TYPES, SUGGEST_TYPES
+
+
+ class Commands(pyrpkg.Commands):
+@@ -354,13 +305,13 @@ class Commands(pyrpkg.Commands):
+ if not detail['type']:
+ raise ValueError(
+ 'Missing update type, which is required to create update.')
+- if detail['type'] not in BodhiClient.UPDATE_TYPES:
++ if detail['type'] not in UPDATE_TYPES:
+ raise ValueError(
+ 'Incorrect update type {0}'.format(detail['type']))
+- if detail['request'] not in BodhiClient.REQUEST_TYPES:
++ if detail['request'] not in REQUEST_TYPES:
+ raise ValueError(
+ 'Incorrect request type {0}'.format(detail['request']))
+- if detail['suggest'] not in BodhiClient.SUGGEST_TYPES:
++ if detail['suggest'] not in SUGGEST_TYPES:
+ raise ValueError(
+ 'Incorrect suggest type {0}'.format(detail['suggest']))
+
+diff --git a/fedpkg/bodhi_5.py b/fedpkg/bodhi_5.py
+new file mode 100644
+index 0000000..9ffa1df
+--- /dev/null
++++ b/fedpkg/bodhi_5.py
+@@ -0,0 +1,63 @@
++# fedpkg - a Python library for RPM Packagers
++#
++# Copyright (C) 2011 Red Hat Inc.
++# Author(s): Jesse Keating <jkeating@redhat.com>
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License as published by the
++# Free Software Foundation; either version 2 of the License, or (at your
++# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
++# the full text of the license.
++
++from bodhi.client.bindings import BodhiClient as _BodhiClient
++from fedora.client import AuthError
++
++
++UPDATE_TYPES = ['bugfix', 'security', 'enhancement', 'newpackage']
++REQUEST_TYPES = ['testing', 'stable']
++SUGGEST_TYPES = ['unspecified', 'reboot', 'logout']
++
++
++def clear_csrf_and_retry(func):
++ """Clear csrf token and retry
++
++ fedpkg uses Bodhi Python binding API list_overrides first before other
++ save and extend APIs. That causes a readonly csrf token is received,
++ which will be got again when next time to construct request data to
++ modify updates. That is not expected and AuthError will be raised.
++
++ So, the solution is to capture the AuthError error, clear the token and
++ try to modify update again by requesting another token with user's
++ credential.
++ """
++ def _decorator(self, *args, **kwargs):
++ try:
++ return func(self, *args, **kwargs)
++ except AuthError:
++ self._session.cookies.clear()
++ self.csrf_token = None
++ return func(self, *args, **kwargs)
++ return _decorator
++
++
++class BodhiClient(_BodhiClient):
++ """Customized BodhiClient for fedpkg"""
++
++ @clear_csrf_and_retry
++ def save(self, *args, **kwargs):
++ return super(BodhiClient, self).save(*args, **kwargs)
++
++ @clear_csrf_and_retry
++ def save_override(self, *args, **kwargs):
++ return super(BodhiClient, self).save_override(*args, **kwargs)
++
++ @clear_csrf_and_retry
++ def extend_override(self, override, expiration_date):
++ data = dict(
++ nvr=override['nvr'],
++ notes=override['notes'],
++ expiration_date=expiration_date,
++ csrf_token=self.csrf(),
++ )
++ return self.send_request(
++ 'overrides/', verb='POST', auth=True, data=data)
+diff --git a/fedpkg/bodhi_6.py b/fedpkg/bodhi_6.py
+new file mode 100644
+index 0000000..415e3d2
+--- /dev/null
++++ b/fedpkg/bodhi_6.py
+@@ -0,0 +1,26 @@
++# fedpkg - a Python library for RPM Packagers
++#
++# Copyright (C) 2022 Red Hat Inc.
++# Author(s): Aurélien Bompard <aurelien@bompard.org>
++#
++# This program is free software; you can redistribute it and/or modify it
++# under the terms of the GNU General Public License as published by the
++# Free Software Foundation; either version 2 of the License, or (at your
++# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
++# the full text of the license.
++
++from bodhi.client.bindings import BodhiClient as BodhiClient_
++from bodhi.client.constants import UPDATE_TYPES, REQUEST_TYPES, SUGGEST_TYPES # noqa
++
++
++class BodhiClient(BodhiClient_):
++
++ def __init__(self, username, *args, **kwargs):
++ super().__init__(*args, **kwargs)
++
++ def extend_override(self, override, new_expiration_date):
++ return self.save_override(
++ nvr=override["nvr"],
++ notes=override["notes"],
++ expiration_date=new_expiration_date
++ )
+diff --git a/requirements-py2.txt b/requirements-py2.txt
+index e1de6c2..de6c73a 100644
+--- a/requirements-py2.txt
++++ b/requirements-py2.txt
+@@ -1,5 +1,6 @@
+ argcomplete
+ openidc-client
+ python-bugzilla < 3.0.0
++python-fedora
+ rpkg
+ six
+diff --git a/requirements.txt b/requirements.txt
+index 7e52a2c..cb3de2c 100644
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -2,5 +2,6 @@ argcomplete
+ bodhi-client
+ openidc-client
+ python-bugzilla
++python-fedora
+ rpkg
+ six
+diff --git a/test/test_cli.py b/test/test_cli.py
+index 6a9864d..03c9403 100644
+--- a/test/test_cli.py
++++ b/test/test_cli.py
+@@ -26,6 +26,7 @@ from six.moves import StringIO
+ from six.moves.configparser import NoOptionError, NoSectionError
+
+ import fedpkg.cli
++from fedpkg import parse_version, bodhi_version
+ from fedpkg.bugzilla import BugzillaClient
+ from fedpkg.cli import check_bodhi_version
+ from freezegun import freeze_time
+@@ -1712,6 +1713,10 @@ class TestBodhiOverride(CliTestCase):
+ 'Buildroot override for %s already exists and not '
+ 'expired.', 'rpkg-1.54-2.fc28')
+
++ @unittest.skipIf(
++ parse_version(bodhi_version) >= parse_version("6.0.0"),
++ "Retrying is built in Bodhi 6"
++ )
+ @patch('fedora.client.OpenIdBaseClient._load_cookies')
+ @patch('bodhi.client.bindings.BodhiClient.list_overrides')
+ @patch('bodhi.client.bindings.BodhiClient.save_override')
+@@ -1888,7 +1893,6 @@ class TestBodhiOverrideExtend(CliTestCase):
+ 'expiration_date': expected_expiration_date,
+ 'nvr': build_nvr,
+ 'notes': build_override['notes'],
+- 'edited': build_nvr,
+ 'csrf_token': csrf.return_value,
+ }
+ send_request.assert_called_once_with(
+@@ -1945,7 +1949,6 @@ class TestBodhiOverrideExtend(CliTestCase):
+ 'expiration_date': expected_expiration_date,
+ 'nvr': build_nvr,
+ 'notes': build_override['notes'],
+- 'edited': build_nvr,
+ 'csrf_token': csrf.return_value,
+ }
+ send_request.assert_called_once_with(
+@@ -2003,7 +2006,6 @@ class TestBodhiOverrideExtend(CliTestCase):
+ 'expiration_date': expected_expiration_date,
+ 'nvr': build_nvr,
+ 'notes': build_override['notes'],
+- 'edited': build_nvr,
+ 'csrf_token': csrf.return_value,
+ }
+ send_request.assert_called_once_with(
+@@ -2042,6 +2044,10 @@ class TestBodhiOverrideExtend(CliTestCase):
+ six.assertRaisesRegex(self, rpkgError, '',
+ cli.extend_buildroot_override)
+
++ @unittest.skipIf(
++ parse_version(bodhi_version) >= parse_version("6.0.0"),
++ "Retrying is built in Bodhi 6"
++ )
+ @patch('fedpkg.BodhiClient.list_overrides')
+ @patch('fedpkg.BodhiClient.csrf')
+ @patch('fedpkg.BodhiClient.send_request')
+@@ -2102,7 +2108,6 @@ class TestBodhiOverrideExtend(CliTestCase):
+ 'expiration_date': expected_expiration_date,
+ 'nvr': build_nvr,
+ 'notes': build_override['notes'],
+- 'edited': build_nvr,
+ 'csrf_token': token,
+ })
+ for token in csrf.side_effect
+--
+2.35.1
+
diff --git a/fedpkg.spec b/fedpkg.spec
index 308281c..fbb3129 100644
--- a/fedpkg.spec
+++ b/fedpkg.spec
@@ -5,7 +5,7 @@
Name: fedpkg
Version: 1.42
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Fedora utility for working with dist-git
License: GPLv2+
@@ -15,6 +15,8 @@ Source0: https://pagure.io/releases/fedpkg/%{name}-%{version}.tar.bz2
BuildArch: noarch
Patch1: 0001-Do-not-use-pytest-related-dependencies-temporarily.patch
Patch2: 0002-Remove-pytest-coverage-execution.patch
+Patch3: 0003-fedpkg-update-suggest-logout-option-added.patch
+Patch4: 0004-Add-compatibility-for-Bodhi-6.0.0.patch
# RHEL7 is currently the only release that is built for Python 2.
%if 0%{?fedora} || 0%{?rhel} > 7
@@ -27,7 +29,6 @@ BuildRequires: pkgconfig
BuildRequires: bash-completion
BuildRequires: git
-Requires: fedora-packager
Requires: koji
Requires: redhat-rpm-config
@@ -37,7 +38,7 @@ Requires: redhat-rpm-config
BuildRequires: python2-devel
# We br these things for man page generation due to imports
-BuildRequires: python2-rpkg >= 1.64-1
+BuildRequires: python2-rpkg >= 1.64-4
BuildRequires: python2-distro
BuildRequires: python2-fedora
# For testing
@@ -51,10 +52,11 @@ BuildRequires: python-bugzilla
Requires: bodhi-client >= 2.0
Requires: python-bugzilla
-Requires: python2-rpkg >= 1.64-1
+Requires: python2-rpkg >= 1.64-4
Requires: python2-distro
Requires: python2-fedora
Requires: python2-openidc-client >= 0.6.0
+Requires: fedora-packager
# python3
%else
@@ -62,7 +64,7 @@ Requires: python2-openidc-client >= 0.6.0
%global __python %{__python3}
BuildRequires: python3-devel
-BuildRequires: python3-rpkg >= 1.64-1
+BuildRequires: python3-rpkg >= 1.64-4
BuildRequires: python3-distro
BuildRequires: python3-fedora
# For testing
@@ -75,12 +77,13 @@ BuildRequires: python3-bodhi-client
Requires: python3-bugzilla
-Requires: python3-rpkg >= 1.64-1
+Requires: python3-rpkg >= 1.64-4
Requires: python3-distro
Requires: python3-fedora
Requires: python3-openidc-client >= 0.6.0
Requires: python3-bodhi-client
Requires: python3-setuptools
+Recommends: fedora-packager
%endif
@@ -144,6 +147,11 @@ mv %{buildroot}%{compdir}/fedpkg.bash %{buildroot}%{compdir}/fedpkg
%changelog
+* Tue Apr 26 2022 Ondřej Nosek <onosek@redhat.com> - 1.42-2
+- Patch: fedpkg update --suggest-logout option added
+- Patch: Add compatibility for Bodhi >= 6.0.0
+- fedora-packager rpm dependency is "Recommends"
+
* Wed Jan 26 2022 Ondřej Nosek <onosek@redhat.com> - 1.42-1
- Fix Jenkins tests (onosek)
- Return bash-completion back because of compatibility (onosek)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-10 21:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-10 21:46 [rpms/fedpkg] 1.48-1: Few patches and dependency change
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox