From d162c54476a9b38662c188eb9f8744a3e91fae64 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 31 Oct 2024 10:34:32 -0500 Subject: [PATCH] Restore PM-specific option specification in mock config It appears that we actually WANT this configuration key to change with the package manager, and this will be required as mock now supports multiple DNF tools. This is all a bit of a mess right now. There isn't a straightforward way to determine which package manager we should be using, and mock is in the process of transitioning the default PM to dnf5, where it was previously unversioned dnf (which means dnf4). This reverts part of ed19495fa10107f32d5f2cd29e5e5f28bef4a622 --- .../templates/release/rpm/mock_config.cfg.em | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ros_buildfarm/templates/release/rpm/mock_config.cfg.em b/ros_buildfarm/templates/release/rpm/mock_config.cfg.em index 4e577ad67..06ab70e18 100644 --- a/ros_buildfarm/templates/release/rpm/mock_config.cfg.em +++ b/ros_buildfarm/templates/release/rpm/mock_config.cfg.em @@ -1,5 +1,13 @@ include('/etc/mock/default.cfg') +def _expanded(k, opts): + """Get a config value and ensure it has been expanded.""" + exp, opts['__jinja_expand'] = opts.get('__jinja_expand', False), True + try: + return opts[k] + finally: + opts['__jinja_expand'] = exp + # Change the root name since we're modifying the chroot config_opts['root'] += '-ros-buildfarm' @@ -10,7 +18,13 @@ config_opts['use_bootstrap'] = False config_opts['chroot_setup_cmd'] += ' python3-rpm-macros' # Install weak dependencies to get group members -config_opts[f'dnf_builddep_opts'] = config_opts.get(f'dnf_builddep_opts', []) + ['--setopt=install_weak_deps=True'] +package_manager = _expanded('package_manager', config_opts) +additional_opts = ['--setopt=install_weak_deps=True'] +config_opts[f'{package_manager}_builddep_opts'] = config_opts.get(f'{package_manager}_builddep_opts', []) + additional_opts + +# Deal with dnf -> dnf4 transition - see rpm-software-management/mock#1496 +if package_manager == 'dnf': + config_opts[f'dnf4_builddep_opts'] = config_opts.get(f'dnf4_builddep_opts', []) + additional_opts @[if env_vars]@ # Set environment vars from the build config