Skip to content

Commit

Permalink
Restore PM-specific option specification in mock config (#1074)
Browse files Browse the repository at this point in the history
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 ed19495
  • Loading branch information
cottsay authored Nov 1, 2024
1 parent 15a8d9f commit 63548fe
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion ros_buildfarm/templates/release/rpm/mock_config.cfg.em
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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
Expand Down

0 comments on commit 63548fe

Please sign in to comment.