diff --git a/mock/integration-tests/23-local-mirrorlist.tst b/mock/integration-tests/23-local-mirrorlist.tst index 9cc45ff3e..57069d7d0 100644 --- a/mock/integration-tests/23-local-mirrorlist.tst +++ b/mock/integration-tests/23-local-mirrorlist.tst @@ -35,11 +35,14 @@ gpgcheck=0 """ EOF +# default chroot is DNF5, centos-stream is DNF4 +for chroot in "" "-r centos-stream+epel-9-x86_64"; do for isolation in simple nspawn; do - for bootstrap in bootstrap-chroot no-bootstrap-chroot; do - mock="$MOCKCMD --isolation=$isolation --$bootstrap -r $config" - $mock --install always-installable - $mock --scrub=chroot - $mock --scrub=bootstrap - done +for bootstrap in bootstrap-chroot no-bootstrap-chroot; do + mock="$MOCKCMD $chroot --isolation=$isolation --$bootstrap -r $config" + $mock --install always-installable + $mock --scrub=chroot + $mock --scrub=bootstrap +done +done done diff --git a/mock/py/mockbuild/package_manager.py b/mock/py/mockbuild/package_manager.py index af3f24a24..2c4b7b984 100644 --- a/mock/py/mockbuild/package_manager.py +++ b/mock/py/mockbuild/package_manager.py @@ -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'], @@ -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 @@ -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) diff --git a/releng/release-notes-next/dnf-to-dnf4-fallback-fix.bugfix b/releng/release-notes-next/dnf-to-dnf4-fallback-fix.bugfix new file mode 100644 index 000000000..5d92876ba --- /dev/null +++ b/releng/release-notes-next/dnf-to-dnf4-fallback-fix.bugfix @@ -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.