From ec9675770789d223c3b0ffd5a39d241420796cf8 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Wed, 30 May 2018 13:41:25 -0400 Subject: [PATCH] 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 --- pungi/phases/createrepo.py | 2 +- pungi/phases/gather/sources/source_module.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py index 397c6a08..61821d92 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 89e87bed..99d41303 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.