From: Daan De Meyer Date: Tue, 1 Aug 2023 16:44:49 +0000 (+0200) Subject: Make sure the temporary directory is recalculated when we modify TMPDIR X-Git-Tag: v15~49^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a424713c3ab045d0f1d176904c0973bc0bb7d43;p=thirdparty%2Fmkosi.git Make sure the temporary directory is recalculated when we modify TMPDIR --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 1583054c1..d2ca7c625 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1628,6 +1628,10 @@ def build_image(args: MkosiArgs, config: MkosiConfig) -> None: # Make sure tmpfiles' aging doesn't interfere with our workspace # while we are working on it. with MkosiState(args, config) as state, scopedenv({"TMPDIR" : str(state.workspace)}): + # python caches the default temporary directory so when we modify TMPDIR we have to make sure it gets + # recalculated (see https://docs.python.org/3/library/tempfile.html#tempfile.tempdir). + tempfile.tempdir = None + install_package_manager_trees(state) with mount_image(state):