]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
kernel-install: Prefer dnf over dnf5
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jan 2024 13:11:53 +0000 (14:11 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jan 2024 13:42:32 +0000 (14:42 +0100)
kernel-install/50-mkosi.install

index 477a1f7cdcd88176a3d18fee7a6c57712c6c3880..290c9dd56d3e3b37fbb348f6f1e798250a8da182 100644 (file)
@@ -13,7 +13,7 @@ from mkosi import identify_cpu
 from mkosi.archive import make_cpio
 from mkosi.config import OutputFormat, __version__
 from mkosi.log import die, log_setup
-from mkosi.run import run, uncaught_exception_handler
+from mkosi.run import find_binary, run, uncaught_exception_handler
 from mkosi.tree import copy_tree
 from mkosi.types import PathString
 from mkosi.util import umask
@@ -179,7 +179,9 @@ def main() -> None:
 
         logging.info(f"Building {output}")
 
-        run(cmdline)
+        # Prefer dnf as dnf5 has not yet officially replaced it and there's a much bigger chance that there will be a
+        # populated dnf cache directory.
+        run(cmdline, env={"MKOSI_DNF": dnf.name} if (dnf := find_binary("dnf", "dnf5")) else {})
 
     (context.staging_area / output).unlink()