From: Joerg Behrmann Date: Thu, 9 Nov 2023 13:58:51 +0000 (+0100) Subject: Use INVOKING_USER.home to find home in the workspace logic X-Git-Tag: v19~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab69120f9da900049cd7c1b130dfdfb197829517;p=thirdparty%2Fmkosi.git Use INVOKING_USER.home to find home in the workspace logic --- diff --git a/mkosi/config.py b/mkosi/config.py index 487a52749..37851bf01 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -896,15 +896,15 @@ class MkosiConfig: # If we're running from /home and there's a cache or output directory in /home, we want to use a workspace # directory in /home as well as /home might be on a separate partition or subvolume which means that to take # advantage of reflinks and such, the workspace directory has to be on the same partition/subvolume. - if Path.cwd().is_relative_to("/home") and len(Path.cwd().parents) >= 3: - home = Path.cwd().parents[-3] - - if ( - (self.cache_dir and self.cache_dir.is_relative_to(home) or - self.output_dir and self.output_dir.is_relative_to(home)) and - (home / ".cache").exists() - ): - return home / ".cache" + if ( + Path.cwd().is_relative_to(INVOKING_USER.home) and + (INVOKING_USER.home / ".cache").exists() and + ( + self.cache_dir and self.cache_dir.is_relative_to(INVOKING_USER.home) or + self.output_dir and self.output_dir.is_relative_to(INVOKING_USER.home) + ) + ): + return INVOKING_USER.home / ".cache" return Path("/var/tmp")