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

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