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,