]> git.ipfire.org Git - thirdparty/mkosi.git/commit
Only write CLI arguments to history instead of full config
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 13 Apr 2025 20:42:55 +0000 (22:42 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 16 Apr 2025 09:55:55 +0000 (11:55 +0200)
commitcc45fe3bad2ef7f40b226e858a233b3f2ea024e4
tree344ba8354a200d0e304caec975ee5f8e4a8fcb80
parent1def443097df8b0dcde702547e10b172ff6f3624
Only write CLI arguments to history instead of full config

The huge downside of writing the full config to the history is that
any modifications to config files are ignored until the image is
rebuilt.

If we make the argument that changes to config files are usually
supposed to be permanent rather than ephemeral, it doesn't make sense
to not take them into account when reusing the history. Especially since
the primary purpose of the history is to avoid specifying the same CLI
arguments over and over again without encoding those CLI arguments into
a config file.

So instead of saving the full config to the history and not reparsing
the configuration when reusing the history, let's only save the CLI
arguments to the history and always reparse the configuration, even when
we end up reusing the history.

This keeps the crucial benefit of the history intact (not having to repeat
yourself endlessly) while still making sure any new settings added to the
configuration files are taken into account immediately.

It also simplifies the implementation quite a bit, as we can get away
again with maintaining a single history file instead of two.

Additionally, we opt to completely ignore the history when using the sandbox
verb. The idea here is that the history only applies to the final image (and
subimages). This was already the case as any --tools-tree-xxx CLI options aren't
saved in the history as they are not fields of the Config object.
mkosi/__init__.py
mkosi/config.py
mkosi/resources/man/mkosi.1.md