Merge #1464 Fix the name field in modulemd text for -devel builds

This commit is contained in:
Mike McLean
2019-10-21 22:12:44 +00:00
2 changed files with 17 additions and 2 deletions

View File

@@ -276,7 +276,7 @@ class KojiContentGenerator(object):
u"module": {
u"module_build_service_id": self.module.id,
u"content_koji_tag": self.module.koji_tag,
u"modulemd_str": self.module.modulemd,
u"modulemd_str": self._get_fixed_mmd(),
u"name": ret["name"],
u"stream": self.module.stream,
u"version": self.module.version,
@@ -327,6 +327,16 @@ class KojiContentGenerator(object):
u"type": u"rpm",
}
def _get_fixed_mmd(self):
if self.devel:
mmd = self.module.mmd()
mmd = mmd.copy(mmd.get_module_name() + "-devel")
ret = mmd_to_str(mmd)
else:
ret = self.mmd
return ret
def _get_arch_mmd_output(self, output_path, arch):
"""
Returns the CG "output" dict for architecture specific modulemd file.
@@ -753,7 +763,7 @@ class KojiContentGenerator(object):
mmd_path = os.path.join(prepdir, "modulemd.txt")
log.info("Writing generic modulemd.yaml to %r" % mmd_path)
with open(mmd_path, "w", encoding="utf-8") as mmd_f:
mmd_f.write(self.mmd)
mmd_f.write(self._get_fixed_mmd())
mmd_path = os.path.join(prepdir, "modulemd.src.txt")
self._download_source_modulemd(self.module.mmd(), mmd_path)

View File

@@ -131,6 +131,11 @@ class TestBuild:
# For devel, only check that the name has -devel suffix.
assert ret["build"]["name"] == "nginx-devel"
assert ret["build"]["extra"]["typeinfo"]["module"]["name"] == "nginx-devel"
new_mmd = module_build_service.utils.load_mmd(
ret["build"]["extra"]["typeinfo"]["module"]["modulemd_str"])
assert new_mmd.get_module_name().endswith("-devel")
new_mmd = module_build_service.utils.load_mmd_file("%s/modulemd.txt" % file_dir)
assert new_mmd.get_module_name().endswith("-devel")
# Ensure an anonymous Koji session works
koji_session.krb_login.assert_not_called()