mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 03:38:12 +08:00
renaming koji_arches to arches
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
This commit is contained in:
@@ -28,7 +28,7 @@ class BaseConfiguration(object):
|
||||
MESSAGING_TOPIC_PREFIX = ['org.fedoraproject.prod']
|
||||
KOJI_CONFIG = '/etc/module-build-service/koji.conf'
|
||||
KOJI_PROFILE = 'koji'
|
||||
KOJI_ARCHES = ['i686', 'armv7hl', 'x86_64']
|
||||
ARCHES = ['i686', 'armv7hl', 'x86_64']
|
||||
KOJI_REPOSITORY_URL = 'https://kojipkgs.fedoraproject.org/repos'
|
||||
KOJI_TAG_PREFIXES = ['module']
|
||||
KOJI_ENABLE_CONTENT_GENERATOR = True
|
||||
|
||||
@@ -51,7 +51,7 @@ 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_reusable_components, get_reusable_module, get_build_arches
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
@@ -170,19 +170,10 @@ class KojiModuleBuilder(GenericBuilder):
|
||||
log.debug("Using koji_config: %s" % config.koji_config)
|
||||
|
||||
self.koji_session = self.get_session(config, owner)
|
||||
self.arches = config.koji_arches
|
||||
|
||||
# Handle BASE_MODULE_KOJI_ARCHES. Find out the base modules in buildrequires
|
||||
# section of XMD and set the Koji tag arches according to it.
|
||||
if "mbs" in self.mmd.get_xmd().keys():
|
||||
for req_name, req_data in self.mmd.get_xmd()["mbs"]["buildrequires"].items():
|
||||
ns = ":".join([req_name, req_data["stream"]])
|
||||
if ns in config.base_module_koji_arches:
|
||||
self.arches = config.base_module_koji_arches[ns]
|
||||
break
|
||||
self.arches = get_build_arches(self.mmd, self.config)
|
||||
|
||||
if not self.arches:
|
||||
raise ValueError("No koji_arches specified in the config.")
|
||||
raise ValueError("No arches specified in the config.")
|
||||
|
||||
# These eventually get populated by calling _connect and __prep is set to True
|
||||
self.module_tag = None # string
|
||||
|
||||
@@ -388,12 +388,12 @@ class GenericBuilder(six.with_metaclass(ABCMeta)):
|
||||
|
||||
:param components: List of comopnent names to compute the weight for.
|
||||
:param arches: List of arches to build for or None. If the value is None,
|
||||
conf.koji_arches will be used instead.
|
||||
conf.arches will be used instead.
|
||||
:rtype: dict
|
||||
:return: {component_name: weight_as_float, ...}
|
||||
"""
|
||||
if not arches:
|
||||
arches = conf.koji_arches
|
||||
arches = conf.arches
|
||||
|
||||
weights = {}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class Config(object):
|
||||
'type': str,
|
||||
'default': None,
|
||||
'desc': 'Koji config profile.'},
|
||||
'koji_arches': {
|
||||
'arches': {
|
||||
'type': list,
|
||||
'default': [],
|
||||
'desc': 'Koji architectures.'},
|
||||
@@ -415,7 +415,7 @@ class Config(object):
|
||||
'default': ['platform'],
|
||||
'desc': ("List of base module names which define the product version "
|
||||
"(by their stream) of modules depending on them.")},
|
||||
'base_module_koji_arches': {
|
||||
'base_module_arches': {
|
||||
'type': dict,
|
||||
'default': {},
|
||||
'desc': 'Per base-module name:stream Koji arches list.'},
|
||||
@@ -642,15 +642,15 @@ class Config(object):
|
||||
.format(strategy, ', '.join(SUPPORTED_STRATEGIES)))
|
||||
self._rebuild_strategy = strategy
|
||||
|
||||
def _setifok_base_module_koji_arches(self, data):
|
||||
def _setifok_base_module_arches(self, data):
|
||||
if not isinstance(data, dict):
|
||||
raise ValueError("BASE_MODULE_KOJI_ARCHES must be a dict")
|
||||
raise ValueError("BASE_MODULE_ARCHES must be a dict")
|
||||
for ns, arches in data.items():
|
||||
if len(ns.split(":")) != 2:
|
||||
raise ValueError("BASE_MODULE_KOJI_ARCHES keys must be in 'name:stream' format")
|
||||
raise ValueError("BASE_MODULE_ARCHES keys must be in 'name:stream' format")
|
||||
if not isinstance(arches, list):
|
||||
raise ValueError("BASE_MODULE_KOJI_ARCHES values must be lists")
|
||||
self._base_module_koji_arches = data
|
||||
raise ValueError("BASE_MODULE_ARCHES values must be lists")
|
||||
self._base_module_arches = data
|
||||
|
||||
def _setifok_rebuild_strategies_allowed(self, strategies):
|
||||
if not isinstance(strategies, list):
|
||||
|
||||
@@ -355,3 +355,24 @@ def get_mmd_from_scm(url):
|
||||
whitelist_url=False, mandatory_checks=False)
|
||||
|
||||
return mmd
|
||||
|
||||
|
||||
def get_build_arches(mmd, config):
|
||||
"""
|
||||
Returns the list of architectures for which the module `mmd` should be built.
|
||||
|
||||
:param mmd: Module MetaData
|
||||
:param config: config (module_build_service.config.Config instance)
|
||||
:return list of architectures
|
||||
"""
|
||||
arches = config.arches
|
||||
|
||||
# Handle BASE_MODULE_ARCHES. Find out the base modules in buildrequires
|
||||
# section of XMD and set the Koji tag arches according to it.
|
||||
if "mbs" in mmd.get_xmd().keys():
|
||||
for req_name, req_data in mmd.get_xmd()["mbs"]["buildrequires"].items():
|
||||
ns = ":".join([req_name, req_data["stream"]])
|
||||
if ns in config.base_module_arches:
|
||||
arches = config.base_module_arches[ns]
|
||||
break
|
||||
return arches
|
||||
|
||||
@@ -175,7 +175,7 @@ def format_mmd(mmd, scmurl, session=None):
|
||||
pkg.set_ref('master')
|
||||
if pkg.get_arches().size() == 0:
|
||||
arches = Modulemd.SimpleSet()
|
||||
arches.set(conf.koji_arches)
|
||||
arches.set(conf.arches)
|
||||
pkg.set_arches(arches)
|
||||
|
||||
# Add missing data in included modules components
|
||||
|
||||
@@ -412,7 +412,7 @@ class TestKojiBuilder:
|
||||
weights = KojiModuleBuilder.get_build_weights(["httpd", "apr"])
|
||||
assert weights == {"httpd": 1.5, "apr": 1.5}
|
||||
|
||||
@patch.object(conf, 'base_module_koji_arches',
|
||||
@patch.object(conf, 'base_module_arches',
|
||||
new={"platform:xx": ["x86_64", "i686"]})
|
||||
@pytest.mark.parametrize('blocklist', [False, True])
|
||||
@pytest.mark.parametrize('custom_whitelist', [False, True])
|
||||
|
||||
@@ -566,7 +566,7 @@ class TestUtils:
|
||||
module_build_service.utils.format_mmd(mmd1, None)
|
||||
|
||||
for pkg in mmd1.get_rpm_components().values():
|
||||
assert set(pkg.get_arches().get()) == set(conf.koji_arches)
|
||||
assert set(pkg.get_arches().get()) == set(conf.arches)
|
||||
|
||||
mmd2 = Modulemd.Module().new_from_file(testmodule_mmd_path)
|
||||
mmd2.upgrade()
|
||||
|
||||
Reference in New Issue
Block a user