#3458 Fix task arch filter in download-task to handle noarch etc.
Closed 2 years ago by tkopecek. Opened 2 years ago by adamwill.

file modified
+2 -2
@@ -6950,9 +6950,9 @@ 

      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'):

In 6713d16 , 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

The reproducer here is:

koji download-task --arch noarch --arch x86_64 --arch src 90635784

with 1.29.0, that downloaded the noarch and src packages. With 1.29.1, it downloads nothing. With my patch, it again downloads the noarch and src packages.

Hi, I created new PR 3459. Your PR fix one part, but we forget in past, that arch filter is only for build and buildArches, it was fail. So now, there is filter only for these two methods and it is working. Taskarch value is used only for rename a filename, if it is needed.
Your PR break rename of files. Please can you check, that my PR fixes everything what you wanted (I checked command for task 90635784 and it is working as you expected).

Pull-Request has been closed by tkopecek

2 years ago
Metadata