Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5445,15 +5445,7 @@ def want_default_initrd(config: Config) -> bool:
return Path("default") in config.initrds


def finalize_historydir(args: Args, output_dir: Optional[Path] = None) -> Path:
# When an output dir is given on the CLI, store the build history there so that concurrent builds with
# different output dirs don't clobber a shared history. Don't check the finalized OutputDirectory=
# config, only the CLI value: the former isn't known yet here (config files and includes are
# parsed later) and vm/boot can't see it anyway since they recover the config from the history instead of
# parsing it. An output dir set only in config files keeps the history in the config dir.
if output_dir is not None:
return output_dir / ".mkosi-private/history"

def finalize_historydir(args: Args) -> Path:
configdir = finalize_configdir(args.directory)
return (configdir or Path.cwd()) / ".mkosi-private/history"

Expand Down Expand Up @@ -5510,7 +5502,7 @@ def parse_config(
return args, None, ()

configdir = finalize_configdir(args.directory)
historydir = finalize_historydir(args, context.cli.get("output_dir"))
historydir = finalize_historydir(args)

if have_history(args, historydir):
history = Config.from_partial_json((historydir / "latest.json").read_text())
Expand Down
6 changes: 2 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ def boot(self, options: Sequence[str] = (), args: Sequence[str] = ()) -> Complet
"--register=no",
"--machine",
self.machine,
"--output-directory", self.output_dir,
*options,
],
args,
stdin=sys.stdin if sys.stdin.isatty() else None,
check=False,
) # fmt: skip
)

if result.returncode != 123:
raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr)
Expand All @@ -159,13 +158,12 @@ def vm(
"--register=no",
"--machine",
self.machine,
"--output-directory", self.output_dir,
*options,
],
args,
stdin=sys.stdin if sys.stdin.isatty() else None,
check=False,
) # fmt: skip
)

if result.returncode != 123:
raise subprocess.CalledProcessError(result.returncode, result.args, result.stdout, result.stderr)
Expand Down
Loading