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

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