pkgset: Avoid adding modules to unavailable arches
If a module is not built for specific arches, pungi will skip adding it to these arches in pkgset phase. JIRA: RHELCMP-13625 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
bc0334cc09
commit
627b72597e
@ -222,6 +222,7 @@ def _add_module_to_variant(
|
|||||||
"""
|
"""
|
||||||
mmds = {}
|
mmds = {}
|
||||||
archives = koji_wrapper.koji_proxy.listArchives(build["id"])
|
archives = koji_wrapper.koji_proxy.listArchives(build["id"])
|
||||||
|
available_arches = set()
|
||||||
for archive in archives:
|
for archive in archives:
|
||||||
if archive["btype"] != "module":
|
if archive["btype"] != "module":
|
||||||
# Skip non module archives
|
# Skip non module archives
|
||||||
@ -235,7 +236,9 @@ def _add_module_to_variant(
|
|||||||
# in basearch. This assumes that each arch in the build maps to a
|
# in basearch. This assumes that each arch in the build maps to a
|
||||||
# unique basearch.
|
# unique basearch.
|
||||||
_, arch, _ = filename.split(".")
|
_, arch, _ = filename.split(".")
|
||||||
filename = "modulemd.%s.txt" % getBaseArch(arch)
|
basearch = getBaseArch(arch)
|
||||||
|
filename = "modulemd.%s.txt" % basearch
|
||||||
|
available_arches.add(basearch)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
mmds[filename] = file_path
|
mmds[filename] = file_path
|
||||||
@ -260,6 +263,12 @@ def _add_module_to_variant(
|
|||||||
compose.log_debug("Module %s is filtered from %s.%s", nsvc, variant, arch)
|
compose.log_debug("Module %s is filtered from %s.%s", nsvc, variant, arch)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if arch not in available_arches:
|
||||||
|
compose.log_debug(
|
||||||
|
"Module %s is not available for arch %s.%s", nsvc, variant, arch
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
filename = "modulemd.%s.txt" % arch
|
filename = "modulemd.%s.txt" % arch
|
||||||
if filename not in mmds:
|
if filename not in mmds:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
@ -745,7 +745,9 @@ class TestAddModuleToVariant(helpers.PungiTestCase):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def test_adding_module(self):
|
def test_adding_module(self):
|
||||||
variant = mock.Mock(arches=["armhfp", "x86_64"], arch_mmds={}, modules=[])
|
variant = mock.Mock(
|
||||||
|
arches=["armhfp", "x86_64", "ppc64le"], arch_mmds={}, modules=[]
|
||||||
|
)
|
||||||
|
|
||||||
source_koji._add_module_to_variant(
|
source_koji._add_module_to_variant(
|
||||||
self.koji, variant, self.buildinfo, compose=self.compose
|
self.koji, variant, self.buildinfo, compose=self.compose
|
||||||
@ -755,6 +757,7 @@ class TestAddModuleToVariant(helpers.PungiTestCase):
|
|||||||
self.assertEqual(mod1.get_NSVCA(), "module:master:20190318:abcdef:armhfp")
|
self.assertEqual(mod1.get_NSVCA(), "module:master:20190318:abcdef:armhfp")
|
||||||
mod2 = variant.arch_mmds["x86_64"]["module:master:20190318:abcdef"]
|
mod2 = variant.arch_mmds["x86_64"]["module:master:20190318:abcdef"]
|
||||||
self.assertEqual(mod2.get_NSVCA(), "module:master:20190318:abcdef:x86_64")
|
self.assertEqual(mod2.get_NSVCA(), "module:master:20190318:abcdef:x86_64")
|
||||||
|
self.assertNotIn("ppc64le", variant.arch_mmds)
|
||||||
self.assertEqual(len(variant.arch_mmds), 2)
|
self.assertEqual(len(variant.arch_mmds), 2)
|
||||||
self.assertEqual(variant.modules, [])
|
self.assertEqual(variant.modules, [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user