Use the scrmod prefix also for build targets for scratch builds.

Currently, the Koji tags have properly set the scrmod- prefix, but
the build target still sets module- prefix even for scratch builds.

In this commit, build target has the scrmod- prefix too.
This commit is contained in:
Jan Kaluza
2019-03-14 13:10:47 +01:00
parent b39f92b820
commit 9a6646f27c
2 changed files with 26 additions and 1 deletions

View File

@@ -525,7 +525,7 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
target_length = 50 + len('-build')
target = module_build_service.utils.generate_koji_tag(
self.module.name, self.module.stream, self.module.version, self.module.context,
target_length)
target_length, scratch=self.module.scratch, scratch_id=self.module.id)
# Add main build target.
self.module_target = self._koji_add_target(target, self.module_build_tag, self.module_tag)

View File

@@ -550,6 +550,31 @@ class TestKojiBuilder:
expected_calls = []
assert session.packageListBlock.mock_calls == expected_calls
@pytest.mark.parametrize('scratch', [False, True])
def test_buildroot_connect_create_target(self, scratch):
if scratch:
self.module.scratch = scratch
builder = FakeKojiModuleBuilder(
owner=self.module.owner, module=self.module, config=conf, tag_name='module-foo',
components=["nginx"])
session = builder.koji_session
session.getBuildTarget = MagicMock()
session.getBuildTarget.return_value = {}
groups = OrderedDict()
groups['build'] = set(["unzip"])
groups['srpm-build'] = set(["fedora-release"])
builder.buildroot_connect(groups)
if scratch:
expected_calls = [mock.call(
'scrmod-nginx-1-2-00000000+2', 'module-foo-build', 'module-foo')]
else:
expected_calls = [mock.call(
'module-nginx-1-2-00000000', 'module-foo-build', 'module-foo')]
assert session.createBuildTarget.mock_calls == expected_calls
@patch('module_build_service.builder.KojiModuleBuilder.KojiClientSession')
def test_get_built_rpms_in_module_build(self, ClientSession):
session = ClientSession.return_value