Skip to content

Commit

Permalink
package_manager: fix the DNF4 fallback for --no-bootstrap-chroot
Browse files Browse the repository at this point in the history
When package_manager = dnf, 'dnf4' is to be selected and used when
bootstrap chroot is disabled.

Fixes: rpm-software-management#1475
  • Loading branch information
praiskup committed Sep 28, 2024
1 parent 9e84357 commit 4fe36b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mock/py/mockbuild/package_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

fallbacks = {
'dnf4': ['dnf4', 'dnf5', 'yum'],
'dnf': ['dnf4', 'dnf5', 'yum'], # backward-compat
'yum': ['yum', 'dnf4', 'dnf5'],
'microdnf': ['microdnf', 'dnf4', 'dnf5', 'yum'],
'dnf5': ['dnf5', 'dnf4', 'yum'],
Expand All @@ -31,7 +30,7 @@ def package_manager_from_string(name):
return Dnf5
if name == 'yum':
return Yum
if name in ['dnf4', 'dnf']: # dnf for backward compat
if name in 'dnf4':
return Dnf
if name == 'microdnf':
return MicroDnf
Expand All @@ -54,6 +53,10 @@ def package_manager_exists(pm_class, config_opts, chroot=None):

def package_manager_class_fallback(config_opts, buildroot, fallback):
desired = config_opts['package_manager']

if desired == 'dnf': # backward compat
desired = 'dnf4'

if not fallback:
return package_manager_from_string(desired)

Expand Down
3 changes: 3 additions & 0 deletions releng/release-notes-next/dnf-to-dnf4-fallback-fix.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
A fix for the DNF → DNF4 fallback has been applied. Now Mock correctly selects
DNF4, even when the `--no-bootstrap-chroot` command is used. See
[issue#1475][] for more info.

0 comments on commit 4fe36b5

Please sign in to comment.