upgrade dnf to 4.16.2

This commit is contained in:
zhangrui 2023-07-29 16:04:14 +08:00
parent 579fa99206
commit 9fc793cbab
10 changed files with 22 additions and 334 deletions

View File

@ -1,50 +0,0 @@
From e027e02efe57706de5867d42505ea01fb8d494de Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Tue, 13 Sep 2022 13:55:35 +0200
Subject: [PATCH] Add support for rollback of group upgrade rollback
(RhBug:2016070)
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2016070
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/e027e02efe57706de5867d42505ea01fb8d494de
---
dnf/transaction_sr.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dnf/transaction_sr.py b/dnf/transaction_sr.py
index 5d403a3..cf74b80 100644
--- a/dnf/transaction_sr.py
+++ b/dnf/transaction_sr.py
@@ -553,9 +553,11 @@ class TransactionReplay(object):
if action == "Install":
self._swdb_group_install(group_id, pkg_types, group_data["packages"])
- elif action == "Upgrade":
+ # Groups are not versioned, but a reverse transaction could be applied,
+ # therefore we treat both actions the same way
+ elif action == "Upgrade" or action == "Upgraded":
self._swdb_group_upgrade(group_id, pkg_types, group_data["packages"])
- elif action == "Downgraded":
+ elif action == "Downgrade" or action == "Downgraded":
self._swdb_group_downgrade(group_id, pkg_types, group_data["packages"])
elif action == "Removed":
self._swdb_group_remove(group_id, pkg_types, group_data["packages"])
@@ -584,9 +586,11 @@ class TransactionReplay(object):
if action == "Install":
self._swdb_environment_install(env_id, pkg_types, env_data["groups"])
- elif action == "Upgrade":
+ # Environments are not versioned, but a reverse transaction could be applied,
+ # therefore we treat both actions the same way
+ elif action == "Upgrade" or action == "Upgraded":
self._swdb_environment_upgrade(env_id, pkg_types, env_data["groups"])
- elif action == "Downgraded":
+ elif action == "Downgrade" or action == "Downgraded":
self._swdb_environment_downgrade(env_id, pkg_types, env_data["groups"])
elif action == "Removed":
self._swdb_environment_remove(env_id, pkg_types, env_data["groups"])
--
2.27.0

View File

@ -1,28 +0,0 @@
From e386cd384dffcbd91741357340f19967e79903cb Mon Sep 17 00:00:00 2001
From: Anatoli Babenia <anatoli@rainforce.org>
Date: Thu, 18 Aug 2022 09:35:51 +0300
Subject: [PATCH] cli: Allow `=` in `setopt` values
Reference:https://github.com/rpm-software-management/dnf/commit/e386cd384dffcbd91741357340f19967e79903cb
Conflict:NA
---
dnf/cli/option_parser.py | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dnf/cli/option_parser.py b/dnf/cli/option_parser.py
index 41ff16451d..042d5fbbee 100644
--- a/dnf/cli/option_parser.py
+++ b/dnf/cli/option_parser.py
@@ -110,10 +110,7 @@ class _SetoptsCallback(argparse.Action):
""" Parse setopts arguments and put them into main_<setopts>
and repo_<setopts>."""
def __call__(self, parser, namespace, values, opt_str):
- vals = values.split('=')
- if len(vals) > 2:
- logger.warning(_("Setopt argument has multiple values: %s"), values)
- return
+ vals = values.split('=', maxsplit=1)
if len(vals) < 2:
logger.warning(_("Setopt argument has no value: %s"), values)
return
--

View File

@ -1,29 +0,0 @@
From 759e7a5586f279efd41b65b2f84e0dd3bcf77fbd Mon Sep 17 00:00:00 2001
From: chenhaixing123 <chenhaixing@huawei.com>
Date: Wed, 22 Feb 2023 17:27:04 +0800
Subject: [PATCH] fix AttributeError when IO busy and press ctrl c
Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/rpm-software-management/dnf/pull/1899/commits/759e7a5586f279efd41b65b2f84e0dd3bcf77fbd
---
dnf/conf/config.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dnf/conf/config.py b/dnf/conf/config.py
index 32516d1..e08ca72 100644
--- a/dnf/conf/config.py
+++ b/dnf/conf/config.py
@@ -251,8 +251,9 @@ class MainConf(BaseConfig):
self.tempfiles = []
def __del__(self):
- for file_name in self.tempfiles:
- os.unlink(file_name)
+ if hasattr(self, 'tempfiles'):
+ for file_name in self.tempfiles:
+ os.unlink(file_name)
@property
def get_reposdir(self):
--
2.27.0

