From 8026806afe2461637e3976a1a878a4acb99663d0 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Wed, 6 Nov 2024 12:59:32 +0100 Subject: [PATCH] mock: make --dnf-cmd compatible with DNF5 Fix #1400 --- mock/py/mockbuild/config.py | 6 +++++- releng/release-notes-next/dnf-cmd.bugfix | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releng/release-notes-next/dnf-cmd.bugfix diff --git a/mock/py/mockbuild/config.py b/mock/py/mockbuild/config.py index 1f95a7551..22da41426 100644 --- a/mock/py/mockbuild/config.py +++ b/mock/py/mockbuild/config.py @@ -629,7 +629,11 @@ def set_config_opts_per_cmdline(config_opts, options, args): if options.mode == 'yum-cmd': config_opts['package_manager'] = 'yum' if options.mode == 'dnf-cmd': - config_opts['package_manager'] = 'dnf' + # If config specifies a different package manager (e.g. yum), force + # using dnf. However, if config specifies its preference on either dnf + # or dnf5, respect that preference. + if config_opts['package_manager'] not in ['dnf', 'dnf5']: + config_opts['package_manager'] = 'dnf' if options.short_circuit: config_opts['short_circuit'] = options.short_circuit diff --git a/releng/release-notes-next/dnf-cmd.bugfix b/releng/release-notes-next/dnf-cmd.bugfix new file mode 100644 index 000000000..acbe9aec6 --- /dev/null +++ b/releng/release-notes-next/dnf-cmd.bugfix @@ -0,0 +1 @@ +Make `--dnf-cmd` compatible with DNF5