Modify content generator based on Koji dev feedback

- Change the type of build from modulemd to just module
- Change build output type from modulemd to file
- Provide the typeinfo also for the modulemd.yaml output
- Convert dashes to underscores for build version (i.e. mbs stream).
  koji build versions can't have dashes - we can provide real value in
  the extra section
- Add name, stream, version data into build extra section
- Add tool information for modulemd
- Add buildroot components from host running mbs
- Added few methods licensed under BSD 3-clause (from atomic-reactor)
This commit is contained in:
Stanislav Ochotnicky
2017-05-09 15:35:04 +02:00
parent 8648e883ee
commit 5eb4c1652f
4 changed files with 188 additions and 14 deletions

View File

@@ -69,17 +69,25 @@ class TestBuild(unittest.TestCase):
import moksha.hub.reactor
self.vcr.__exit__()
@patch("subprocess.Popen")
@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):
def test_get_generator_json(self, rpms_in_tag, machine, distro, pkg_res, popen):
""" Test generation of content generator json """
self.maxDiff = None
distro.return_value = ("Fedora", "25", "Twenty Five")
machine.return_value = "i686"
pkg_res.return_value = Mock()
pkg_res.return_value.version = "current-tested-version"
rpm_mock = Mock()
rpm_out = "rpm-name;1.0;r1;x86_64;(none);sigmd5:1;sigpgp:p;siggpg:g\n" \
"rpm-name-2;2.0;r2;i686;1;sigmd5:2;sigpgp:p2;siggpg:g2"
attrs = {'communicate.return_value': (rpm_out, 'error'),
'wait.return_value': 0}
rpm_mock.configure_mock(**attrs)
popen.return_value = rpm_mock
tests_dir = path.abspath(path.dirname(__file__))
rpm_in_tag_path = path.join(tests_dir,

View File

@@ -9,8 +9,34 @@
"name": "module-build-service",
"version": "current-tested-version"
},
"tools": [],
"components": [],
"tools": [
{
"name": "modulemd",
"version": "current-tested-version"
}
],
"components": [
{
"name": "rpm-name",
"version": "1.0",
"release": "r1",
"epoch": null,
"arch": "x86_64",
"sigmd5": "sigmd5:1",
"signature": "sigpgp:p",
"type": "rpm"
},
{
"name": "rpm-name-2",
"version": "2.0",
"release": "r2",
"epoch": 1,
"arch": "i686",
"sigmd5": "sigmd5:2",
"signature": "sigpgp:p2",
"type": "rpm"
}
],
"container": {
"arch": "i686",
"type": "none"
@@ -602,7 +628,12 @@
"filesize": 1134,
"checksum": "bf1615b15f6a0fee485abe94af6b56b6",
"checksum_type": "md5",
"type": "modulemd"
"type": "file",
"extra": {
"typeinfo": {
"module": {}
}
}
}
],
"metadata_version": 0,
@@ -613,7 +644,10 @@
"release": "2",
"extra": {
"typeinfo": {
"modulemd": {
"module": {
"name": "nginx",
"stream": "1",
"version": "2",
"module_build_service_id": 1,
"modulemd_str": "# Document type identifier\ndocument: modulemd\n# Module metadata format version\nversion: 1\ndata:\n # Module name, optional\n # Typically filled in by the buildsystem, using the VCS repository\n # name as the name of the module.\n name: nginx\n # Module update stream, optional\n # Typically filled in by the buildsystem, using the VCS branch name\n # as the name of the stream.\n stream: 1\n # Module version, integer, optional, cannot be negative\n # Typically filled in by the buildsystem, using the VCS commit\n # timestamp. Module version defines upgrade path for the particular\n # update stream.\n version: 2\n # A short summary describing the module, required\n summary: An example nginx module\n # A verbose description of the module, required\n description: >\n A module for the tests of module build service\n # Module and content licenses in the Fedora license identifier\n # format, required\n license:\n # Module license, required\n # This list covers licenses used for the module metadata, SPEC\n # files or extra patches\n module:\n - MIT\n"
}