Port to libmodulemd and support v2 modulemd without module stream expansion

This commit is contained in:
mprahl
2018-02-27 13:29:00 -05:00
parent 329a7acd76
commit f0852d9009
26 changed files with 591 additions and 400 deletions

View File

@@ -26,12 +26,14 @@ import logging
import os
import koji
import kobo.rpmlib
import modulemd
import pipes
import platform
import re
import threading
import gi
gi.require_version('Modulemd', '1.0') # noqa
from gi.repository import Modulemd
from module_build_service import conf, log
import module_build_service.scm
import module_build_service.utils
@@ -182,17 +184,20 @@ class MockModuleBuilder(GenericBuilder):
if m1.last_batch_id() == m1.batch:
# If RPM is filtered-out, do not add it to artifacts list.
nvr = kobo.rpmlib.parse_nvr(rpm)
if nvr["name"] in m1_mmd.filter.rpms:
if nvr["name"] in m1_mmd.get_rpm_filter().get():
continue
pkglist_f.write(rpm + '\n')
rpm = rpm[:-len(".rpm")]
m1_mmd.artifacts.add_rpm(str(rpm))
component = Modulemd.ComponentRpm()
component.set_name(str(rpm))
component.set_rationale('none')
m1_mmd.add_rpm_component(component)
pkglist_f.close()
mmd_path = os.path.join(path, "modules.yaml")
modulemd.dump_all(mmd_path, [m1_mmd])
m1_mmd.dump(mmd_path)
# Generate repo and inject modules.yaml there.
execute_cmd(['/usr/bin/createrepo_c', '--pkglist', pkglist, path])