From ec9675770789d223c3b0ffd5a39d241420796cf8 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: May 31 2018 07:04:28 +0000 Subject: Copy modules instead of reparsing them The Modulemd.copy() method has been available since libmodulemd 1.1 and is much faster than dumping to a string and parsing it again. Signed-off-by: Stephen Gallagher Merges: https://pagure.io/pungi/pull-request/965 --- diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py index 397c6a0..61821d9 100644 --- a/pungi/phases/createrepo.py +++ b/pungi/phases/createrepo.py @@ -196,7 +196,7 @@ def create_variant_repo(compose, arch, variant, pkg_type, modules_metadata=None) for module_id, mmd in variant.arch_mmds[arch].items(): # Create copy of architecture specific mmd to filter out packages # which are not part of this particular repo. - repo_mmd = Modulemd.Module.new_from_string(mmd.dumps()) + repo_mmd = mmd.copy() repo_mmd.set_arch(tree_arch_to_yum_arch(arch)) artifacts = repo_mmd.get_rpm_artifacts() diff --git a/pungi/phases/gather/sources/source_module.py b/pungi/phases/gather/sources/source_module.py index 89e87be..99d4130 100644 --- a/pungi/phases/gather/sources/source_module.py +++ b/pungi/phases/gather/sources/source_module.py @@ -59,7 +59,7 @@ class GatherSourceModule(pungi.phases.gather.source.GatherSourceBase): for mmd in variant.mmds: mmd_id = "%s-%s" % (mmd.get_name(), mmd.get_stream()) if mmd_id not in variant.arch_mmds[arch]: - arch_mmd = Modulemd.Module.new_from_string(mmd.dumps()) + arch_mmd = mmd.copy() variant.arch_mmds[arch][mmd_id] = arch_mmd # Contains per-module RPMs added to variant.