Blame SOURCES/0026-Use-installed_all-because-installed_query-is-filtere.patch

bc72d2
From fea1f456d3d5f3015ebcff4008959916bdaaf6d6 Mon Sep 17 00:00:00 2001
bc72d2
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
bc72d2
Date: Mon, 4 Jul 2022 09:46:29 +0200
bc72d2
Subject: [PATCH] Use `installed_all` because `installed_query` is filtered
bc72d2
 user input
bc72d2
bc72d2
`installed_query` could be missing packages. If we specify we want to
bc72d2
upgrade a specific nevra that is not yet installed, then `installed_query`
bc72d2
is empty because it is based on user input, but there could be other
bc72d2
versions of the pkg installed.
bc72d2
bc72d2
Eg: if kernel-1 and kernel-3 are installed and we specify we want to
bc72d2
upgrade kernel-2, nothing should be done because we already have higher
bc72d2
version, but now `installed_query` would be empty and kernel-2 would be
bc72d2
installed.
bc72d2
bc72d2
Therefore, we need to use `installed_all`.
bc72d2
---
bc72d2
 dnf/base.py | 2 +-
bc72d2
 1 file changed, 1 insertion(+), 1 deletion(-)
bc72d2
bc72d2
diff --git a/dnf/base.py b/dnf/base.py
bc72d2
index 82466831..e606d9fa 100644
bc72d2
--- a/dnf/base.py
bc72d2
+++ b/dnf/base.py
bc72d2
@@ -2152,7 +2152,7 @@ class Base(object):
bc72d2
             #     packages. Otherwise if for example kernel-1 and kernel-3 were installed and present in the
bc72d2
             #     transaction libsolv could decide to install kernel-2 because it is an upgrade for kernel-1 even
bc72d2
             #     though we don't want it because there already is a newer version present.
bc72d2
-            query = query.union(installed_query.latest().filter(name=[pkg.name for pkg in query]))
bc72d2
+            query = query.union(installed_all.latest().filter(name=[pkg.name for pkg in query]))
bc72d2
             sltr = dnf.selector.Selector(self.sack)
bc72d2
             sltr.set(pkg=query)
bc72d2
             self._goal.upgrade(select=sltr)
bc72d2
-- 
bc72d2
2.36.1
bc72d2