From 84df0b4ef19e742ce60c0386be9680d05003dc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0abata?= Date: Fri, 26 May 2017 09:40:37 +0200 Subject: [PATCH] Use modulemd.dump_all to create local repodata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both pungi and dnf use the new multidocument format, with the old one not really being supported by anything at this point. Let's be compatible. This change requires modulemd-1.2.0+. Signed-off-by: Petr Ĺ abata --- module_build_service/builder/MockModuleBuilder.py | 7 ++----- requirements.txt | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/module_build_service/builder/MockModuleBuilder.py b/module_build_service/builder/MockModuleBuilder.py index af3bd68d..20aa4093 100644 --- a/module_build_service/builder/MockModuleBuilder.py +++ b/module_build_service/builder/MockModuleBuilder.py @@ -26,6 +26,7 @@ import logging import os import koji import kobo.rpmlib +import modulemd import shutil import yaml import threading @@ -163,12 +164,8 @@ mdpolicy=group:primary # Generate the mmd the same way as pungi does. m1 = ModuleBuild.query.filter(ModuleBuild.name == self.module_str).one() - modules = {"modules": []} - modules["modules"].append(yaml.safe_load(m1.mmd().dumps())) mmd_path = os.path.join(path, "modules.yaml") - - with open(mmd_path, "w") as outfile: - outfile.write(yaml.safe_dump(modules)) + modulemd.dump_all(mmd_path, [ m1.mmd() ]) # Generate repo and inject modules.yaml there. execute_cmd(['/usr/bin/createrepo_c', path]) diff --git a/requirements.txt b/requirements.txt index 81b8fa1c..6c2823e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ kobo m2crypto m2ext mock -modulemd>=1.1.0,<2.0.0 +modulemd>=1.2.0,<2.0.0 munch pdc-client pyOpenSSL