]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Always use repository metadata from /var package cache directory
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 Sep 2025 07:40:55 +0000 (09:40 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 12 Sep 2025 08:28:06 +0000 (10:28 +0200)
Fixes #3883

mkosi/__init__.py

index 30f8854b3249b75177ff17b7a15664741d978f56..0dc7cb8d3dde042377629bd07d9b1b5e9644f619 100644 (file)
@@ -4893,7 +4893,12 @@ def sync_repository_metadata(
     # same cache directory as they both only use the repository id as the cache key which will trivially
     # conflict across multiple mirrors. Apt and Fedora put the mirror in the cache key for the repository
     # metadata in some form which avoids conflicts across different mirrors.
-    shared_repository_metadata_cache = last.distribution.package_manager(last) not in (Pacman, Zypper)
+    #
+    # If /var is used as the package cache directory, we are reusing the system package cache directory in
+    # mkosi-initrd so we *do* want to pick up the metadata from there in that case.
+    shared_repository_metadata_cache = last.package_cache_dir_or_default() == Path(
+        "/var"
+    ) or last.distribution.package_manager(last) not in (Pacman, Zypper)
 
     if shared_repository_metadata_cache:
         dst = last.package_cache_dir_or_default()