Make repo_include_all setting configurable in xmd

Previously MBS configured all Koji build tags with
repo_include_all=True extra option.  But for some modules it was
desired to be able to have tags with repo_include_all=False.

Fixes #957
This commit is contained in:
Mikolaj Izdebski
2018-06-19 17:31:36 +02:00
parent 36a9026ca8
commit 0d29633da9
2 changed files with 23 additions and 1 deletions

View File

@@ -838,6 +838,10 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
'repo_include_all': True,
}
xmd = self.mmd.get_xmd()
if "mbs_options" in xmd.keys() and "repo_include_all" in xmd["mbs_options"].keys():
opts['extra']['repo_include_all'] = xmd["mbs_options"]["repo_include_all"]
# edit tag with opts
self.koji_session.editTag2(tag_name, **opts)
return self._get_tag(tag_name) # Return up2date taginfo

View File

@@ -414,7 +414,8 @@ class TestKojiBuilder:
@pytest.mark.parametrize('blocklist', [False, True])
@pytest.mark.parametrize('custom_whitelist', [False, True])
def test_buildroot_connect(self, custom_whitelist, blocklist):
@pytest.mark.parametrize('repo_include_all', [False, True])
def test_buildroot_connect(self, custom_whitelist, blocklist, repo_include_all):
if blocklist:
mmd = self.module.mmd()
xmd = glib.from_variant_dict(mmd.get_xmd())
@@ -429,6 +430,15 @@ class TestKojiBuilder:
mmd.set_buildopts(opts)
self.module.modulemd = mmd.dumps()
if repo_include_all is False:
mmd = self.module.mmd()
xmd = glib.from_variant_dict(mmd.get_xmd())
mbs_options = xmd["mbs_options"] if "mbs_options" in xmd.keys() else {}
mbs_options["repo_include_all"] = False
xmd["mbs_options"] = mbs_options
mmd.set_xmd(glib.dict_values(xmd))
self.module.modulemd = mmd.dumps()
builder = FakeKojiModuleBuilder(
owner=self.module.owner, module=self.module, config=conf, tag_name='module-foo',
components=["nginx"])
@@ -466,6 +476,14 @@ class TestKojiBuilder:
expected_calls = []
assert session.packageListBlock.mock_calls == expected_calls
expected_calls = [mock.call('module-foo', arches='i686 armv7hl x86_64',
extra={'mock.package_manager': 'dnf',
'repo_include_all': repo_include_all}),
mock.call('module-foo-build', arches='i686 armv7hl x86_64',
extra={'mock.package_manager': 'dnf',
'repo_include_all': repo_include_all})]
assert session.editTag2.mock_calls == expected_calls
@pytest.mark.parametrize('blocklist', [False, True])
def test_buildroot_connect_create_tag(self, blocklist):
if blocklist: