#1286 Check if `buildopts.get_rpm_whitelist()` is really set before using it.
Merged 4 years ago by jkaluza. Opened 4 years ago by jkaluza.
jkaluza/fm-orchestrator whitelist  into  master

@@ -531,7 +531,7 @@ 

              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

@@ -487,6 +487,14 @@ 

              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()

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.

rebased onto 511cad8

4 years ago

Pull-Request has been merged by jkaluza

4 years ago