View File

@ -1,93 +0,0 @@
From 9ee057a4ccf3170deeb4626aa2387085d2ec6d5b 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
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/7ef317db99efeddb66905134292b0fe05e2ed58c
---
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 b083727deb..d2f46ce340 100644
--- a/dnf/plugin.py
+++ b/dnf/plugin.py
@@ -98,6 +98,9 @@ def __init__(self):
self.plugin_cls = []
self.plugins = []
+ def __del__(self):
+ self._unload()
+
def _caller(self, method):
for plugin in self.plugins:
try:
@@ -164,8 +167,9 @@ def run_transaction(self):
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 e84e272b77..19754b072e 100644
--- a/tests/api/test_dnf_base.py
+++ b/tests/api/test_dnf_base.py
@@ -7,10 +7,23 @@
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 @@ def test_transaction(self):
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 @@ def test_unload_plugins(self):
# Base.unload_plugins()
self.assertHasAttr(self.base, "unload_plugins")
+ self.base._conf = conf_with_empty_plugins()
+
self.base.init_plugins()
self.base.unload_plugins()

View File

@ -1,52 +0,0 @@
From e2fbdc660fb4ef83905e127fd801025461c24710 Mon Sep 17 00:00:00 2001
From: Jan Kolarik <jkolarik@redhat.com>
Date: Wed, 23 Nov 2022 08:44:41 +0000
Subject: [PATCH] Ignore processing variable files with unsupported encoding
(RhBug:2141215)
This issue could be seen for example when there are some temporary files stored by text editors in the `/etc/dnf/vars` folder. These files could be in the binary format and causes `UnicodeDecodeError` exception to be thrown during processing of the var files.
= changelog =
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2141215
Conflict:The content of "index" and "@@" are adapted
Reference:https://github.com/rpm-software-management/dnf/commit/e2fbdc660fb4ef83905e127fd801025461c24710
---
dnf/conf/substitutions.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dnf/conf/substitutions.py b/dnf/conf/substitutions.py
index 1281bdf..9d7442b 100644
--- a/dnf/conf/substitutions.py
+++ b/dnf/conf/substitutions.py
@@ -18,13 +18,15 @@
# Red Hat, Inc.
#
+import logging
import os
import re
-import dnf
-import dnf.exceptions
+from dnf.i18n import _
ENVIRONMENT_VARS_RE = re.compile(r'^DNF_VAR_[A-Za-z0-9_]+$')
+logger = logging.getLogger('dnf')
+
class Substitutions(dict):
# :api
@@ -60,7 +62,8 @@ class Substitutions(dict):
val = fp.readline()
if val and val[-1] == '\n':
val = val[:-1]
- except (OSError, IOError):
+ except (OSError, IOError, UnicodeDecodeError) as e:
+ logger.warning(_("Error when parsing a variable from file '{0}': {1}").format(filepath, e))
continue
if val is not None:
self[fsvar] = val
--
2.27.0

View File

@ -1,64 +0,0 @@
From d7bfd194129b496851ed07ac7efd07c6ddc0ab49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Wed, 7 Sep 2022 14:40:32 +0200
Subject: [PATCH] Pass whole URL in relativeUrl to PackageTarget for RPM URL
download
The PackageTarget supports baseUrl and relativeUrl on the API, but then
the relativeUrl is just a path fragment with no definition on whether it
should be encoded. It's being passed unencoded paths from other places,
and so there's a conditional encode (only if not full URL) in libdnf.
But full URLs are actually supported in relativeUrl (in that case
baseUrl should be empty) and in that case the URL is expected to be
encoded and is not encoded for the second time.
Hence, pass the full URL to relativeUrl instead of splitting it. We also
need to decode the file name we store, as on the filesystem the RPM file
name is also decoded.
= changelog =
msg: Don't double-encode RPM URLs passed on CLI
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103015
Conflict:NA
Reference:https://github.com/rpm-software-management/dnf/commit/d7bfd194129b496851ed07ac7efd07c6ddc0ab49
---
dnf/repo.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dnf/repo.py b/dnf/repo.py
index 1822cf0..8751de3 100644
--- a/dnf/repo.py
+++ b/dnf/repo.py
@@ -47,6 +47,7 @@ import string
import sys
import time
import traceback
+import urllib
_PACKAGES_RELATIVE_DIR = "packages"
_MIRRORLIST_FILENAME = "mirrorlist"
@@ -295,7 +296,7 @@ class RemoteRPMPayload(PackagePayload):
self.local_path = os.path.join(self.pkgdir, self.__str__().lstrip("/"))
def __str__(self):
- return os.path.basename(self.remote_location)
+ return os.path.basename(urllib.parse.unquote(self.remote_location))
def _progress_cb(self, cbdata, total, done):
self.remote_size = total
@@ -308,8 +309,8 @@ class RemoteRPMPayload(PackagePayload):
def _librepo_target(self):
return libdnf.repo.PackageTarget(
- self.conf._config, os.path.basename(self.remote_location),
- self.pkgdir, 0, None, 0, os.path.dirname(self.remote_location),
+ self.conf._config, self.remote_location,
+ self.pkgdir, 0, None, 0, None,
True, 0, 0, self.callbacks)
@property
--
2.27.0

