diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py index 10a12539..92f0d96b 100644 --- a/pungi/phases/createrepo.py +++ b/pungi/phases/createrepo.py @@ -189,9 +189,12 @@ def create_variant_repo(compose, arch, variant, pkg_type): # Create copy of architecture specific mmd to filter out packages # which are not part of this particular repo. repo_mmd = copy.deepcopy(mmd) - repo_mmd["data"]["artifacts"]["rpms"] = [ - rpm_nevra for rpm_nevra in repo_mmd["data"]["artifacts"]["rpms"] - if rpm_nevra in rpm_nevras] + # Modules without RPMs are also valid. + if ("artifacts" in repo_mmd["data"] and + "rpms" in repo_mmd["data"]["artifacts"]): + repo_mmd["data"]["artifacts"]["rpms"] = [ + rpm_nevra for rpm_nevra in repo_mmd["data"]["artifacts"]["rpms"] + if rpm_nevra in rpm_nevras] modules.append(repo_mmd) with temp_dir() as tmp_dir: diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index dd6060cb..e2e2c3a3 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -194,6 +194,14 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event_id): mmd = modulemd.ModuleMetadata() mmd.loads(pdc_module["modulemd"]) + # Catch the issue when PDC does not contain RPMs, but + # the module definition says there should be some. + if not pdc_module["rpms"] and mmd.components.rpms: + raise ValueError( + "Module %s does not have any rpms in 'rpms' PDC field," + "but according to modulemd, there should be some." + % pdc_module["variant_uid"]) + # Add RPMs from PDC response to modulemd, so we can track # what RPM is in which module later in gather phase. for rpm_nevra in pdc_module["rpms"]: