From 9aa4d8b40179014791e5bab5992ef7fb2582ba0c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 11 Jan 2022 13:27:34 -0500 Subject: [PATCH 1/2] import dnf-4.10.0-2.el9 --- ...ltilib_policyall-RhBug19966811995630.patch | 29 ++++++++++++++++ ...s-not-respect-cacheonly-RhBug1862970.patch | 33 +++++++++++++++++++ ...ocumentation-API-notes-for-cacheonly.patch | 26 +++++++++++++++ SPECS/dnf.spec | 10 +++++- 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch create mode 100644 SOURCES/0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch create mode 100644 SOURCES/0003-Documentation-API-notes-for-cacheonly.patch diff --git a/SOURCES/0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch b/SOURCES/0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch new file mode 100644 index 0000000..0d1b07a --- /dev/null +++ b/SOURCES/0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch @@ -0,0 +1,29 @@ +From 39e759ae6afb046cf6d60fb91b3ee208cb150a2f Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Mon, 6 Sep 2021 12:40:59 +0200 +Subject: [PATCH] [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630) + +https://bugzilla.redhat.com/show_bug.cgi?id=1996681 +https://bugzilla.redhat.com/show_bug.cgi?id=1995630 +--- + doc/conf_ref.rst | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/doc/conf_ref.rst b/doc/conf_ref.rst +index fa310e3..60afc86 100644 +--- a/doc/conf_ref.rst ++++ b/doc/conf_ref.rst +@@ -403,7 +403,9 @@ configuration file by your distribution to override the DNF defaults. + ``multilib_policy`` + :ref:`string ` + +- Controls how multilib packages are treated during install operations. Can either be ``"best"`` (the default) for the depsolver to prefer packages which best match the system's architecture, or ``"all"`` to install all available packages with compatible architectures. ++ Controls how multilib packages are treated during install operations. Can either be ``"best"`` (the default) for ++ the depsolver to prefer packages which best match the system's architecture, or ``"all"`` to install packages for ++ all available architectures. + + .. _obsoletes_conf_option-label: + +-- +libgit2 1.1.0 + diff --git a/SOURCES/0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch b/SOURCES/0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch new file mode 100644 index 0000000..30c4395 --- /dev/null +++ b/SOURCES/0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch @@ -0,0 +1,33 @@ +From 9ce65d8575494887a08506583d9d4f05df404fac Mon Sep 17 00:00:00 2001 +From: Jaroslav Rohel +Date: Wed, 20 Oct 2021 09:20:03 +0200 +Subject: [PATCH] Fix: Python dnf API does not respect cacheonly (RhBug:1862970) + +`Repo` object has always been constructed with default synchronization +strategy. The configuration option `cacheonly` was ignored. DNF +application set synchronization strategy later in the `Cli` object +during processing demands. + +The fix takes into account the `cacheonly` option during the construction +of the `Repo` object. Synchronization strategy may still be overriden +during demand processing. +--- + dnf/repo.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dnf/repo.py b/dnf/repo.py +index bb42230..1822cf0 100644 +--- a/dnf/repo.py ++++ b/dnf/repo.py +@@ -434,7 +434,7 @@ class Repo(dnf.conf.RepoConf): + self._pkgdir = None + self._key_import = _NullKeyImport() + self.metadata = None # :api +- self._repo.setSyncStrategy(self.DEFAULT_SYNC) ++ self._repo.setSyncStrategy(SYNC_ONLY_CACHE if parent_conf and parent_conf.cacheonly else self.DEFAULT_SYNC) + if parent_conf: + self._repo.setSubstitutions(parent_conf.substitutions) + self._substitutions = dnf.conf.substitutions.Substitutions() +-- +libgit2 1.1.0 + diff --git a/SOURCES/0003-Documentation-API-notes-for-cacheonly.patch b/SOURCES/0003-Documentation-API-notes-for-cacheonly.patch new file mode 100644 index 0000000..6628678 --- /dev/null +++ b/SOURCES/0003-Documentation-API-notes-for-cacheonly.patch @@ -0,0 +1,26 @@ +From 5c598df3541c21d5c2758c42bd2eb0df8c74eddc Mon Sep 17 00:00:00 2001 +From: Jaroslav Rohel +Date: Fri, 5 Nov 2021 08:52:56 +0100 +Subject: [PATCH] Documentation: API notes for cacheonly + +--- + doc/conf_ref.rst | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/doc/conf_ref.rst b/doc/conf_ref.rst +index 60afc86..1a593a1 100644 +--- a/doc/conf_ref.rst ++++ b/doc/conf_ref.rst +@@ -137,6 +137,9 @@ configuration file by your distribution to override the DNF defaults. + If set to ``True`` DNF will run entirely from system cache, will not update + the cache and will use it even in case it is expired. Default is ``False``. + ++ API Notes: Must be set before repository objects are created. Plugins must set ++ this in the pre_config hook. Later changes are ignored. ++ + .. _check_config_file_age-label: + + ``check_config_file_age`` +-- +libgit2 1.1.0 + diff --git a/SPECS/dnf.spec b/SPECS/dnf.spec index fd586a9..e882081 100644 --- a/SPECS/dnf.spec +++ b/SPECS/dnf.spec @@ -66,12 +66,16 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.10.0 -Release: 1%{?dist} +Release: 2%{?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-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch +Patch2: 0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch +Patch3: 0003-Documentation-API-notes-for-cacheonly.patch + BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -370,6 +374,10 @@ popd %{python3_sitelib}/%{name}/automatic/ %changelog +* Tue Dec 07 2021 Pavla Kratochvilova - 4.10.0-2 +- Respect cacheonly in python dnf API (RhBug:2026849) +- [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630) + * Mon Oct 25 2021 Pavla Kratochvilova - 4.10.0-1 - Update to 4.10.0 - Do not assume that a remote rpm is complete if present From ff6d9232d6cda87c9e69a49bdbc71e66d534c486 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 1 Mar 2022 08:05:31 -0500 Subject: [PATCH 2/2] import dnf-4.10.0-4.el9 --- ...ionSet.dbCookie-to-determining-if-rp.patch | 169 ++++++++++++++++++ SPECS/dnf.spec | 20 ++- 2 files changed, 183 insertions(+), 6 deletions(-) create mode 100644 SOURCES/0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch diff --git a/SOURCES/0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch b/SOURCES/0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch new file mode 100644 index 0000000..b5d94c9 --- /dev/null +++ b/SOURCES/0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch @@ -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 +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 + diff --git a/SPECS/dnf.spec b/SPECS/dnf.spec index e882081..2b1f260 100644 --- a/SPECS/dnf.spec +++ b/SPECS/dnf.spec @@ -8,7 +8,7 @@ %global rpm_version 4.14.0 # 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_dnfdaemon_version 0.3.19 @@ -66,7 +66,7 @@ It supports RPMs, modules and comps groups & environments. Name: dnf Version: 4.10.0 -Release: 2%{?dist} +Release: 4%{?dist} Summary: %{pkg_summary} # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ @@ -75,6 +75,7 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Patch1: 0001-doc-Improve-description-of-multilib_policyall-RhBug19966811995630.patch Patch2: 0002-Fix-Python-dnf-API-does-not-respect-cacheonly-RhBug1862970.patch Patch3: 0003-Documentation-API-notes-for-cacheonly.patch +Patch4: 0004-Use-rpm.TransactionSet.dbCookie-to-determining-if-rp.patch BuildArch: noarch BuildRequires: cmake @@ -89,7 +90,6 @@ Requires: python-dbus Requires: %{_bindir}/sqlite3 %else Recommends: (python3-dbus if NetworkManager) -Recommends: (%{_bindir}/sqlite3 if bash-completion) %endif Provides: dnf-command(alias) Provides: dnf-command(autoremove) @@ -159,6 +159,8 @@ Requires: python3-gpg Requires: %{name}-data = %{version}-%{release} %if 0%{?fedora} Recommends: deltarpm +# required for DNSSEC main.gpgkey_dns_verification https://dnf.readthedocs.io/en/latest/conf_ref.html +Recommends: python3-unbound %endif Requires: python3-hawkey >= %{hawkey_version} Requires: python3-libdnf >= %{hawkey_version} @@ -166,12 +168,10 @@ Requires: python3-libcomps >= %{libcomps_version} Requires: python3-libdnf BuildRequires: 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 Requires: rpm-plugin-systemd-inhibit %else -Recommends: rpm-plugin-systemd-inhibit +Recommends: (rpm-plugin-systemd-inhibit if systemd) %endif %description -n python3-%{name} @@ -374,6 +374,14 @@ popd %{python3_sitelib}/%{name}/automatic/ %changelog +* Mon Feb 07 2022 Pavla Kratochvilova - 4.10.0-4 +- Use rpm.TransactionSet.dbCookie() to determining if rpmdb has changed (RhBug:2043476) + +* Mon Jan 24 2022 Pavla Kratochvilova - 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 - 4.10.0-2 - Respect cacheonly in python dnf API (RhBug:2026849) - [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630)