pkgset: Do not overwrite version in module
This value is important to get correct path to metadata. JIRA: COMPOSE-3541 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
b73d2d7f11
commit
f858cea466
@ -143,14 +143,12 @@ def get_koji_modules(compose, koji_wrapper, event, module_info_str):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
md["modulemd"] = md["extra"]["typeinfo"]["module"]["modulemd_str"]
|
|
||||||
md["tag"] = md["extra"]["typeinfo"]["module"]["content_koji_tag"]
|
md["tag"] = md["extra"]["typeinfo"]["module"]["content_koji_tag"]
|
||||||
# Get the NSVC from module metadata, because the original Koji build
|
# Store module versioning information into the dict, but make sure
|
||||||
# has '-' replaced with "_".
|
# not to overwrite any existing keys.
|
||||||
md["name"] = md["extra"]["typeinfo"]["module"]["name"]
|
md["module_stream"] = md["extra"]["typeinfo"]["module"]["stream"]
|
||||||
md["stream"] = md["extra"]["typeinfo"]["module"]["stream"]
|
md["module_version"] = int(md["extra"]["typeinfo"]["module"]["version"])
|
||||||
md["version"] = md["extra"]["typeinfo"]["module"]["version"]
|
md["module_context"] = md["extra"]["typeinfo"]["module"]["context"]
|
||||||
md["context"] = md["extra"]["typeinfo"]["module"]["context"]
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -167,9 +165,13 @@ def get_koji_modules(compose, koji_wrapper, event, module_info_str):
|
|||||||
# include all modules with that version.
|
# include all modules with that version.
|
||||||
if not module_info.get('version'):
|
if not module_info.get('version'):
|
||||||
# select all found modules with latest version
|
# select all found modules with latest version
|
||||||
sorted_modules = sorted(modules, key=lambda item: int(item['version']), reverse=True)
|
sorted_modules = sorted(
|
||||||
latest_version = int(sorted_modules[0]['version'])
|
modules, key=lambda item: item["module_version"], reverse=True
|
||||||
modules = [module for module in modules if latest_version == int(module['version'])]
|
)
|
||||||
|
latest_version = sorted_modules[0]["module_version"]
|
||||||
|
modules = [
|
||||||
|
module for module in modules if latest_version == module["module_version"]
|
||||||
|
]
|
||||||
|
|
||||||
return modules
|
return modules
|
||||||
|
|
||||||
|
@ -303,9 +303,10 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
|||||||
assert len(result) == 1
|
assert len(result) == 1
|
||||||
module = result[0]
|
module = result[0]
|
||||||
assert type(module) is dict
|
assert type(module) is dict
|
||||||
assert "modulemd" in module
|
self.assertIn("module_stream", module)
|
||||||
assert "stream" in module
|
self.assertIn("module_version", module)
|
||||||
assert "context" in module
|
self.assertIn("module_context", module)
|
||||||
|
self.assertIn("tag", module)
|
||||||
|
|
||||||
expected_query = "testmodule2-master_dash-20180406051653.96c371af"
|
expected_query = "testmodule2-master_dash-20180406051653.96c371af"
|
||||||
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
||||||
@ -426,9 +427,9 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
|||||||
module = result[0]
|
module = result[0]
|
||||||
for module in result:
|
for module in result:
|
||||||
assert type(module) is dict
|
assert type(module) is dict
|
||||||
assert "modulemd" in module
|
self.assertIn("module_stream", module)
|
||||||
assert "stream" in module
|
self.assertIn("module_version", module)
|
||||||
assert "context" in module
|
self.assertIn("module_context", module)
|
||||||
|
|
||||||
expected_query = "testmodule2-master-*"
|
expected_query = "testmodule2-master-*"
|
||||||
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
||||||
|
Loading…
Reference in New Issue
Block a user