From 91ab5c7b4541846087efa591f5f7d56839bcf7e0 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 9 Aug 2022 12:02:54 -0700 Subject: [PATCH] Backport PR #3458 to fix download-task arch filtering (#2116674) --- ...lter-in-download-task-to-handle-noar.patch | 55 +++++++++++++++++++ koji.spec | 11 +++- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 0001-Fix-task-arch-filter-in-download-task-to-handle-noar.patch diff --git a/0001-Fix-task-arch-filter-in-download-task-to-handle-noar.patch b/0001-Fix-task-arch-filter-in-download-task-to-handle-noar.patch new file mode 100644 index 0000000..ceac6d3 --- /dev/null +++ b/0001-Fix-task-arch-filter-in-download-task-to-handle-noar.patch @@ -0,0 +1,55 @@ +From 5a44f904747cd7defb79ee44750ad45707445729 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +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 +--- + 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 + diff --git a/koji.spec b/koji.spec index 4f08c47..87f7c6d 100644 --- a/koji.spec +++ b/koji.spec @@ -9,7 +9,7 @@ Name: koji Version: 1.29.1 -Release: 2%{?dist} +Release: 3%{?dist} # the included arch lib from yum's rpmUtils is GPLv2+ License: LGPLv2 and GPLv2+ Summary: Build system tools @@ -20,6 +20,10 @@ Source0: https://releases.pagure.org/koji/koji-%{version}.tar.bz2 # Don't crash on image build failure path if an imagefactory thing # isn't there Patch0: 0001-Don-t-crash-in-_checkImageState-if-there-s-no-image..patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2116674 +# https://pagure.io/koji/pull-request/3458 +# Fix arch filtering in `koji download-task` +Patch1: 0001-Fix-task-arch-filter-in-download-task-to-handle-noar.patch # Not upstreamable Patch100: fedora-config.patch @@ -352,8 +356,11 @@ done %systemd_postun kojira.service %changelog +* Tue Aug 09 2022 Adam Williamson - 1.29.1-3 +- Backport PR #3458 to fix download-task arch filtering. fixes rhbz#2116674 + * Wed Jul 20 2022 Adam Williamson - 1.29.1-2 -- Backport MR #3445 to fix a koji crash in image builds +- Backport PR #3445 to fix a koji crash in image builds * Tue Jul 12 2022 Kevin Fenzi - 1.29.1-1 - Update to 1.29.1. Fiex rhbz#2106294