Blame SOURCES/0032-Fix-upgrade-from-file-to-noarch-pkg-RhBug-2006018.patch

922fe2
From 46562dc76e50d86eed99a102af74a1187a4303e4 Mon Sep 17 00:00:00 2001
922fe2
From: Nicola Sella <nsella@redhat.com>
922fe2
Date: Thu, 11 Aug 2022 13:56:11 +0200
922fe2
Subject: [PATCH] Fix upgrade from file to noarch pkg (RhBug:2006018)
922fe2
922fe2
= changelog =
922fe2
msg: Fix upgrade pkg from file when installed pkg is noarch and upgrades
922fe2
to a different arch
922fe2
type: bugfix
922fe2
resolves: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=2006018
922fe2
---
922fe2
 dnf/base.py | 6 +++++-
922fe2
 1 file changed, 5 insertions(+), 1 deletion(-)
922fe2
922fe2
diff --git a/dnf/base.py b/dnf/base.py
922fe2
index 4ddfae15..aba411ea 100644
922fe2
--- a/dnf/base.py
922fe2
+++ b/dnf/base.py
922fe2
@@ -2109,7 +2109,11 @@ class Base(object):
922fe2
             sltr.set(pkg=[pkg])
922fe2
             self._goal.upgrade(select=sltr)
922fe2
             return 1
922fe2
-        q = installed.filter(name=pkg.name, arch=[pkg.arch, "noarch"])
922fe2
+        # do not filter by arch if the package is noarch
922fe2
+        if pkg.arch == "noarch":
922fe2
+            q = installed.filter(name=pkg.name)
922fe2
+        else:
922fe2
+            q = installed.filter(name=pkg.name, arch=[pkg.arch, "noarch"])
922fe2
         if not q:
922fe2
             msg = _("Package %s not installed, cannot update it.")
922fe2
             logger.warning(msg, pkg.name)
922fe2
-- 
922fe2
2.37.1
922fe2