]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Move various settings to the [Build] section
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 4 Oct 2024 12:04:54 +0000 (14:04 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 4 Oct 2024 12:11:06 +0000 (14:11 +0200)
These all make more sense to have in the [Build] section.

mkosi/config.py
mkosi/resources/man/mkosi.1.md

index a80e4d45b0a0f2995b4d2f68266a8d20a5e0e9e6..eb23415826b40d578d0349599d5740e8ed807293 100644 (file)
@@ -1577,12 +1577,6 @@ class Config:
     finalize_scripts: list[Path]
     postoutput_scripts: list[Path]
     clean_scripts: list[Path]
-    build_sources: list[ConfigTree]
-    build_sources_ephemeral: bool
-    environment: dict[str, str]
-    environment_files: list[Path]
-    with_tests: bool
-    with_network: bool
 
     bootable: ConfigFeature
     bootloader: Bootloader
@@ -1653,6 +1647,12 @@ class Config:
     use_subvolumes: ConfigFeature
     repart_offline: bool
     history: bool
+    build_sources: list[ConfigTree]
+    build_sources_ephemeral: bool
+    environment: dict[str, str]
+    environment_files: list[Path]
+    with_tests: bool
+    with_network: bool
 
     proxy_url: Optional[str]
     proxy_exclude: list[str]
@@ -2440,63 +2440,6 @@ SETTINGS = (
         recursive_paths=("mkosi.postoutput.d/",),
         help="Output postprocessing script to run outside image",
     ),
-    ConfigSetting(
-        dest="build_sources",
-        metavar="PATH",
-        section="Content",
-        parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False, required=True)),
-        match=config_match_build_sources,
-        default_factory=lambda ns: [ConfigTree(ns.directory, None)] if ns.directory else [],
-        help="Path for sources to build",
-        scope=SettingScope.universal,
-    ),
-    ConfigSetting(
-        dest="build_sources_ephemeral",
-        metavar="BOOL",
-        section="Content",
-        parse=config_parse_boolean,
-        help="Make build sources ephemeral when running scripts",
-        scope=SettingScope.universal,
-    ),
-    ConfigSetting(
-        dest="environment",
-        short="-E",
-        metavar="NAME[=VALUE]",
-        section="Content",
-        parse=config_make_dict_parser(delimiter=" ", parse=parse_environment, unescape=True),
-        match=config_match_key_value,
-        help="Set an environment variable when running scripts",
-    ),
-    ConfigSetting(
-        dest="environment_files",
-        long="--env-file",
-        metavar="PATH",
-        section="Content",
-        parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
-        paths=("mkosi.env",),
-        help="Environment files to set when running scripts",
-    ),
-    ConfigSetting(
-        dest="with_tests",
-        short="-T",
-        long="--without-tests",
-        nargs="?",
-        const="no",
-        section="Content",
-        parse=config_parse_boolean,
-        default=True,
-        help="Do not run tests as part of build scripts, if supported",
-        scope=SettingScope.universal,
-    ),
-    ConfigSetting(
-        dest="with_network",
-        metavar="BOOL",
-        nargs="?",
-        section="Content",
-        parse=config_parse_boolean,
-        help="Run build and postinst scripts with network access (instead of private network)",
-        scope=SettingScope.universal,
-    ),
     ConfigSetting(
         dest="bootable",
         metavar="FEATURE",
@@ -3043,6 +2986,63 @@ SETTINGS = (
         parse=config_parse_boolean,
         help="Whether mkosi can store information about previous builds",
     ),
+    ConfigSetting(
+        dest="build_sources",
+        metavar="PATH",
+        section="Build",
+        parse=config_make_list_parser(delimiter=",", parse=make_tree_parser(absolute=False, required=True)),
+        match=config_match_build_sources,
+        default_factory=lambda ns: [ConfigTree(ns.directory, None)] if ns.directory else [],
+        help="Path for sources to build",
+        scope=SettingScope.universal,
+    ),
+    ConfigSetting(
+        dest="build_sources_ephemeral",
+        metavar="BOOL",
+        section="Build",
+        parse=config_parse_boolean,
+        help="Make build sources ephemeral when running scripts",
+        scope=SettingScope.universal,
+    ),
+    ConfigSetting(
+        dest="environment",
+        short="-E",
+        metavar="NAME[=VALUE]",
+        section="Build",
+        parse=config_make_dict_parser(delimiter=" ", parse=parse_environment, unescape=True),
+        match=config_match_key_value,
+        help="Set an environment variable when running scripts",
+    ),
+    ConfigSetting(
+        dest="environment_files",
+        long="--env-file",
+        metavar="PATH",
+        section="Build",
+        parse=config_make_list_parser(delimiter=",", parse=make_path_parser()),
+        paths=("mkosi.env",),
+        help="Environment files to set when running scripts",
+    ),
+    ConfigSetting(
+        dest="with_tests",
+        short="-T",
+        long="--without-tests",
+        nargs="?",
+        const="no",
+        section="Build",
+        parse=config_parse_boolean,
+        default=True,
+        help="Do not run tests as part of build scripts, if supported",
+        scope=SettingScope.universal,
+    ),
+    ConfigSetting(
+        dest="with_network",
+        metavar="BOOL",
+        nargs="?",
+        section="Build",
+        parse=config_parse_boolean,
+        help="Run build and postinst scripts with network access (instead of private network)",
+        scope=SettingScope.universal,
+    ),
     # Host section
     ConfigSetting(
         dest="proxy_url",
@@ -4392,12 +4392,6 @@ def summary(config: Config) -> str:
                 Postinstall Scripts: {line_join_list(config.postinst_scripts)}
                    Finalize Scripts: {line_join_list(config.finalize_scripts)}
                  Postoutput Scripts: {line_join_list(config.postoutput_scripts)}
-                      Build Sources: {line_join_list(config.build_sources)}
-            Build Sources Ephemeral: {yes_no(config.build_sources_ephemeral)}
-                 Script Environment: {line_join_list(env)}
-                  Environment Files: {line_join_list(config.environment_files)}
-         Run Tests in Build Scripts: {yes_no(config.with_tests)}
-               Scripts With Network: {yes_no(config.with_network)}
 
                            Bootable: {config.bootable}
                          Bootloader: {config.bootloader}
@@ -4481,6 +4475,12 @@ def summary(config: Config) -> str:
                      Use Subvolumes: {config.use_subvolumes}
                      Repart Offline: {yes_no(config.repart_offline)}
                        Save History: {yes_no(config.history)}
+                      Build Sources: {line_join_list(config.build_sources)}
+            Build Sources Ephemeral: {yes_no(config.build_sources_ephemeral)}
+                 Script Environment: {line_join_list(env)}
+                  Environment Files: {line_join_list(config.environment_files)}
+         Run Tests in Build Scripts: {yes_no(config.with_tests)}
+               Scripts With Network: {yes_no(config.with_network)}
 
     {bold("HOST CONFIGURATION")}:
                           Proxy URL: {none_to_none(config.proxy_url)}
index 3252f317dd6c56f84b38f16af3796bf7dbbb9305..4f704d727c57209d197839298ac4b262e44b3729 100644 (file)
@@ -837,55 +837,6 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
     the post output scripts for this image. See the **Scripts** section for more
     information.
 
-`BuildSources=`, `--build-sources=`
-:   Takes a comma separated list of colon separated path pairs. The first
-    path of each pair refers to a directory to mount from the host. The
-    second path of each pair refers to the directory where the source
-    directory should be mounted when running scripts. Every target path is
-    prefixed with `/work/src` and all build sources are sorted
-    lexicographically by their target before mounting, so that top level
-    paths are mounted first. If not configured explicitly, the current
-    working directory is mounted to `/work/src`.
-
-`BuildSourcesEphemeral=`, `--build-sources-ephemeral=`
-:   Takes a boolean. Disabled by default. Configures whether changes to
-    source directories (The working directory and configured using
-    `BuildSources=`) are persisted. If enabled, all source directories
-    will be reset to their original state every time after running all
-    scripts of a specific type (except sync scripts).
-
-`Environment=`, `--environment=`
-:   Adds variables to the environment that package managers and the
-    prepare/build/postinstall/finalize scripts are executed with. Takes
-    a space-separated list of variable assignments or just variable
-    names. In the latter case, the values of those variables will be
-    passed through from the environment in which `mkosi` was invoked.
-    This option may be specified more than once, in which case all
-    listed variables will be set. If the same variable is set twice, the
-    later setting overrides the earlier one.
-
-`EnvironmentFiles=`, `--env-file=`
-:   Takes a comma-separated list of paths to files that contain environment
-    variable definitions to be added to the scripting environment. Uses
-    `mkosi.env` if it is found in the local directory. The variables are
-    first read from `mkosi.env` if it exists, then from the given list of
-    files and then from the `Environment=` settings.
-
-`WithTests=`, `--without-tests`, `-T`
-:   If set to false (or when the command-line option is used), the
-    `$WITH_TESTS` environment variable is set to `0` when the
-    `mkosi.build` scripts are invoked. This is supposed to be used by the
-    build scripts to bypass any unit or integration tests that are
-    normally run during the source build process. Note that this option
-    has no effect unless the `mkosi.build` build scripts honor it.
-
-`WithNetwork=`, `--with-network=`
-:   When true, enables network connectivity while the build scripts
-    `mkosi.build` are invoked. By default, the build scripts run with
-    networking turned off. The `$WITH_NETWORK` environment variable is
-    passed to the `mkosi.build` build scripts indicating whether the
-    build is done with or without network.
-
 `Bootable=`, `--bootable=`
 :   Takes a boolean or `auto`. Enables or disables generation of a
     bootable image. If enabled, mkosi will install an EFI bootloader, and
@@ -1450,6 +1401,55 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
     `mkosi qemu`, it will boot the image built in the previous step as
     expected.
 
+`BuildSources=`, `--build-sources=`
+:   Takes a comma separated list of colon separated path pairs. The first
+    path of each pair refers to a directory to mount from the host. The
+    second path of each pair refers to the directory where the source
+    directory should be mounted when running scripts. Every target path is
+    prefixed with `/work/src` and all build sources are sorted
+    lexicographically by their target before mounting, so that top level
+    paths are mounted first. If not configured explicitly, the current
+    working directory is mounted to `/work/src`.
+
+`BuildSourcesEphemeral=`, `--build-sources-ephemeral=`
+:   Takes a boolean. Disabled by default. Configures whether changes to
+    source directories (The working directory and configured using
+    `BuildSources=`) are persisted. If enabled, all source directories
+    will be reset to their original state every time after running all
+    scripts of a specific type (except sync scripts).
+
+`Environment=`, `--environment=`
+:   Adds variables to the environment that package managers and the
+    prepare/build/postinstall/finalize scripts are executed with. Takes
+    a space-separated list of variable assignments or just variable
+    names. In the latter case, the values of those variables will be
+    passed through from the environment in which `mkosi` was invoked.
+    This option may be specified more than once, in which case all
+    listed variables will be set. If the same variable is set twice, the
+    later setting overrides the earlier one.
+
+`EnvironmentFiles=`, `--env-file=`
+:   Takes a comma-separated list of paths to files that contain environment
+    variable definitions to be added to the scripting environment. Uses
+    `mkosi.env` if it is found in the local directory. The variables are
+    first read from `mkosi.env` if it exists, then from the given list of
+    files and then from the `Environment=` settings.
+
+`WithTests=`, `--without-tests`, `-T`
+:   If set to false (or when the command-line option is used), the
+    `$WITH_TESTS` environment variable is set to `0` when the
+    `mkosi.build` scripts are invoked. This is supposed to be used by the
+    build scripts to bypass any unit or integration tests that are
+    normally run during the source build process. Note that this option
+    has no effect unless the `mkosi.build` build scripts honor it.
+
+`WithNetwork=`, `--with-network=`
+:   When true, enables network connectivity while the build scripts
+    `mkosi.build` are invoked. By default, the build scripts run with
+    networking turned off. The `$WITH_NETWORK` environment variable is
+    passed to the `mkosi.build` build scripts indicating whether the
+    build is done with or without network.
+
 ### [Host] Section
 
 `ProxyUrl=`, `--proxy-url=`