]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Check if tools tree exists before statting it in cache_manifest()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Oct 2024 12:12:55 +0000 (14:12 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 10 Oct 2024 12:32:48 +0000 (14:32 +0200)
The tools tree might have been removed because it's cache was out of
date so let's make sure we check it exists in cache_manifest().

mkosi/config.py

index d8f491dc27100805b558b1842265af50ed1c6e08..02989006bd4fa8565621af7ee3b2e59e3ff7ad94 100644 (file)
@@ -1871,7 +1871,11 @@ class Config:
                 base64.b64encode(script.read_bytes()).decode() for script in self.prepare_scripts
             ),
             # Statting the root directory of the tools tree isn't fool proof but should be good enough.
-            "tools_tree": [self.tools_tree, self.tools_tree.stat().st_mtime_ns] if self.tools_tree else [],
+            "tools_tree": (
+                [self.tools_tree, self.tools_tree.stat().st_mtime_ns]
+                if self.tools_tree and self.tools_tree.exists()
+                else []
+            ),
         }
 
     def to_dict(self) -> dict[str, Any]: