import dnf-4.10.0-4.el9

This commit is contained in:
CentOS Sources 2022-03-01 08:05:31 -05:00 committed by Stepan Oksanichenko
parent 9aa4d8b401
commit ff6d9232d6
2 changed files with 183 additions and 6 deletions

View File

@ -0,0 +1,169 @@
From 087ad3d12ba307355dd66aba54faea97d227a3dd Mon Sep 17 00:00:00 2001
From: zhanghaolian <65838930+iWhy98@users.noreply.github.com>
Date: Tue, 25 Jan 2022 15:41:16 +0800
Subject: [PATCH 1/2] dnf:fix dnf mark error when history sqlite missing
---
dnf/cli/commands/mark.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dnf/cli/commands/mark.py b/dnf/cli/commands/mark.py
index ec16b738d..cb1f91c13 100644
--- a/dnf/cli/commands/mark.py
+++ b/dnf/cli/commands/mark.py
@@ -89,7 +89,7 @@ class MarkCommand(commands.Command):
old = self.base.history.last()
if old is None:
- rpmdb_version = self.sack._rpmdb_version()
+ rpmdb_version = self.base.sack._rpmdb_version()
else:
rpmdb_version = old.end_rpmdb_version
--
2.34.1
From bee5b97ad159af019deda4de0d80d0011dba4f7a Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 28 Jan 2022 16:53:50 +0100
Subject: [PATCH 2/2] Use rpm.TransactionSet.dbCookie() to determining if rpmdb
has changed
DNF was using private method `hawkey.Sack._rpmdb_version()` from libdnf.
The method computes SHA1 hash from sorted list of hashes stored in
the headers of the instaled packages. And it adds prefix of the number
of installed packages to the computed hash. The result was stored
to the history database and used to detect changes in the rpm database.
The patch uses new oficial librpm API function
`rpm.TransactionSet.dbCookie()`. This is a cleaner solution.
It is also a step to remove the `._rpmdb_version()` method from libdnf.
It is an attempt to remove SHA1 calculations from libdnf.
Troubleshooting FIPS compatibility.
= changelog =
msg: Use rpm.TransactionSet.dbCookie() to determining if rpmdb has changed
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2043476
---
dnf/base.py | 6 +++---
dnf/cli/commands/mark.py | 2 +-
dnf/cli/output.py | 2 +-
dnf/rpm/transaction.py | 16 ++++++++++++++++
tests/test_sack.py | 6 ------
5 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/dnf/base.py b/dnf/base.py
index b0a536f7f..574e80f66 100644
--- a/dnf/base.py
+++ b/dnf/base.py
@@ -907,7 +907,7 @@ class Base(object):
cmdline = ' '.join(self.cmds)
old = self.history.last()
if old is None:
- rpmdb_version = self.sack._rpmdb_version()
+ rpmdb_version = self._ts.dbCookie()
else:
rpmdb_version = old.end_rpmdb_version
@@ -1046,7 +1046,7 @@ class Base(object):
using_pkgs_pats = list(self.conf.history_record_packages)
installed_query = self.sack.query().installed()
using_pkgs = installed_query.filter(name=using_pkgs_pats).run()
- rpmdbv = self.sack._rpmdb_version()
+ rpmdbv = self._ts.dbCookie()
lastdbv = self.history.last()
if lastdbv is not None:
lastdbv = lastdbv.end_rpmdb_version
@@ -1163,7 +1163,7 @@ class Base(object):
for tsi in transaction_items:
count = display_banner(tsi.pkg, count)
- rpmdbv = rpmdb_sack._rpmdb_version()
+ rpmdbv = self._ts.dbCookie()
self.history.end(rpmdbv)
timer()
diff --git a/dnf/cli/commands/mark.py b/dnf/cli/commands/mark.py
index cb1f91c13..36bf9d436 100644
--- a/dnf/cli/commands/mark.py
+++ b/dnf/cli/commands/mark.py
@@ -89,7 +89,7 @@ class MarkCommand(commands.Command):
old = self.base.history.last()
if old is None:
- rpmdb_version = self.base.sack._rpmdb_version()
+ rpmdb_version = self.base._ts.dbCookie()
else:
rpmdb_version = old.end_rpmdb_version
diff --git a/dnf/cli/output.py b/dnf/cli/output.py
index a4e9f6c8e..ecf05c2b0 100644
--- a/dnf/cli/output.py
+++ b/dnf/cli/output.py
@@ -1607,7 +1607,7 @@ Transaction Summary
if lastdbv is not None and trans.tid == lasttid:
# If this is the last transaction, is good and it doesn't
# match the current rpmdb ... then mark it as bad.
- rpmdbv = self.sack._rpmdb_version()
+ rpmdbv = self.base._ts.dbCookie()
trans.compare_rpmdbv(str(rpmdbv))
lastdbv = None
diff --git a/dnf/rpm/transaction.py b/dnf/rpm/transaction.py
index bcc2a7024..a11f36e7e 100644
--- a/dnf/rpm/transaction.py
+++ b/dnf/rpm/transaction.py
@@ -12,8 +12,10 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from dnf.i18n import _
+import logging
import rpm
+_logger = logging.getLogger('dnf')
read_ts = None
ts = None
@@ -61,6 +63,20 @@ class TransactionWrapper(object):
mi.pattern(tag, tp, pat)
return mi
+ def dbCookie(self):
+ # dbCookie() does not support lazy opening of rpm database.
+ # The following line opens the database if it is not already open.
+ if self.ts.openDB() != 0:
+ _logger.error(_('The openDB() function connot open rpm database.'))
+ return ''
+
+ cookie = self.ts.dbCookie()
+ if not cookie:
+ _logger.error(_('The dbCookie() function did not return cookie of rpm database.'))
+ return ''
+
+ return cookie
+
def __getattr__(self, attr):
if attr in self._methods:
return self.getMethod(attr)
diff --git a/tests/test_sack.py b/tests/test_sack.py
index 49a715924..2c6fe8e01 100644
--- a/tests/test_sack.py
+++ b/tests/test_sack.py
@@ -32,12 +32,6 @@ class SackTest(tests.support.DnfBaseTestCase):
REPOS = []
- def test_rpmdb_version(self):
- version = self.sack._rpmdb_version()
- self.assertIsNotNone(version)
- expected = "%s:%s" % (tests.support.TOTAL_RPMDB_COUNT, tests.support.RPMDB_CHECKSUM)
- self.assertEqual(version, expected)
-
def test_excludepkgs(self):
self.base.conf.excludepkgs = ['pepper']
self.base._setup_excludes_includes()
--
2.34.1

View File

@ -8,7 +8,7 @@
%global rpm_version 4.14.0 %global rpm_version 4.14.0
# conflicts # conflicts
%global conflicts_dnf_plugins_core_version 4.0.20 %global conflicts_dnf_plugins_core_version 4.0.24-3
%global conflicts_dnf_plugins_extras_version 4.0.4 %global conflicts_dnf_plugins_extras_version 4.0.4
%global conflicts_dnfdaemon_version 0.3.19 %global conflicts_dnfdaemon_version 0.3.19
@ -66,7 +66,7 @@ It supports RPMs, modules and comps groups & environments.
Name: dnf Name: dnf
Version: 4.10.0 Version: 4.10.0
Release: 2%{?dist} Release: 4%{?dist}
Summary: %{pkg_summary} Summary: %{pkg_summary}
# For a breakdown of the licensing, see PACKAGE-LICENSING # For a breakdown of the licensing, see PACKAGE-LICENSING
License: GPLv2+ License: GPLv2+
@ -75,6 +75,7 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch Patch1: 0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch
Patch2: 0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch Patch2: 0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch
Patch3: 0003-Documentation-API-notes-for-cacheonly.patch Patch3: 0003-Documentation-API-notes-for-cacheonly.patch
Patch4: 0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: cmake BuildRequires: cmake
@ -89,7 +90,6 @@ Requires: python-dbus
Requires: %{_bindir}/sqlite3 Requires: %{_bindir}/sqlite3
%else %else
Recommends: (python3-dbus if NetworkManager) Recommends: (python3-dbus if NetworkManager)
Recommends: (%{_bindir}/sqlite3 if bash-completion)
%endif %endif
Provides: dnf-command(alias) Provides: dnf-command(alias)
Provides: dnf-command(autoremove) Provides: dnf-command(autoremove)
@ -159,6 +159,8 @@ Requires: python3-gpg
Requires: %{name}-data = %{version}-%{release} Requires: %{name}-data = %{version}-%{release}
%if 0%{?fedora} %if 0%{?fedora}
Recommends: deltarpm Recommends: deltarpm
# required for DNSSEC main.gpgkey_dns_verification https://dnf.readthedocs.io/en/latest/conf_ref.html
Recommends: python3-unbound
%endif %endif
Requires: python3-hawkey >= %{hawkey_version} Requires: python3-hawkey >= %{hawkey_version}
Requires: python3-libdnf >= %{hawkey_version} Requires: python3-libdnf >= %{hawkey_version}
@ -166,12 +168,10 @@ Requires: python3-libcomps >= %{libcomps_version}
Requires: python3-libdnf Requires: python3-libdnf
BuildRequires: python3-rpm >= %{rpm_version} BuildRequires: python3-rpm >= %{rpm_version}
Requires: python3-rpm >= %{rpm_version} Requires: python3-rpm >= %{rpm_version}
# required for DNSSEC main.gpgkey_dns_verification https://dnf.readthedocs.io/en/latest/conf_ref.html
Recommends: python3-unbound
%if 0%{?rhel} && 0%{?rhel} <= 7 %if 0%{?rhel} && 0%{?rhel} <= 7
Requires: rpm-plugin-systemd-inhibit Requires: rpm-plugin-systemd-inhibit
%else %else
Recommends: rpm-plugin-systemd-inhibit Recommends: (rpm-plugin-systemd-inhibit if systemd)
%endif %endif
%description -n python3-%{name} %description -n python3-%{name}
@ -374,6 +374,14 @@ popd
%{python3_sitelib}/%{name}/automatic/ %{python3_sitelib}/%{name}/automatic/
%changelog %changelog
* Mon Feb 07 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 4.10.0-4
- Use rpm.TransactionSet.dbCookie() to determining if rpmdb has changed (RhBug:2043476)
* Mon Jan 24 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 4.10.0-3
- Don't recommend python3-unbound (RhBug:1947925)
- Recommend rpm-plugin-systemd-inhibit only if systemd (RhBug:1947924)
- Don't recommend %{_bindir}/sqlite3 for bash-completion (RhBug:1947924)
* Tue Dec 07 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 4.10.0-2 * Tue Dec 07 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 4.10.0-2
- Respect cacheonly in python dnf API (RhBug:2026849) - Respect cacheonly in python dnf API (RhBug:2026849)
- [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630) - [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630)