Use modulemd.dump_all to create local repodata

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 <contyk@redhat.com>
This commit is contained in:
Petr Šabata
2017-05-26 09:40:37 +02:00
parent 91758a9d4e
commit 84df0b4ef1
2 changed files with 3 additions and 6 deletions

View File

@@ -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])

View File

@@ -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