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
|
||||
|
||||
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"]
|
||||
# Store module versioning information into the dict, but make sure
|
||||
# not to overwrite any existing keys.
|
||||
md["module_stream"] = md["extra"]["typeinfo"]["module"]["stream"]
|
||||
md["module_version"] = int(md["extra"]["typeinfo"]["module"]["version"])
|
||||
md["module_context"] = md["extra"]["typeinfo"]["module"]["context"]
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
@ -167,9 +165,13 @@ def get_koji_modules(compose, koji_wrapper, event, module_info_str):
|
||||
# include all modules with that version.
|
||||
if not module_info.get('version'):
|
||||
# select all found modules with latest version
|
||||
sorted_modules = sorted(modules, key=lambda item: int(item['version']), reverse=True)
|
||||
latest_version = int(sorted_modules[0]['version'])
|
||||
modules = [module for module in modules if latest_version == int(module['version'])]
|
||||
sorted_modules = sorted(
|
||||
modules, key=lambda item: item["module_version"], reverse=True
|
||||
)
|
||||
latest_version = sorted_modules[0]["module_version"]
|
||||
modules = [
|
||||
module for module in modules if latest_version == module["module_version"]
|
||||
]
|
||||
|
||||
return modules
|
||||
|
||||
|
@ -303,9 +303,10 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
||||
assert len(result) == 1
|
||||
module = result[0]
|
||||
assert type(module) is dict
|
||||
assert "modulemd" in module
|
||||
assert "stream" in module
|
||||
assert "context" in module
|
||||
self.assertIn("module_stream", module)
|
||||
self.assertIn("module_version", module)
|
||||
self.assertIn("module_context", module)
|
||||
self.assertIn("tag", module)
|
||||
|
||||
expected_query = "testmodule2-master_dash-20180406051653.96c371af"
|
||||
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
||||
@ -426,9 +427,9 @@ class TestGetPackageSetFromKoji(helpers.PungiTestCase):
|
||||
module = result[0]
|
||||
for module in result:
|
||||
assert type(module) is dict
|
||||
assert "modulemd" in module
|
||||
assert "stream" in module
|
||||
assert "context" in module
|
||||
self.assertIn("module_stream", module)
|
||||
self.assertIn("module_version", module)
|
||||
self.assertIn("module_context", module)
|
||||
|
||||
expected_query = "testmodule2-master-*"
|
||||
self.koji_wrapper.koji_proxy.search.assert_called_once_with(expected_query, "build",
|
||||
|
Loading…
Reference in New Issue
Block a user