pungi/1310.patch
2019-12-05 14:54:10 +01:00

43 lines
1.7 KiB
Diff

From e721c05849351762b912dca395655f75393b8cea Mon Sep 17 00:00:00 2001
From: Lubomír Sedlář <lsedlar@redhat.com>
Date: Dec 05 2019 13:28:34 +0000
Subject: Avoid crash if a module is not available on all arches
Theoretically it is possible, and this is the bare minimum of changes
needed to survive such situation. There may be other pitfalls.
Fixes: https://pagure.io/pungi/issue/1309
JIRA: COMPOSE-4016
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py
index e0a1da9..852af01 100644
--- a/pungi/phases/createrepo.py
+++ b/pungi/phases/createrepo.py
@@ -198,7 +198,7 @@ def create_variant_repo(compose, arch, variant, pkg_type, pkgset, modules_metada
mod_index = Modulemd.ModuleIndex()
metadata = []
- for module_id, mmd in variant.arch_mmds[arch].items():
+ for module_id, mmd in variant.arch_mmds.get(arch, {}).items():
if modules_metadata:
module_rpms = mmd.get_rpm_artifacts()
metadata.append((module_id, module_rpms))
diff --git a/pungi/phases/gather/sources/source_module.py b/pungi/phases/gather/sources/source_module.py
index 8e5de32..b2ef7ad 100644
--- a/pungi/phases/gather/sources/source_module.py
+++ b/pungi/phases/gather/sources/source_module.py
@@ -38,7 +38,7 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase):
compatible_arches = pungi.arch.get_compatible_arches(arch, multilib=True)
- for nsvc, module_stream in variant.arch_mmds[arch].items():
+ for nsvc, module_stream in variant.arch_mmds.get(arch, {}).items():
available_rpms = sum(
(
variant.nsvc_to_pkgset[nsvc].rpms_by_arch.get(a, [])