Take the list of arches for -build Koji tag from buildrequired modules.

Currently, we are using just `conf.arches` and `conf.base_module_arches`
to define the list of arches for which the RPMs in a submitted module are
built. This is not enough, because RCM needs to generate modules based
on the base modules which should use different arches.

This commit changes the MBS to take the list of arches from the buildrequired
module build. It checks the buildrequires for "privileged" module or base
module and if it finds such module, it queries the Koji to find out the list
of arches to set for the module.

The "privileged" module is a module which can override base module arches
or disttag. Previously, these modules have been defined by
`allowed_disttag_marking_module_names` config option. In this commit,
this has been renamed to `allowed_privileged_module_names`.

The list of arches are stored per module build in new table represented
by ModuleArch class and are m:n mapped to ModuleBuild.
This commit is contained in:
Jan Kaluza
2019-06-03 13:34:51 +02:00
parent 222f0417cf
commit bf0bcaff57
16 changed files with 328 additions and 50 deletions

View File

@@ -52,7 +52,6 @@ from module_build_service.errors import ProgrammingError
from module_build_service.builder.base import GenericBuilder
from module_build_service.builder.KojiContentGenerator import KojiContentGenerator
from module_build_service.utils import get_reusable_components, get_reusable_module
from module_build_service.utils import get_build_arches
logging.basicConfig(level=logging.DEBUG)
@@ -180,10 +179,10 @@ class KojiModuleBuilder(GenericBuilder):
log.debug("Using koji_config: %s" % config.koji_config)
self.koji_session = self.get_session(config)
self.arches = get_build_arches(self.mmd, self.config)
self.arches = [arch.name for arch in self.module.arches]
if not self.arches:
raise ValueError("No arches specified in the config.")
raise ValueError("No arches specified in module build.")
# These eventually get populated by calling _connect and __prep is set to True
self.module_tag = None # string
@@ -1307,3 +1306,16 @@ class KojiModuleBuilder(GenericBuilder):
tags.append(t["name"])
return tags
@classmethod
def get_module_build_arches(cls, module):
"""
:param ModuleBuild module: Get the list of architectures associated with
the module build in the build system.
:return: list of architectures
"""
koji_session = KojiModuleBuilder.get_session(conf, login=False)
tag = koji_session.getTag(module.koji_tag)
if not tag:
raise ValueError("Unknown Koji tag %r." % module.koji_tag)
return tag["arches"].split(" ")