diff options
author | zsdc <taras@vyos.io> | 2024-05-15 16:48:35 +0300 |
---|---|---|
committer | zsdc <taras@vyos.io> | 2024-05-15 16:48:35 +0300 |
commit | 8186e82024cdeee9c6fd09bdd0603f4571842f42 (patch) | |
tree | 70323b1a05718007f51ca989791255b922b8d3a4 /scripts/image-build/defaults.py | |
parent | eff3d4aab60d5db66cf7dbb5876d66f9e3e3e715 (diff) | |
download | vyos-build-8186e82024cdeee9c6fd09bdd0603f4571842f42.tar.gz vyos-build-8186e82024cdeee9c6fd09bdd0603f4571842f42.zip |
build-script: T3664: Allowed all options in both config file and command args
Moved defaults away from argparser to `defaults.py`. This unlocks the ability to
pass values that can be defined as command line arguments via a config file.
With this change logic looks like this (in order of overrides).
Pre-build config:
`data/defaults.toml` -> `build-flavors/<flavor>.toml` ->
`--<command line argument>`
Build config:
`defaults.py` -> `data/defaults.toml` -> `build-types/<type>.toml` ->
`architectures/<architecture>.toml` -> `build-flavors/<flavor>.toml` ->
`--<command line argument>`
Diffstat (limited to 'scripts/image-build/defaults.py')
-rw-r--r-- | scripts/image-build/defaults.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/image-build/defaults.py b/scripts/image-build/defaults.py index 9fd5eeed..a0c5c8bf 100644 --- a/scripts/image-build/defaults.py +++ b/scripts/image-build/defaults.py @@ -17,6 +17,11 @@ import os +import getpass +import platform + +def get_default_build_by(): + return "{user}@{host}".format(user= getpass.getuser(), host=platform.node()) # Default boot settings boot_settings: dict[str, str] = { @@ -27,6 +32,17 @@ boot_settings: dict[str, str] = { 'bootmode': 'normal' } +# Hardcoded default values +HARDCODED_BUILD = { + 'custom_apt_entry': [], + 'custom_apt_key': [], + 'custom_package': [], + 'reuse_iso': None, + 'disk_size': 10, + 'build_by': get_default_build_by(), + 'build_comment': '', +} + # Relative to the repository directory BUILD_DIR = 'build' |