packages: list[str]
build_packages: list[str]
+ with_recommends: bool
with_docs: bool
base_trees: list[Path]
parse=config_make_list_parser(delimiter=","),
help="Additional packages needed for build scripts",
),
+ MkosiConfigSetting(
+ dest="with_recommends",
+ metavar="BOOL",
+ nargs="?",
+ section="Content",
+ parse=config_parse_boolean,
+ help="Install recommended packages",
+ ),
MkosiConfigSetting(
dest="with_docs",
metavar="BOOL",
# Anything that users can override with dropins is written into the config file.
config.write_text(
textwrap.dedent(
- """\
- APT::Install-Recommends "false";
+ f"""\
+ APT::Install-Recommends "{str(state.config.with_recommends).lower()}";
"""
)
)
with config.open("w") as f:
f.write(
textwrap.dedent(
- """\
+ f"""\
[main]
- install_weak_deps=0
+ install_weak_deps={int(state.config.with_recommends)}
"""
)
)
import textwrap
from collections.abc import Sequence
+from mkosi.config import yes_no
from mkosi.installer.dnf import Repo, fixup_rpmdb_location
from mkosi.run import apivfs_cmd, bwrap
from mkosi.state import MkosiState
textwrap.dedent(
f"""\
[main]
- rpm.install.excludedocs = {"no" if state.config.with_docs else "yes"}
- solver.onlyRequires = yes
+ rpm.install.excludedocs = {yes_no(not state.config.with_docs)}
+ solver.onlyRequires = {yes_no(not state.config.with_recommends)}
"""
)
)
`mkosi.build` scripts require to operate. Note that packages listed
here will be absent in the final image.
+`WithRecommends=`, `--with-recommends=`
+
+: Configures whether to install recommended or weak dependencies,
+ depending on how they are named by the used package manager, or not.
+ By default, recommended packages are not installed. This is only used
+ for package managers that support the concept, which are currently
+ apt, dnf and zypper.
+
`WithDocs=`, `--with-docs`
: Include documentation in the image built. By default if the
"VerityKey": null,
"WithDocs": true,
"WithNetwork": false,
+ "WithRecommends": true,
"WithTests": true,
"WorkspaceDirectory": "/cwd"
}
verity_key = None,
with_docs = True,
with_network = False,
+ with_recommends = True,
with_tests = True,
workspace_dir = Path("/cwd"),
)