if not context.config.build_scripts or not context.config.build_packages:
return
- # TODO: move to parenthesised context managers once on 3.10
- pd = str(context.config.distribution).capitalize()
- with complete_step(f"Installing build packages for {pd}"), mount_build_overlay(context):
+ with (
+ complete_step(f"Installing build packages for {context.config.distribution.pretty_name()}"),
+ mount_build_overlay(context),
+ ):
context.config.distribution.install_packages(context, context.config.build_packages)
def finalize_host_scripts(
context: Context,
- helpers: dict[str, Sequence[PathString]], # FIXME: change dict to Mapping when PyRight is fixed
+ helpers: Mapping[str, Sequence[PathString]],
) -> contextlib.AbstractContextManager[Path]:
scripts: dict[str, Sequence[PathString]] = {}
if find_binary("git", root=context.config.tools()):
for binary in ("useradd", "groupadd"):
if find_binary(binary, root=context.config.tools()):
scripts[binary] = (binary, "--root", context.root)
- return finalize_scripts(scripts | helpers | package_manager_scripts(context))
+ return finalize_scripts(scripts | dict(helpers) | package_manager_scripts(context))
def finalize_chroot_scripts(context: Context) -> contextlib.AbstractContextManager[Path]:
def is_apt_distribution(self) -> bool:
return self in (Distribution.debian, Distribution.ubuntu)
+ def pretty_name(self) -> str:
+ return self.installer().pretty_name()
+
def setup(self, context: "Context") -> None:
return self.installer().setup(context)
),
]
- # TODO: Use `filelists=True` when F37 goes EOL.
- setup_dnf(context, repos, filelists=fedora_release_at_most(context.config.release, "37"))
+ setup_dnf(context, repos, filelists=True)
@classmethod
def install(cls, context: Context) -> None:
die(f"Architecture {a} is not supported by Fedora")
return a
-
-
-def fedora_release_at_most(release: str, threshold: str) -> bool:
- if release in ("rawhide", "eln"):
- return False
- if threshold in ("rawhide", "eln"):
- return True
- # If neither is 'rawhide', both must be integers
- return int(release) <= int(threshold)
self.record_deb_packages(root)
if self.config.distribution.package_type() == PackageType.pkg:
self.record_pkg_packages(root)
- # TODO: add implementations for other package managers
def record_rpm_packages(self, root: Path) -> None:
# On Debian, rpm/dnf ship with a patch to store the rpmdb under ~/ so rpm