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