diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index 9ae6e59f..40a38ef4 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -148,13 +148,15 @@ def get_koji_modules(compose, koji_wrapper, event, module_info_str): except ValueError: version = md["release"] context = "00000000" - md["stream"] = md["version"] - md["version"] = version - md["context"] = context - try: md["modulemd"] = md["extra"]["typeinfo"]["module"]["modulemd_str"] md["tag"] = md["extra"]["typeinfo"]["module"]["content_koji_tag"] + # Get the NSVC from module metadata, because the original Koji build + # has '-' replaced with "_". + md["name"] = md["extra"]["typeinfo"]["module"]["name"] + md["stream"] = md["extra"]["typeinfo"]["module"]["stream"] + md["version"] = md["extra"]["typeinfo"]["module"]["version"] + md["context"] = md["extra"]["typeinfo"]["module"]["context"] except KeyError: continue diff --git a/tests/test_pkgset_source_koji.py b/tests/test_pkgset_source_koji.py index 6b0c750a..85854cdf 100644 --- a/tests/test_pkgset_source_koji.py +++ b/tests/test_pkgset_source_koji.py @@ -340,7 +340,12 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase): 'typeinfo': { 'module': { 'content_koji_tag': 'module-b62270b82443edde', - 'modulemd_str': mock.Mock()} + 'modulemd_str': mock.Mock(), + 'name': 'testmodule2', + 'stream': 'master', + 'version': '20180406051653', + 'context': '96c371af', + } } } mock_build_md = [ @@ -464,14 +469,24 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase): 'typeinfo': { 'module': { 'content_koji_tag': 'module-b62270b82443edde', - 'modulemd_str': mock.Mock()} + 'modulemd_str': mock.Mock(), + 'name': 'testmodule2', + 'stream': 'master', + 'version': '20180406051653', + 'context': '2e6f5e0a', + } } }, { 'typeinfo': { 'module': { 'content_koji_tag': 'module-52e40b9cdd3c0f7d', - 'modulemd_str': mock.Mock()} + 'modulemd_str': mock.Mock(), + 'name': 'testmodule2', + 'stream': 'master', + 'version': '20180406051653', + 'context': '96c371af', + } } } ]