with scopedenv({"TMPDIR": os.fspath(workspace / "tmp")}):
try:
yield Path(workspace)
- except BaseException:
+ finally:
if args.debug_workspace:
stack.pop_all()
log_notice(f"Workspace: {workspace}")
- raise
-
@contextlib.contextmanager
def lock_repository_metadata(config: Config) -> Iterator[None]:
run_postoutput_scripts(context)
finalize_staging(context)
- rmtree(context.root)
+
+ if not context.args.debug_workspace:
+ rmtree(context.root)
print_output_size(context.config.output_dir_or_cwd() / context.config.output_with_compression)
shell in the image allowing further debugging.
`--debug-workspace`
-: When an error occurs, the workspace directory will not be deleted.
+: When specified, the workspace directory will not be deleted and its
+ location will be logged when mkosi exits.
`--debug-sandbox`
: Run `mkosi-sandbox` with `strace`.