if last.history:
Path(".mkosi-private/history").mkdir(parents=True, exist_ok=True)
- Path(".mkosi-private/history/latest.json").write_text(last.to_json())
+ Path(".mkosi-private/history/latest.json").write_text(
+ json.dumps(
+ {"Images": [config.to_dict() for config in images]},
+ cls=JsonEncoder,
+ indent=4,
+ sort_keys=True,
+ )
+ )
if args.verb == Verb.build:
return
if have_history(args):
try:
- prev = Config.from_json(Path(".mkosi-private/history/latest.json").read_text())
- except ValueError:
+ *subimages, prev = [
+ Config.from_json(j)
+ for j in json.loads(Path(".mkosi-private/history/latest.json").read_text())["Images"]
+ ]
+ except (KeyError, ValueError):
die(
"Unable to parse history from .mkosi-private/history/latest.json",
hint="Build with -f to generate a new history file from scratch",
context.only_sections = ("Include", "Runtime", "Host")
else:
context.only_sections = tuple(only_sections)
+ subimages = []
prev = None
context.parse_new_includes()
setattr(config, s.dest, context.finalize_value(s))
if prev:
- return args, (Config.from_namespace(config),)
+ return args, (*subimages, Config.from_namespace(config))
images = []