]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Don't cache the package manager used in the tools tree cache manifest
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Mar 2025 21:13:42 +0000 (22:13 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 25 Mar 2025 21:49:29 +0000 (22:49 +0100)
Doing this causes issues when using mkosi sandbox as have_cache(tools)
will be different inside and outside of the sandbox when building Fedora
and only dnf is available outside the sandbox but dnf5 is available inside
the sandbox. Since we don't need to cache the package manager used anyway
when building the default tools tree because we don't cache the package
manager metadata either, don't cache it to avoid this problem.

mkosi/config.py

index b532de02aff33231c6cf92bd130b72439f351e88..b28f7bef5ed98cc17d75aae7b4ee1e5895cf4eb0 100644 (file)
@@ -2251,7 +2251,16 @@ class Config:
             "release": self.release,
             "mirror": self.mirror,
             "architecture": self.architecture,
-            "package_manager": self.distribution.package_manager(self).executable(self),
+            # Caching the package manager used does not matter for the default tools tree because we don't
+            # cache the package manager metadata for the tools tree either. In fact, it can cause issues as
+            # the cache manifest for the tools tree will sometimes be different depending on whether we're
+            # running inside or outside of the mkosi sandbox. To avoid these issues, don't cache the package
+            # manager used in the tools tree cache manifest.
+            **(
+                {"package_manager": self.distribution.package_manager(self).executable(self)}
+                if self.image != "tools"
+                else {}
+            ),
             "packages": sorted(self.packages),
             "build_packages": sorted(self.build_packages),
             "package_directories": [