0
dnf-4.10.0-sw.patch Executable file → Normal file
View File

Binary file not shown.

BIN
dnf-4.16.2.tar.gz Normal file

Binary file not shown.

View File

@ -2,10 +2,10 @@
%global relate_libdnf_version 0.66.0 %global relate_libdnf_version 0.66.0
Name: dnf Name: dnf
Version: 4.14.0 Version: 4.16.2
Release: 15 Release: 1
Summary: A software package manager that manages packages on Linux distributions. Summary: A software package manager that manages packages on Linux distributions.
License: GPLv2+ and GPLv2 and GPL License: GPL-2.0-or-later AND GPL-1.0-only
URL: https://github.com/rpm-software-management/dnf URL: https://github.com/rpm-software-management/dnf
Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz
@ -19,26 +19,15 @@ Patch9006: get-lockfile-exists-before-unlick.patch
%ifarch sw_64 %ifarch sw_64
Patch6000: dnf-4.10.0-sw.patch Patch6000: dnf-4.10.0-sw.patch
%endif %endif
%if 0%(test `uname -m` == "loongarch64" && echo 1) %if 0%(test `uname -m` == "loongarch64" && echo 1)
Patch6001: 0001-Add-loongarch-architecture-support.patch Patch6001: 0001-Add-loongarch-architecture-support.patch
%endif %endif
Patch6002: backport-fix-plugins-unit-tests-unload-plugins-upon-their-deletion.patch
Patch6003: backport-pass-whole-url-in-relativeUrl-to-packageTarget-for-rpm-url-download.patch
Patch6004: backport-add-support-for-rollback-of-group-upgrade-rollback.patch
Patch6005: backport-ignore-processing-variable-files-with-unsupported-encoding.patch
Patch6006: backport-fix-AttributeError-when-IO-busy-and-press-ctrl-c.patch
Patch6007: backport-cli-allow-=in-setopt-values.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: cmake gettext systemd bash-completion python3-sphinx BuildRequires: cmake gettext systemd bash-completion python3-sphinx
Requires: python3-%{name} = %{version}-%{release} libreport-filesystem Requires: python3-%{name} = %{version}-%{release} libreport-filesystem
Recommends: (%{_bindir}/sqlite3 if bash-completion) (python3-dbus if NetworkManager) Recommends: (%{_bindir}/sqlite3 if bash-completion) (python3-dbus if NetworkManager)
Provides: dnf-command(alias) dnf-command(autoremove) dnf-command(check-update) dnf-command(clean)
Provides: dnf-command(distro-sync) dnf-command(downgrade) dnf-command(group) dnf-command(history)
Provides: dnf-command(info) dnf-command(install) dnf-command(list) dnf-command(makecache)
Provides: dnf-command(mark) dnf-command(provides) dnf-command(reinstall) dnf-command(remove)
Provides: dnf-command(repolist) dnf-command(repoquery) dnf-command(repository-packages)
Provides: dnf-command(search) dnf-command(updateinfo) dnf-command(upgrade) dnf-command(upgrade-to)
Conflicts: python2-dnf-plugins-core < 4.0.6 python3-dnf-plugins-core < 4.0.6 Conflicts: python2-dnf-plugins-core < 4.0.6 python3-dnf-plugins-core < 4.0.6
%description %description
@ -66,6 +55,12 @@ Requires: python3-gpg %{name}-data = %{version}-%{release} libmodule
Requires: python3-hawkey >= 0.66.0 python3-libdnf >= %{relate_libdnf_version} Requires: python3-hawkey >= 0.66.0 python3-libdnf >= %{relate_libdnf_version}
Requires: python3-libcomps >= 0.1.8 python3-rpm >= 4.14.0 Requires: python3-libcomps >= 0.1.8 python3-rpm >= 4.14.0
Recommends: python3-unbound Recommends: python3-unbound
Provides: dnf-command(alias) dnf-command(autoremove) dnf-command(check-update) dnf-command(clean)
Provides: dnf-command(distro-sync) dnf-command(downgrade) dnf-command(group) dnf-command(history)
Provides: dnf-command(info) dnf-command(install) dnf-command(list) dnf-command(makecache)
Provides: dnf-command(mark) dnf-command(provides) dnf-command(reinstall) dnf-command(remove)
Provides: dnf-command(repolist) dnf-command(repoquery) dnf-command(repository-packages)
Provides: dnf-command(search) dnf-command(updateinfo) dnf-command(upgrade) dnf-command(upgrade-to)
Obsoletes: python2-%{name} Obsoletes: python2-%{name}
%description -n python3-%{name} %description -n python3-%{name}
@ -83,7 +78,7 @@ Common data and configuration files for DNF
%package automatic %package automatic
Summary: %{pkg_summary} - automated upgrades Summary: %{pkg_summary} - automated upgrades
BuildRequires: systemd BuildRequires: systemd
Requires: %{name} = %{version}-%{release} Requires: python3-%{name} = %{version}-%{release}
%{?systemd_requires} %{?systemd_requires}
%description automatic %description automatic
@ -133,6 +128,7 @@ mkdir -p %{buildroot}%{_localstatedir}/log/
mkdir -p %{buildroot}%{_var}/cache/dnf/ mkdir -p %{buildroot}%{_var}/cache/dnf/
touch %{buildroot}%{_localstatedir}/log/%{name}.log touch %{buildroot}%{_localstatedir}/log/%{name}.log
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf
ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf4
mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic
rm -vf %{buildroot}%{_bindir}/dnf-automatic-* rm -vf %{buildroot}%{_bindir}/dnf-automatic-*
mv -f %{buildroot}%{_sysconfdir}/%{name}/%{name}-strict.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf mv -f %{buildroot}%{_sysconfdir}/%{name}/%{name}-strict.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
@ -189,10 +185,11 @@ popd
%{_sysconfdir}/yum.conf %{_sysconfdir}/yum.conf
%{_sysconfdir}/yum/pluginconf.d %{_sysconfdir}/yum/pluginconf.d
%{_sysconfdir}/yum/protected.d %{_sysconfdir}/yum/protected.d
%config(noreplace) %{_sysconfdir}/%{name}/protected.d/yum.conf %config %{_sysconfdir}/%{name}/protected.d/yum.conf
%files -n python3-%{name} %files -n python3-%{name}
%{_bindir}/%{name}-3 %{_bindir}/%{name}-3
%{_bindir}/%{name}4
%exclude %{python3_sitelib}/%{name}/automatic %exclude %{python3_sitelib}/%{name}/automatic
%{python3_sitelib}/%{name}/ %{python3_sitelib}/%{name}/
%dir %{py3pluginpath} %dir %{py3pluginpath}
@ -210,7 +207,8 @@ popd
%dir %{_sysconfdir}/%{name}/aliases.d %dir %{_sysconfdir}/%{name}/aliases.d
%exclude %{_sysconfdir}/%{name}/aliases.d/zypper.conf %exclude %{_sysconfdir}/%{name}/aliases.d/zypper.conf
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}/protected.d/%{name}.conf %config %{_sysconfdir}/%{name}/protected.d/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}/protected.d/python3-%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%ghost %attr(644,-,-) %{_localstatedir}/log/hawkey.log %ghost %attr(644,-,-) %{_localstatedir}/log/hawkey.log
%ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.log %ghost %attr(644,-,-) %{_localstatedir}/log/%{name}.log
@ -252,6 +250,12 @@ popd
%{_mandir}/man8/%{name}-automatic.8* %{_mandir}/man8/%{name}-automatic.8*
%changelog %changelog
* Sat Jul 29 2023 zhangrui <zhangrui182@huawei.com> - 4.16.2-1
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:upgrade dnf to 4.16.2
* Fri Jul 14 2023 chenhaixing <chenhaixing@huawei.com> - 4.14.0-15 * Fri Jul 14 2023 chenhaixing <chenhaixing@huawei.com> - 4.14.0-15
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA