Check if buildopts.get_rpm_whitelist() is really set before using it.

This fixes module builds which sets the `buildopts` for something else
than the RPM whitelist.

Before this commit, when `buildopts` was set, the RPM whitelist was
always taken from the buildopts even if it was not defined there.
This resulted in empty `rpm_whitelist` and therefore no pkglist set
in Koji tag.

In this commit, MBS uses whitelist from `buildopts` only if it is
really set by the module maintainer.
This commit is contained in:
Jan Kaluza
2019-06-12 13:09:08 +02:00
parent 71900fb471
commit 511cad8c14
2 changed files with 9 additions and 1 deletions

View File

@@ -531,7 +531,7 @@ class KojiModuleBuilder(GenericBuilder):
self.tag_name + "-build", self.arches, perm="admin")
buildopts = self.mmd.get_buildopts()
if buildopts:
if buildopts and buildopts.get_rpm_whitelist():
rpm_whitelist = buildopts.get_rpm_whitelist()
else:
rpm_whitelist = self.components

View File

@@ -487,6 +487,14 @@ class TestKojiBuilder:
opts.add_rpm_to_whitelist("custom2")
mmd.set_buildopts(opts)
self.module.modulemd = mmd_to_str(mmd)
else:
# Set some irrelevant buildopts options to test that KojiModuleBuilder
# is not confused by this.
mmd = self.module.mmd()
opts = Modulemd.Buildopts()
opts.set_rpm_macros("%my_macro 1")
mmd.set_buildopts(opts)
self.module.modulemd = mmd_to_str(mmd)
if repo_include_all is False:
mmd = self.module.mmd()