You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koji/0001-Fix-task-arch-filter-i...

56 lines
2.4 KiB

From 5a44f904747cd7defb79ee44750ad45707445729 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 9 Aug 2022 11:00:10 -0700
Subject: [PATCH] Fix task arch filter in download-task to handle noarch etc.
In 6713d1651d73b1b9d5dec37d0c5e0d85fa41a3c5 , filtering by task
arch was added to `download-task` when `--arch` is passed -
previously, it didn't bother filtering the tasks themselves by
arch, only any files they produce.
This introduces some problems. The most obvious one is that the
'task arch' for noarch package builds is not 'noarch' but
'whatever the arch of the builder is' - e.g. for task
90635802 , which is a noarch build, the arch is 's390x'.
Another problem would be with i386 vs. i686: for builds that
produce i686 RPMs, the task arch is i386. So in order to get
i686 packages, you'd have to pass `--arch=i386 --arch=i686".
Fortunately, the task "label" seems tailor-made to solve these
problems: when it's a noarch build, the label is "noarch", and
when it's an i386/i686 build, the label is "i686". So by just
including the task if its arch *or* its label is in the arches
passed on the command line, we resolve both those problems, and
hopefully any other similar ones.
Another option here would be just to ditch the arch filter and
go back to considering all tasks and only filtering files, but
this seems more efficient if it's safe in all cases.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2116674
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
cli/koji_cli/commands.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 9e2cc1b3..0249497b 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -6950,9 +6950,9 @@ def anon_handle_download_task(options, session, args):
build_methods_list = ['buildArch', 'build']
rpm_file_types = ['rpm', 'src.rpm']
for task in list_tasks:
- taskarch = task['arch']
+ taskarches = (task['arch'], task['label'])
task_id = str(task['id'])
- if len(suboptions.arches) == 0 or taskarch in suboptions.arches:
+ if len(suboptions.arches) == 0 or any(tarch in suboptions.arches for tarch in taskarches):
files = list_task_output_all_volumes(session, task["id"])
for filename in files:
if filename.endswith('src.rpm'):
--
2.37.1