diff --git a/backport-Add-obsoleters-of-only-latest-versions.patch b/backport-Add-obsoleters-of-only-latest-versions.patch new file mode 100644 index 0000000000000000000000000000000000000000..4981e30688aa98c30a274527a6725ceb3feefc93 --- /dev/null +++ b/backport-Add-obsoleters-of-only-latest-versions.patch @@ -0,0 +1,52 @@ +From a9593d266f603b344bbfb9bd9c84606a7cc93f8f Mon Sep 17 00:00:00 2001 +From: Marek Blaha +Date: Wed, 20 Sep 2023 09:15:03 +0200 +Subject: [PATCH] base: Add obsoleters of only latest versions + +Resolves situations where a package is in older version obsoleted, but +there is newer (not obsoleted) version available. +This patch covers installation of group packages and arch specific +packages. The rest is in hawkey library. + +Relevant bugs: +https://bugzilla.redhat.com/show_bug.cgi?id=2183279 +https://bugzilla.redhat.com/show_bug.cgi?id=2176263 +--- + dnf/base.py | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/dnf/base.py b/dnf/base.py +index 4bbd0eca3e..1686134e7f 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -1690,7 +1690,16 @@ def trans_install(query, remove_query, comps_pkg, strict): + sltr.set(provides="({} if {})".format(comps_pkg.name, comps_pkg.requires)) + else: + if self.conf.obsoletes: +- query = query.union(self.sack.query().filterm(obsoletes=query)) ++ # If there is no installed package in the pkgs_list, add only ++ # obsoleters of the latest versions. Otherwise behave ++ # consistently with upgrade and add all obsoleters. ++ # See https://bugzilla.redhat.com/show_bug.cgi?id=2176263 ++ # for details of the problem. ++ if query.installed(): ++ query = query.union(self.sack.query().filterm(obsoletes=query)) ++ else: ++ query = query.union(self.sack.query().filterm( ++ obsoletes=query.filter(latest_per_arch_by_priority=True))) + sltr.set(pkg=query) + self._goal.install(select=sltr, optional=not strict) + return remove_query +@@ -1927,7 +1936,11 @@ def _install_multiarch(self, query, reponame=None, strict=True): + sltr = dnf.selector.Selector(self.sack) + q = self.sack.query().filterm(pkg=packages) + if self.conf.obsoletes: +- q = q.union(self.sack.query().filterm(obsoletes=q)) ++ # use only obsoletes of the latest versions ++ # See https://bugzilla.redhat.com/show_bug.cgi?id=2176263 ++ # for details of the problem. ++ q = q.union(self.sack.query().filterm( ++ obsoletes=q.filter(latest_per_arch_by_priority=True))) + sltr = sltr.set(pkg=q) + if reponame is not None: + sltr = sltr.set(reponame=reponame) diff --git a/dnf.spec b/dnf.spec index abf2dc2ec25d497e8e4e3ef723a95eac5a17ae78..1238beefe83895f286f94f596a90dc4acb2a6f05 100644 --- a/dnf.spec +++ b/dnf.spec @@ -32,6 +32,7 @@ Patch6006: backport-Limit-queries-to-nevra-forms-when-provided-by-com Patch6007: backport-doc-Remove-provide-of-spec-definition-for-repoquery-command.patch Patch6008: backport-Update-the-man-page-entry-for-the-countme-option.patch Patch6009: backport-Allow-local-downloads-to-same-downloaddir.patch +Patch6010: backport-Add-obsoleters-of-only-latest-versions.patch Patch9001: bugfix-automatic-Use-add_security_filters-not-_update_secur.patch @@ -261,6 +262,12 @@ popd %{_mandir}/man8/%{name}-automatic.8* %changelog +* Tue Jun 17 2025 majianhan - 4.16.2-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: backport base Add obsoleters of only latest versions + * Mon Nov 04 2024 majianhan - 4.16.2-8 - Type:bugfix - ID:NA