From 1901bfd88032b12a74d2a711b7372e961cc68bfe Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Mar 13 2023 06:14:28 +0000 Subject: Add a possibility to specify koji profile in the config file Add a new 'koji' section to the fedmod's config file under the 'buildsystems' one alongside 'mbs' and 'pkgs' where one can specify a Koji profile that will be then used when retrieving the modules content. Before this change we had no way to tell fedmod to retrieve content of RHEL modules from brew instead of Fedora's koji. --- diff --git a/_fedmod/get_module_builds.py b/_fedmod/get_module_builds.py index 0b4d0bb..2d981ad 100644 --- a/_fedmod/get_module_builds.py +++ b/_fedmod/get_module_builds.py @@ -2,6 +2,8 @@ import re import koji +from .config import config, runtime_config +from .util import parse_dataset_name FEDORA_TAG_PATTERNS = [(re.compile(p), s) for p, s in [ (r'^(f\d+)-modular$', 'stable'), @@ -34,7 +36,7 @@ def get_module_builds(module_name, stream, base_version=None, status=None, koji_config=None, - koji_profile='koji', + koji_profile=None, include_rpms=False): """Return a list of Koji build objects for the specified, or latest @@ -57,6 +59,15 @@ def get_module_builds(module_name, stream, include_rpms -- if true, include a list of rpms built for each build """ + if not koji_profile: + dataset = runtime_config['dataset'] + release_name, arch = parse_dataset_name(dataset) + buildsystems = config.releases[release_name]['buildsystems'] + if 'koji' in buildsystems and 'profile' in buildsystems['koji']: + koji_profile = buildsystems['koji']['profile'] + else: + koji_profile = 'koji' + options = koji.read_config(profile_name=koji_profile, user_config=koji_config) session_opts = koji.grab_session_options(options)