mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 18:28:52 +08:00
Check the libmodulemd version instead of modulemd
This commit is contained in:
@@ -167,13 +167,19 @@ class KojiContentGenerator(object):
|
||||
def __get_tools(self):
|
||||
"""Return list of tools which are important for reproducing mbs outputs"""
|
||||
|
||||
tools = [u"modulemd"]
|
||||
ret = []
|
||||
for tool in tools:
|
||||
version = text_type(pkg_resources.get_distribution(tool).version)
|
||||
ret.append({u"name": tool,
|
||||
u"version": version})
|
||||
return ret
|
||||
# TODO: In libmodulemd v1.5, there'll be a property we can check instead
|
||||
# of using RPM
|
||||
try:
|
||||
libmodulemd_version = subprocess.check_output(
|
||||
['rpm', '--queryformat', '%{VERSION}', '-q', 'libmodulemd'],
|
||||
universal_newlines=True).strip()
|
||||
except subprocess.CalledProcessError:
|
||||
libmodulemd_version = 'unknown'
|
||||
|
||||
return [{
|
||||
'name': 'libmodulemd',
|
||||
'version': libmodulemd_version
|
||||
}]
|
||||
|
||||
def _koji_rpms_in_tag(self, tag):
|
||||
""" Return the list of koji rpms in a tag. """
|
||||
|
||||
@@ -74,12 +74,14 @@ class TestBuild:
|
||||
|
||||
@patch("module_build_service.builder.KojiModuleBuilder.KojiModuleBuilder.get_session")
|
||||
@patch("subprocess.Popen")
|
||||
@patch("subprocess.check_output", return_value='1.4')
|
||||
@patch("pkg_resources.get_distribution")
|
||||
@patch("platform.linux_distribution")
|
||||
@patch("platform.machine")
|
||||
@patch(("module_build_service.builder.KojiContentGenerator.KojiContentGenerator."
|
||||
"_koji_rpms_in_tag"))
|
||||
def test_get_generator_json(self, rpms_in_tag, machine, distro, pkg_res, popen, get_session):
|
||||
def test_get_generator_json(self, rpms_in_tag, machine, distro, pkg_res, coutput, popen,
|
||||
get_session):
|
||||
""" Test generation of content generator json """
|
||||
koji_session = MagicMock()
|
||||
koji_session.getUser.return_value = GET_USER_RV
|
||||
@@ -118,12 +120,13 @@ class TestBuild:
|
||||
|
||||
@patch("module_build_service.builder.KojiModuleBuilder.KojiModuleBuilder.get_session")
|
||||
@patch("subprocess.Popen")
|
||||
@patch("subprocess.check_output", return_value='1.4')
|
||||
@patch("pkg_resources.get_distribution")
|
||||
@patch("platform.linux_distribution")
|
||||
@patch("platform.machine")
|
||||
@patch(("module_build_service.builder.KojiContentGenerator.KojiContentGenerator."
|
||||
"_koji_rpms_in_tag"))
|
||||
def test_get_generator_json_no_log(self, rpms_in_tag, machine, distro, pkg_res, popen,
|
||||
def test_get_generator_json_no_log(self, rpms_in_tag, machine, distro, pkg_res, coutput, popen,
|
||||
get_session):
|
||||
""" Test generation of content generator json """
|
||||
koji_session = MagicMock()
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
},
|
||||
"tools": [
|
||||
{
|
||||
"name": "modulemd",
|
||||
"version": "current-tested-version"
|
||||
"name": "libmodulemd",
|
||||
"version": "1.4"
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
},
|
||||
"tools": [
|
||||
{
|
||||
"name": "modulemd",
|
||||
"version": "current-tested-version"
|
||||
"name": "libmodulemd",
|
||||
"version": "1.4"
|
||||
}
|
||||
],
|
||||
"components": [
|
||||
|
||||
Reference in New Issue
Block a user