Backport patches

Resolves: rhbz#2131288
Resolves: rhbz#2134777
Related: rhbz#2139326
This commit is contained in:
Nicola Sella 2022-12-07 14:37:10 +01:00
parent 5bbeb41790
commit 36cbb84e65
4 changed files with 235 additions and 7 deletions

View File

@ -0,0 +1,96 @@
From a41c3aefaa4f982511363645f5608e270094cadf Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Tue, 1 Nov 2022 09:15:08 +0000
Subject: [PATCH 2/2] Document changes to offline-upgrade command
(RhBug:1939975)
A support for security filters was added to the offline-upgrade command. This commit adds the documentation into the man pages.
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1939975
---
doc/command_ref.rst | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/doc/command_ref.rst b/doc/command_ref.rst
index f39f2c71..3ee66bac 100644
--- a/doc/command_ref.rst
+++ b/doc/command_ref.rst
@@ -114,7 +114,7 @@ Options
``--advisory=<advisory>, --advisories=<advisory>``
Include packages corresponding to the advisory ID, Eg. FEDORA-2201-123.
- Applicable for the install, repoquery, updateinfo and upgrade commands.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--allowerasing``
Allow erasing of installed packages to resolve dependencies. This option could be used as an alternative to the ``yum swap`` command where packages to remove are not explicitly defined.
@@ -130,12 +130,12 @@ Options
solver may use older versions of dependencies to meet their requirements.
``--bugfix``
- Include packages that fix a bugfix issue. Applicable for the install, repoquery, updateinfo and
- upgrade commands.
+ Include packages that fix a bugfix issue.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--bz=<bugzilla>, --bzs=<bugzilla>``
- Include packages that fix a Bugzilla ID, Eg. 123123. Applicable for the install, repoquery,
- updateinfo and upgrade commands.
+ Include packages that fix a Bugzilla ID, Eg. 123123.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``-C, --cacheonly``
Run entirely from system cache, don't update the cache and use it even in case it is expired.
@@ -153,8 +153,8 @@ Options
``--cve=<cves>, --cves=<cves>``
Include packages that fix a CVE (Common Vulnerabilities and Exposures) ID
- (http://cve.mitre.org/about/), Eg. CVE-2201-0123. Applicable for the install, repoquery, updateinfo,
- and upgrade commands.
+ (http://cve.mitre.org/about/), Eg. CVE-2201-0123.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``-d <debug level>, --debuglevel=<debug level>``
Debugging output level. This is an integer value between 0 (no additional information strings) and 10 (shows all debugging information, even that not understandable to the user), default is 2. Deprecated, use ``-v`` instead.
@@ -217,8 +217,8 @@ Options
specified multiple times.
``--enhancement``
- Include enhancement relevant packages. Applicable for the install, repoquery, updateinfo and
- upgrade commands.
+ Include enhancement relevant packages.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
.. _exclude_option-label:
@@ -289,8 +289,8 @@ Options
``--setopt`` using configuration from ``/path/dnf.conf``.
``--newpackage``
- Include newpackage relevant packages. Applicable for the install, repoquery, updateinfo and
- upgrade commands.
+ Include newpackage relevant packages.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--noautoremove``
Disable removal of dependencies that are no longer used. It sets
@@ -362,11 +362,11 @@ Options
``--sec-severity=<severity>, --secseverity=<severity>``
Includes packages that provide a fix for an issue of the specified severity.
- Applicable for the install, repoquery, updateinfo and upgrade commands.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
``--security``
- Includes packages that provide a fix for a security issue. Applicable for the
- upgrade command.
+ Includes packages that provide a fix for a security issue.
+ Applicable for the ``install``, ``repoquery``, ``updateinfo``, ``upgrade`` and ``offline-upgrade`` (dnf-plugins-core) commands.
.. _setopt_option-label:
--
2.38.1

View File

@ -0,0 +1,31 @@
From e5732ab22f092bb3fc6ce6e8f94aad72f3654383 Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Wed, 31 Aug 2022 07:49:39 +0200
Subject: [PATCH 1/2] Move system-upgrade plugin to core (RhBug:2054235)
Just doc fix.
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2054235
---
doc/command_ref.rst | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/doc/command_ref.rst b/doc/command_ref.rst
index 996ae3b4..f39f2c71 100644
--- a/doc/command_ref.rst
+++ b/doc/command_ref.rst
@@ -189,8 +189,7 @@ Options
``--downloaddir=<path>, --destdir=<path>``
Redirect downloaded packages to provided directory. The option has to be used together with the \-\
:ref:`-downloadonly <downloadonly-label>` command line option, with the
- ``download``, ``modulesync`` or ``reposync`` commands (dnf-plugins-core) or with the ``system-upgrade`` command
- (dnf-plugins-extras).
+ ``download``, ``modulesync``, ``reposync`` or ``system-upgrade`` commands (dnf-plugins-core).
.. _downloadonly-label:
--
2.38.1

View File

@ -0,0 +1,94 @@
From 3ef5ec915ea4b5e6fe7d25542f0daccef278c01e Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Tue, 13 Sep 2022 14:35:10 +0200
Subject: [PATCH] Fix plugins unit tests + unload plugins upon their deletion
---
dnf/plugin.py | 8 ++++++--
tests/api/test_dnf_base.py | 24 +++++++++++++++++++-----
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/dnf/plugin.py b/dnf/plugin.py
index b083727d..d2f46ce3 100644
--- a/dnf/plugin.py
+++ b/dnf/plugin.py
@@ -98,6 +98,9 @@ class Plugins(object):
self.plugin_cls = []
self.plugins = []
+ def __del__(self):
+ self._unload()
+
def _caller(self, method):
for plugin in self.plugins:
try:
@@ -164,8 +167,9 @@ class Plugins(object):
self._caller('transaction')
def _unload(self):
- logger.debug(_('Plugins were unloaded'))
- del sys.modules[DYNAMIC_PACKAGE]
+ if DYNAMIC_PACKAGE in sys.modules:
+ logger.log(dnf.logging.DDEBUG, 'Plugins were unloaded.')
+ del sys.modules[DYNAMIC_PACKAGE]
def unload_removed_plugins(self, transaction):
"""
diff --git a/tests/api/test_dnf_base.py b/tests/api/test_dnf_base.py
index e84e272b..19754b07 100644
--- a/tests/api/test_dnf_base.py
+++ b/tests/api/test_dnf_base.py
@@ -7,10 +7,23 @@ from __future__ import unicode_literals
import dnf
import dnf.conf
+import tests.support
+
from .common import TestCase
from .common import TOUR_4_4
+def conf_with_empty_plugins():
+ """
+ Use empty configuration to avoid importing plugins from default paths
+ which would lead to crash of other tests.
+ """
+ conf = tests.support.FakeConf()
+ conf.plugins = True
+ conf.pluginpath = []
+ return conf
+
+
class DnfBaseApiTest(TestCase):
def setUp(self):
self.base = dnf.Base(dnf.conf.Conf())
@@ -75,13 +88,12 @@ class DnfBaseApiTest(TestCase):
self.assertHasType(self.base.transaction, dnf.db.group.RPMTransaction)
def test_init_plugins(self):
- # Base.init_plugins(disabled_glob=(), enable_plugins=(), cli=None)
+ # Base.init_plugins()
self.assertHasAttr(self.base, "init_plugins")
- # disable plugins to avoid calling dnf.plugin.Plugins._load() multiple times
- # which causes the tests to crash
- self.base.conf.plugins = False
- self.base.init_plugins(disabled_glob=(), enable_plugins=(), cli=None)
+ self.base._conf = conf_with_empty_plugins()
+
+ self.base.init_plugins()
def test_pre_configure_plugins(self):
# Base.pre_configure_plugins()
@@ -99,6 +111,8 @@ class DnfBaseApiTest(TestCase):
# Base.unload_plugins()
self.assertHasAttr(self.base, "unload_plugins")
+ self.base._conf = conf_with_empty_plugins()
+
self.base.init_plugins()
self.base.unload_plugins()
--
2.38.1

View File

@ -8,7 +8,7 @@
%global rpm_version 4.14.0
# conflicts
%global conflicts_dnf_plugins_core_version 4.0.24-3
%global conflicts_dnf_plugins_core_version 4.0.26
%global conflicts_dnf_plugins_extras_version 4.0.4
%global conflicts_dnfdaemon_version 0.3.19
@ -66,13 +66,16 @@ It supports RPMs, modules and comps groups & environments.
Name: dnf
Version: 4.14.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPLv2+
URL: https://github.com/rpm-software-management/dnf
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-Pass-whole-URL-in-relativeUrl-to-PackageTarget-for-R.patch
Patch2: 0002-Document-changes-to-offline-upgrade-command-RhBug-19.patch
Patch3: 0003-Move-system-upgrade-plugin-to-core-RhBug-2054235.patch
Patch4: 0004-Fix-plugins-unit-tests.patch
BuildArch: noarch
BuildRequires: cmake
@ -129,13 +132,12 @@ Common data and configuration files for DNF
%package -n %{yum_subpackage_name}
Requires: %{name} = %{version}-%{release}
Summary: %{pkg_summary}
%if 0%{?fedora}
%if 0%{?fedora} >= 31
%if 0%{?fedora} && 0%{?fedora} < 31
Conflicts: yum < 3.4.3-505
%else
Provides: %{name}-yum = %{version}-%{release}
Obsoletes: %{name}-yum < 5
%else
Conflicts: yum < 3.4.3-505
%endif
%endif
%description -n %{yum_subpackage_name}
@ -362,6 +364,11 @@ popd
%{python3_sitelib}/%{name}/automatic/
%changelog
* Wed Dec 03 2022 Nicola Sella <nsella@redhat.com> - 4.14.0-3
- Move system-upgrade plugin to core (RhBug:2131288)
- offline-upgrade: add support for security filters (RhBug:1939975,2139326)
- Fix plugins unit tests + unload plugins upon their deletion
* Mon Oct 31 2022 Nicola Sella <nsella@redhat.com> - 4.14.0-2
- Pass whole URL in relativeUrl to PackageTarget for RPM URL download