f"--config={state.pkgmngr / 'etc/dnf/dnf.conf'}",
command,
"--best",
- "--allowerasing",
f"--releasever={release}",
f"--installroot={state.root}",
"--setopt=keepcache=1",
"--no-plugins" if dnf.endswith("dnf5") else "--noplugins",
]
+ # dnf5 doesn't support --allowerasing for remove. Add it for other commands.
+ if command != "remove":
+ cmdline += ["--allowerasing"]
+
# Make sure we download filelists so all dependencies can be resolved.
# See https://bugzilla.redhat.com/show_bug.cgi?id=2180842
if (dnf.endswith("dnf5") and