Avoid crash on module with limited arches

This commit is contained in:
Lubomír Sedlář 2019-12-05 14:54:10 +01:00
parent 25f480ad4f
commit 5c9523c044
2 changed files with 47 additions and 1 deletions

42
1310.patch Normal file
View File

@ -0,0 +1,42 @@
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, [])

View File

@ -2,12 +2,13 @@
Name: pungi
Version: 4.1.41
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Distribution compose tool
License: GPLv2
URL: https://pagure.io/pungi
Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2
Patch0: https://pagure.io/pungi/pull-request/1310.patch
BuildRequires: python3-nose
BuildRequires: python3-mock
@ -141,6 +142,9 @@ nosetests-3 --exe
%{_bindir}/%{name}-wait-for-signed-ostree-handler
%changelog
* Thu Dec 05 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.41-2
- Avoid crash when module has limited arches
* Mon Dec 02 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.41-1
- repoclosure: Parse all fus logs (lsedlar)
- runroot: Log different commands to different files (lsedlar)