From 388b31b6939d8959a2de4f4f341564b56d35b9cd Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Sep 27 2018 13:12:03 +0000 Subject: [PATCH 1/2] Fix filtering noarch RPMs 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 Signed-off-by: Lubomír Sedlář --- diff --git a/module_build_service/builder/KojiContentGenerator.py b/module_build_service/builder/KojiContentGenerator.py index c8a4307..b633b04 100644 --- a/module_build_service/builder/KojiContentGenerator.py +++ b/module_build_service/builder/KojiContentGenerator.py @@ -451,6 +451,10 @@ class KojiContentGenerator(object): # "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 @@ class KojiContentGenerator(object): # 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. From 4d0d0cb0df97432832ea9860d508505bcdf0ce39 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Oct 02 2018 05:38:55 +0000 Subject: [PATCH 2/2] Add test for filtering noarch RPMs with excludearch and multilib. --- diff --git a/tests/test_content_generator.py b/tests/test_content_generator.py index d24574b..b272f68 100644 --- a/tests/test_content_generator.py +++ b/tests/test_content_generator.py @@ -549,3 +549,18 @@ class TestBuild: # Only x86_64 packages should be filled in, because we requested x86_64 arch. assert set(mmd.get_content_licenses().get()) == set(expected) + + def test_fill_in_rpms_list_noarch_filtering_not_influenced_by_multilib(self): + # A build has ExcludeArch: i686 (because it only works on 64 bit arches). + # A noarch package is built there, and this noarch packages should be + # included in x86_64 repo. + self._add_test_rpm("dhcp-libs-12:4.3.5-5.module_2118aef6.noarch", "dhcp", + excludearch=["i686"]) + + mmd = self.cg.module.mmd() + mmd = self.cg._fill_in_rpms_list(mmd, "x86_64") + + # Only i686 package for dhcp-libs should be added, because perl-Tangerine does not have + # multilib set. + assert set(mmd.get_rpm_artifacts().get()) == set([ + "dhcp-libs-12:4.3.5-5.module_2118aef6.noarch"])