]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Remove a few TODOs and FIXMEs
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 11:50:23 +0000 (12:50 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 13:03:36 +0000 (14:03 +0100)
mkosi/__init__.py
mkosi/distributions/__init__.py
mkosi/distributions/fedora.py
mkosi/manifest.py

index 3223f5e7ee7d401077d16cdbb385755ba92f479a..73db074b142e722f88722c619a44a92d05a79387 100644 (file)
@@ -164,9 +164,10 @@ def install_build_packages(context: Context) -> None:
     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)
 
 
@@ -385,7 +386,7 @@ def finalize_scripts(scripts: Mapping[str, Sequence[PathString]] = {}) -> Iterat
 
 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()):
@@ -393,7 +394,7 @@ def finalize_host_scripts(
     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]:
index b714afb84be8fb79adba3df9df70ecb595592801..4c289d5d058308b0fa536179e23992e739566f2b 100644 (file)
@@ -106,6 +106,9 @@ class Distribution(StrEnum):
     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)
 
index 45d9d11d20f46eb0988dbc88ed67336d9bd513af..c62298d7617bdf4b70ac998b14a8b339837493a1 100644 (file)
@@ -125,8 +125,7 @@ class Installer(DistributionInstaller):
                     ),
                 ]
 
-        # 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:
@@ -156,12 +155,3 @@ class Installer(DistributionInstaller):
             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)
index 2f491a2294c00955aebb8b85da75a557cd152ea7..214a9d5475876b1869bfa643d8bd79e055245e61 100644 (file)
@@ -96,7 +96,6 @@ class Manifest:
             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