Support the modulemd buildopts.rpms.whitelist option

This commit is contained in:
mprahl
2018-06-22 14:12:39 -04:00
parent bed2107d07
commit 74e4c99984
2 changed files with 23 additions and 4 deletions

View File

@@ -400,7 +400,8 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
self.module_build_tag = self._koji_create_tag(
self.tag_name + "-build", self.arches, perm="admin")
self._koji_whitelist_packages(self.components)
self._koji_whitelist_packages(
self.mmd.props.buildopts.props.rpm_whitelist or self.components)
# If we have just created the build tag in this buildroot_connect call, block all
# the components in `blocked_packages` list. We want to do that just once, because

View File

@@ -413,7 +413,8 @@ class TestKojiBuilder:
assert weights == {"httpd": 1.5, "apr": 1.5}
@pytest.mark.parametrize('blocklist', [False, True])
def test_buildroot_connect(self, blocklist):
@pytest.mark.parametrize('custom_whitelist', [False, True])
def test_buildroot_connect(self, custom_whitelist, blocklist):
if blocklist:
mmd = self.module.mmd()
xmd = glib.from_variant_dict(mmd.get_xmd())
@@ -421,6 +422,13 @@ class TestKojiBuilder:
mmd.set_xmd(glib.dict_values(xmd))
self.module.modulemd = mmd.dumps()
if custom_whitelist:
mmd = self.module.mmd()
opts = mmd.get_buildopts()
opts.set_rpm_whitelist(['custom1', 'custom2'])
mmd.set_buildopts(opts)
self.module.modulemd = mmd.dumps()
builder = FakeKojiModuleBuilder(
owner=self.module.owner, module=self.module, config=conf, tag_name='module-foo',
components=["nginx"])
@@ -431,8 +439,18 @@ class TestKojiBuilder:
groups['srpm-build'] = set(["fedora-release"])
builder.buildroot_connect(groups)
expected_calls = [mock.call('module-foo', 'nginx', u'Moe Szyslak'),
mock.call('module-foo-build', 'nginx', u'Moe Szyslak')]
if custom_whitelist:
expected_calls = [
mock.call('module-foo', 'custom1', 'Moe Szyslak'),
mock.call('module-foo', 'custom2', 'Moe Szyslak'),
mock.call('module-foo-build', 'custom1', 'Moe Szyslak'),
mock.call('module-foo-build', 'custom2', 'Moe Szyslak')
]
else:
expected_calls = [
mock.call('module-foo', 'nginx', 'Moe Szyslak'),
mock.call('module-foo-build', 'nginx', 'Moe Szyslak')
]
assert session.packageListAdd.mock_calls == expected_calls
expected_calls = [mock.call('module-foo-build', 'build'),