From: Daan De Meyer Date: Fri, 12 Sep 2025 08:53:52 +0000 (+0200) Subject: dnf: Fix /var package cache directory check in package_subdirs() X-Git-Tag: v26~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a587af0bf73dbcbc814360fb50726de9752cda75;p=thirdparty%2Fmkosi.git dnf: Fix /var package cache directory check in package_subdirs() package_subdirs() receives the full cache directory path, not the configured package cache directory (something like /var/cache/libdnf5), so we fix the check to check if the parent directory of the given cache directory is /var/cache so we don't have to know whether the last component is dnf or libdnf5. --- diff --git a/mkosi/installer/dnf.py b/mkosi/installer/dnf.py index 4f3ceb266..b966dbbaf 100644 --- a/mkosi/installer/dnf.py +++ b/mkosi/installer/dnf.py @@ -29,8 +29,10 @@ class Dnf(PackageManager): dirs = [p for p in cache.iterdir() if p.is_dir() and "-" in p.name and "mkosi" not in p.name] return [ ( + # If the package cache directory is set to /var, we need to make sure we look up packages + # where they were stored by dnf, so don't do any special handling in that case. d.relative_to(cache) / "packages" - if cache == Path("/var") + if cache.parent == Path("/var/cache") # Cache directories look like - so let's strip off the hash to reuse # the same package cache directory regardless of baseurl. else Path("packages") / d.name[: d.name.rfind("-")],