Ignore modules without modulemd in Koji

This commit is contained in:
Lubomír Sedlář 2019-05-23 15:17:27 +02:00
parent 7a76bd0b4c
commit 3d9a067f39
2 changed files with 68 additions and 1 deletions

63
1199.patch Normal file
View File

@ -0,0 +1,63 @@
From 33471c38bb859130e5843e896b07af2811b9b0a3 Mon Sep 17 00:00:00 2001
From: Lubomír Sedlář <lsedlar@redhat.com>
Date: May 23 2019 11:51:15 +0000
Subject: pkgset: Ignore modules without metadata in Koji
This is fairly similar to a package only being built for particular
arches.
Fixes: https://pagure.io/pungi/issue/1198
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
---
diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py
index c406b5a..815576d 100644
--- a/pungi/phases/pkgset/sources/source_koji.py
+++ b/pungi/phases/pkgset/sources/source_koji.py
@@ -239,12 +239,24 @@ def _add_module_to_variant(koji_wrapper, variant, build, add_to_variant_modules=
pass
mmds[filename] = Modulemd.Module.new_from_file(file_path)
+ if len(mmds) <= 1:
+ # There was only one modulemd file. This means the build is rather old
+ # and final modulemd files were not uploaded. Such modules are no
+ # longer supported and should be rebuilt. Let's skip it.
+ return
+
source_mmd = mmds["modulemd.txt"]
nsvc = source_mmd.dup_nsvc()
variant.mmds.append(source_mmd)
for arch in variant.arches:
- variant.arch_mmds.setdefault(arch, {})[nsvc] = mmds["modulemd.%s.txt" % arch]
+ try:
+ variant.arch_mmds.setdefault(arch, {})[nsvc] = mmds["modulemd.%s.txt" % arch]
+ except KeyError:
+ # There is no modulemd for this arch. This could mean an arch was
+ # added to the compose after the module was built. We don't want to
+ # process this, let's skip this module.
+ pass
if add_to_variant_modules:
variant.modules.append(nsvc)
@@ -270,6 +282,8 @@ def _get_modules_from_koji(compose, koji_wrapper, event, variant, variant_tags):
koji_modules = get_koji_modules(compose, koji_wrapper, event, module["name"])
for koji_module in koji_modules:
mmd = _add_module_to_variant(koji_wrapper, variant, koji_module)
+ if not mmd:
+ continue
tag = koji_module["tag"]
nsvc = mmd.dup_nsvc()
@@ -447,6 +461,8 @@ def _get_modules_from_koji_tags(compose, koji_wrapper, event_id, variant, varian
variant_tags[variant].append(module_tag)
mmd = _add_module_to_variant(koji_wrapper, variant, build, True)
+ if not mmd:
+ continue
# Store mapping module-uid --> koji_tag into variant.
# This is needed in createrepo phase where metadata is exposed by producmd

View File

@ -2,7 +2,7 @@
Name: pungi Name: pungi
Version: 4.1.36 Version: 4.1.36
Release: 4%{?dist} Release: 5%{?dist}
Summary: Distribution compose tool Summary: Distribution compose tool
License: GPLv2 License: GPLv2
@ -13,6 +13,7 @@ Patch1: https://pagure.io/pungi/pull-request/1184.patch
Patch2: https://pagure.io/pungi/pull-request/1186.patch Patch2: https://pagure.io/pungi/pull-request/1186.patch
Patch3: https://pagure.io/pungi/pull-request/1189.patch Patch3: https://pagure.io/pungi/pull-request/1189.patch
Patch4: https://pagure.io/pungi/pull-request/1190.patch Patch4: https://pagure.io/pungi/pull-request/1190.patch
Patch5: https://pagure.io/pungi/pull-request/1199.patch
BuildRequires: python3-nose BuildRequires: python3-nose
BuildRequires: python3-mock BuildRequires: python3-mock
@ -207,6 +208,9 @@ nosetests-3 --exe
%{_bindir}/%{name}-wait-for-signed-ostree-handler %{_bindir}/%{name}-wait-for-signed-ostree-handler
%changelog %changelog
* Thu May 23 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.36-5
- Ignore modules without modulemd in Koji
* Mon May 13 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.36-4 * Mon May 13 2019 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.36-4
- Include more backported patches - Include more backported patches