#1028 Fix filtering noarch RPMs
Closed 5 years ago by jkaluza. Opened 5 years ago by lsedlar.
lsedlar/fm-orchestrator noarch-filtering  into  master

@@ -451,6 +451,10 @@ 

          #   "i686" -> []

          multilib_arches = set(compatible_arches) - set(

              pungi.arch.get_compatible_arches(arch))

+         # List of architectures that should be in ExclusiveArch tag or missing

+         # from ExcludeArch tag. Multilib should not be enabled here.

+         exclusive_arches = pungi.arch.get_valid_arches(

+             arch, multilib=False, add_noarch=False)

  

          # Modulemd.SimpleSet into which we will add the RPMs.

          rpm_artifacts = Modulemd.SimpleSet()
@@ -465,9 +469,9 @@ 

  

              # Skip the RPM if it is excluded on this arch or exclusive

              # for different arch.

-             if rpm["excludearch"] and set(rpm["excludearch"]) & set(compatible_arches):

+             if rpm["excludearch"] and set(rpm["excludearch"]) & set(exclusive_arches):

                  continue

-             if rpm["exclusivearch"] and not set(rpm["exclusivearch"]) & set(compatible_arches):

+             if rpm["exclusivearch"] and not set(rpm["exclusivearch"]) & set(exclusive_arches):

                  continue

  

              # Check the "whitelist" buildopts section of MMD.

The list of arches we compare against should not include multilib arches. Otherwise excluding does not behave correctly.

Example:
A build has ExcludeArch: i686 (because it only works on 64 bit arches). A noarch package is built there, but it would be excluded from x86_64.

Relates: https://pagure.io/pungi/pull-request/1050

+1, but I will write test for this. Or you can do it if you want to. there's bunch of test_fill_in_rpms_list_* tests in the end of tests/tests_content_generator.py.

You can execute it as "tox -e py27 ./tests/test_content_generator.py.

I have created tests for this PR here: https://pagure.io/fm-orchestrator/pull-request/1031

I'm closing this one without merging and we are going to merge my PR with tests once it gets +1.

Pull-Request has been closed by jkaluza

5 years ago