From 3d9a067f39a4faf932d9ac2b6c2d74cc5b05f9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 23 May 2019 15:17:27 +0200 Subject: [PATCH] Ignore modules without modulemd in Koji --- 1199.patch | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pungi.spec | 6 +++++- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 1199.patch diff --git a/1199.patch b/1199.patch new file mode 100644 index 00000000..f0f09e44 --- /dev/null +++ b/1199.patch @@ -0,0 +1,63 @@ +From 33471c38bb859130e5843e896b07af2811b9b0a3 Mon Sep 17 00:00:00 2001 +From: Lubomír Sedlář +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ář + +--- + +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 + diff --git a/pungi.spec b/pungi.spec index 90035c9b..0ea1e020 100644 --- a/pungi.spec +++ b/pungi.spec @@ -2,7 +2,7 @@ Name: pungi Version: 4.1.36 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Distribution compose tool License: GPLv2 @@ -13,6 +13,7 @@ Patch1: https://pagure.io/pungi/pull-request/1184.patch Patch2: https://pagure.io/pungi/pull-request/1186.patch Patch3: https://pagure.io/pungi/pull-request/1189.patch Patch4: https://pagure.io/pungi/pull-request/1190.patch +Patch5: https://pagure.io/pungi/pull-request/1199.patch BuildRequires: python3-nose BuildRequires: python3-mock @@ -207,6 +208,9 @@ nosetests-3 --exe %{_bindir}/%{name}-wait-for-signed-ostree-handler %changelog +* Thu May 23 2019 Lubomír Sedlář - 4.1.36-5 +- Ignore modules without modulemd in Koji + * Mon May 13 2019 Lubomír Sedlář - 4.1.36-4 - Include more backported patches