From c1f2fa5035e6870859bfe7e2363d3acf1de61a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 15 May 2023 08:39:15 +0200 Subject: [PATCH] gather: Support dotarch in DNF backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation claims that dotarch syntax is supported for additional packages. For yum backend this seems to be handled automatically, but the dnf backend could not interpret this. This patch checks if a package is specified in the syntax and contains a valid architecture. If so, the query will honor the arch. JIRA: RHELCMP-11728 Signed-off-by: Lubomír Sedlář (cherry picked from commit 82ca4f4e65d1961ba828dea3fee46ec6be0d34d3) --- pungi/gather_dnf.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py index 06795015..86652723 100644 --- a/pungi/gather_dnf.py +++ b/pungi/gather_dnf.py @@ -26,6 +26,7 @@ import pungi.common import pungi.dnf_wrapper import pungi.multilib_dnf import pungi.util +from pungi import arch_utils from pungi.linker import Linker from pungi.profiler import Profiler from pungi.util import DEBUG_PATTERNS @@ -500,9 +501,16 @@ class Gather(GatherBase): name__glob=pattern[:-2] ).apply() else: - pkgs = self.q_binary_packages.filter( - name__glob=pattern - ).apply() + kwargs = {"name__glob": pattern} + if "." in pattern: + # The pattern could be name.arch. Check if the + # arch is valid, and if yes, make a more + # specific query. + name, arch = pattern.split(".", 1) + if arch in arch_utils.arches: + kwargs["name__glob"] = name + kwargs["arch__eq"] = arch + pkgs = self.q_binary_packages.filter(**kwargs).apply() if not pkgs: self.logger.error("No package matches pattern %s" % pattern)