]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Rename "none" distribution to "custom"
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 4 Oct 2023 08:41:41 +0000 (10:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 4 Oct 2023 08:55:54 +0000 (10:55 +0200)
"custom" seems a better fit than "none" since there likely still
is a distribution, we just don't support it.

mkosi/__init__.py
mkosi/config.py
mkosi/distributions/__init__.py
mkosi/distributions/custom.py [moved from mkosi/distributions/none.py with 79% similarity]
mkosi/resources/mkosi.md

index 9beab92b21e69de1d71fa5a1eddfabd6d6608cec..5ae38f1fa187c5be63b33016a2f3c31f22392133 100644 (file)
@@ -986,8 +986,8 @@ def build_initrd(state: MkosiState) -> Path:
     if symlink.exists():
         return symlink.resolve()
 
-    if state.config.distribution == Distribution.none:
-        die(f"Building a default initrd is not supported with distribution {state.config.distribution}")
+    if state.config.distribution == Distribution.custom:
+        die("Building a default initrd is not supported for custom distributions")
 
     # Default values are assigned via the parser so we go via the argument parser to construct
     # the config for the initrd.
index 9645ee71e35293bbd18c94930744f935782cef46..6150a0db1083b6a4cdd041518e522db497cc09b5 100644 (file)
@@ -298,9 +298,9 @@ def config_default_distribution(namespace: argparse.Namespace) -> Distribution:
     if not detected:
         logging.info(
             "Distribution of your host can't be detected or isn't a supported target. "
-            "Defaulting to Distribution=none."
+            "Defaulting to Distribution=custom."
         )
-        return Distribution.none
+        return Distribution.custom
 
     return detected
 
index b33334d4f8062e811a16dc6edb127e14375fde1e..8169983ae165d3ca1c2593b9bff41f7067085f72 100644 (file)
@@ -72,7 +72,6 @@ class DistributionInstaller:
 
 
 class Distribution(StrEnum):
-    none         = enum.auto()
     fedora       = enum.auto()
     debian       = enum.auto()
     ubuntu       = enum.auto()
@@ -85,6 +84,7 @@ class Distribution(StrEnum):
     rocky        = enum.auto()
     alma         = enum.auto()
     gentoo       = enum.auto()
+    custom       = enum.auto()
 
     def is_centos_variant(self) -> bool:
         return self in (Distribution.centos, Distribution.alma, Distribution.rocky)
similarity index 79%
rename from mkosi/distributions/none.py
rename to mkosi/distributions/custom.py
index fced69ab37c331d15dbc933c52a039cb77491ee9..37bbe3a90323790cbdf05de4e043b25e32ce8b99 100644 (file)
@@ -19,9 +19,9 @@ class Installer(DistributionInstaller):
     @classmethod
     def install_packages(cls, state: MkosiState, packages: Sequence[str]) -> None:
         if packages:
-            die("Installing packages is not supported with distribution 'none'")
+            die("Installing packages is not supported for custom distributions'")
 
     @classmethod
     def remove_packages(cls, state: MkosiState, packages: Sequence[str]) -> None:
         if packages:
-            die("Removing packages is not supported with distribution 'none'")
+            die("Removing packages is not supported for custom distributions")
index e842399a00169e5fd18e0027ac7e63561bea9211..22f0f9ac6af708495868501eb858d4b6ee86a518 100644 (file)
@@ -395,8 +395,9 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
 
 : The distribution to install in the image. Takes one of the following
   arguments: `fedora`, `debian`, `ubuntu`, `arch`, `opensuse`, `mageia`,
-  `centos`, `rhel-ubi`, `openmandriva`, `rocky`, `alma`, `none`.
-  If not specified, defaults to the distribution of the host.
+  `centos`, `rhel-ubi`, `openmandriva`, `rocky`, `alma`, `custom`.
+  If not specified, defaults to the distribution of the host or `custom`
+  if the distribution of the host is not a supported distribution.
 
 `Release=`, `--release=`, `-r`
 
@@ -1294,7 +1295,10 @@ any distribution that packages `apt` may be used to build *Debian* or *Ubuntu* i
 Any distribution that packages `dnf` may be used to build images for any of the rpm-based distributions.
 Any distro that packages `pacman` may be used to build *Arch Linux* images.
 Any distribution that packages `zypper` may be used to build *openSUSE* images.
-Other distributions and build automation tools for embedded Linux systems such as Buildroot, OpenEmbedded and Yocto Project may be used by selecting the `none` distribution, and populating the rootfs via a combination of base trees, skeleton trees, and prepare scripts.
+Other distributions and build automation tools for embedded Linux
+systems such as Buildroot, OpenEmbedded and Yocto Project may be used by
+selecting the `custom` distribution, and populating the rootfs via a
+combination of base trees, skeleton trees, and prepare scripts.
 
 Currently, *Fedora Linux* packages all relevant tools as of Fedora 28.