]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add mirror to package cache key if one is specified
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 11:36:29 +0000 (13:36 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 2 Jul 2024 12:06:42 +0000 (14:06 +0200)
On Arch Linux, pacman seems to only check if the sync db on the
mirror is newer than the one available locally, which breaks when
using e.g. the archive where the sync db is older by definition.

Let's add any specified mirror to the default package cache dir key
to make sure that a different cache is used for explicitly specified
mirrors.

mkosi/config.py

index cbfd373ed28df54c5852b8d8e424598564b6106b..429c7554405c8246088e847ea535bbdf5b5bcbf5 100644 (file)
@@ -1542,10 +1542,10 @@ class Config:
         return Path("/var/tmp")
 
     def package_cache_dir_or_default(self) -> Path:
-        return (
-            self.package_cache_dir or
-            (INVOKING_USER.cache_dir() / f"{self.distribution}~{self.release}~{self.architecture}")
-        )
+        key = f"{self.distribution}~{self.release}~{self.architecture}"
+        if self.mirror:
+            key += f"-{self.mirror}"
+        return self.package_cache_dir or (INVOKING_USER.cache_dir() / key)
 
     def tools(self) -> Path:
         return self.tools_tree or Path("/")