]> git.ipfire.org Git - thirdparty/mkosi.git/commit
Apply path expansion when parsing 1472/head
authorGeorges Discry <georges@discry.be>
Thu, 20 Apr 2023 20:09:58 +0000 (22:09 +0200)
committerGeorges Discry <georges@discry.be>
Fri, 21 Apr 2023 12:31:36 +0000 (14:31 +0200)
commit93e94b63436cfc3b2ff02a8ef56f9dd11f3a1804
tree0e800aee7dae6e36fae785a55d604333cfe90521
parentf9d37e3dc83fc121dbc20467ead50d2402800818
Apply path expansion when parsing

When the `extra_search_paths` configuration was introduced, it would
perform path expansions with the environment variables (using $) and the
home directories (starting with ~). Home directories would not be
expanded when mkosi was run with sudo or pkexec. Instead, `$SUDO_HOME`
could be used but only when run with sudo or pkexec.

However, those expansions were not applied to other paths in the
configuration and were broken with the rewrite of the configuration
loading, as the parser would check if the paths exist before expanding.

Those expansions are now handled directly in the parser and are
performed before validation. Environment variables expansion is enabled
for all paths and home directory expansion is enabled for all paths on
the host.

Furthermore, home directory expansion is always available, with `~`
expanding to the user's home directory when sudo or pkexec are used (and
not `/root`), replacing the need for `$SUDO_HOME`.
mkosi/__init__.py
mkosi/config.py