We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[Meta] declare a policy about adding new distributions
Before people start creating issues asking to support their favorite distribution, I think that mkosi should declare its policy regarding new distributions support.

The policy should state in which terms (if any) you will be willing to support a new distributions.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mkosi/distributions/__init__.py`
Content:
```
1 # SPDX-License-Identifier: LGPL-2.1+
2 
3 import enum
4 import importlib
5 import re
6 from collections.abc import Sequence
7 from typing import TYPE_CHECKING, Optional, cast
8 
9 from mkosi.architecture import Architecture
10 from mkosi.util import StrEnum, read_os_release
11 
12 if TYPE_CHECKING:
13     from mkosi.state import MkosiState
14 
15 
16 class PackageType(StrEnum):
17     none   = enum.auto()
18     rpm    = enum.auto()
19     deb    = enum.auto()
20     pkg    = enum.auto()
21     ebuild = enum.auto()
22 
23 
24 class DistributionInstaller:
25     @classmethod
26     def pretty_name(cls) -> str:
27         raise NotImplementedError
28 
29     @classmethod
30     def setup(cls, state: "MkosiState") -> None:
31         raise NotImplementedError
32 
33     @classmethod
34     def install(cls, state: "MkosiState") -> None:
35         raise NotImplementedError
36 
37     @classmethod
38     def install_packages(cls, state: "MkosiState", packages: Sequence[str]) -> None:
39         raise NotImplementedError
40 
41     @classmethod
42     def remove_packages(cls, state: "MkosiState", packages: Sequence[str]) -> None:
43         raise NotImplementedError
44 
45     @classmethod
46     def filesystem(cls) -> str:
47         return "ext4"
48 
49     @staticmethod
50     def architecture(arch: Architecture) -> str:
51         return str(arch)
52 
53     @classmethod
54     def package_type(cls) -> PackageType:
55         return PackageType.none
56 
57     @classmethod
58     def default_release(cls) -> str:
59         return ""
60 
61     @classmethod
62     def default_tools_tree_distribution(cls) -> Optional["Distribution"]:
63         return None
64 
65     @classmethod
66     def tools_tree_repositories(cls) -> list[str]:
67         return []
68 
69     @classmethod
70     def tools_tree_packages(cls) -> list[str]:
71         return []
72 
73 
74 class Distribution(StrEnum):
75     fedora       = enum.auto()
76     debian       = enum.auto()
77     ubuntu       = enum.auto()
78     arch         = enum.auto()
79     opensuse     = enum.auto()
80     mageia       = enum.auto()
81     centos       = enum.auto()
82     rhel_ubi     = enum.auto()
83     openmandriva = enum.auto()
84     rocky        = enum.auto()
85     alma         = enum.auto()
86     gentoo       = enum.auto()
87     custom       = enum.auto()
88 
89     def is_centos_variant(self) -> bool:
90         return self in (Distribution.centos, Distribution.alma, Distribution.rocky)
91 
92     def is_dnf_distribution(self) -> bool:
93         return self in (
94             Distribution.fedora,
95             Distribution.mageia,
96             Distribution.centos,
97             Distribution.rhel_ubi,
98             Distribution.openmandriva,
99             Distribution.rocky,
100             Distribution.alma,
101         )
102 
103     def is_apt_distribution(self) -> bool:
104         return self in (Distribution.debian, Distribution.ubuntu)
105 
106     def setup(self, state: "MkosiState") -> None:
107         return self.installer().setup(state)
108 
109     def install(self, state: "MkosiState") -> None:
110         return self.installer().install(state)
111 
112     def install_packages(self, state: "MkosiState", packages: Sequence[str]) -> None:
113         return self.installer().install_packages(state, packages)
114 
115     def remove_packages(self, state: "MkosiState", packages: Sequence[str]) -> None:
116         return self.installer().remove_packages(state, packages)
117 
118     def filesystem(self) -> str:
119         return self.installer().filesystem()
120 
121     def architecture(self, arch: Architecture) -> str:
122         return self.installer().architecture(arch)
123 
124     def package_type(self) -> PackageType:
125         return self.installer().package_type()
126 
127     def default_release(self) -> str:
128         return self.installer().default_release()
129 
130     def default_tools_tree_distribution(self) -> Optional["Distribution"]:
131         return self.installer().default_tools_tree_distribution()
132 
133     def tools_tree_repositories(self) -> list[str]:
134         return self.installer().tools_tree_repositories()
135 
136     def tools_tree_packages(self) -> list[str]:
137         return self.installer().tools_tree_packages()
138 
139     def installer(self) -> type[DistributionInstaller]:
140         modname = str(self).replace('-', '_')
141         mod = importlib.import_module(f"mkosi.distributions.{modname}")
142         installer = getattr(mod, "Installer")
143         assert issubclass(installer, DistributionInstaller)
144         return cast(type[DistributionInstaller], installer)
145 
146 
147 def detect_distribution() -> tuple[Optional[Distribution], Optional[str]]:
148     try:
149         os_release = read_os_release()
150     except FileNotFoundError:
151         return None, None
152 
153     dist_id = os_release.get("ID", "linux")
154     dist_id_like = os_release.get("ID_LIKE", "").split()
155     version = os_release.get("VERSION", None)
156     version_id = os_release.get("VERSION_ID", None)
157     version_codename = os_release.get("VERSION_CODENAME", None)
158     extracted_codename = None
159 
160     if version:
161         # extract Debian release codename
162         m = re.search(r"\((.*?)\)", version)
163         if m:
164             extracted_codename = m.group(1)
165 
166     d: Optional[Distribution] = None
167     for the_id in [dist_id, *dist_id_like]:
168         d = Distribution.__members__.get(the_id, None)
169         if d is not None:
170             break
171 
172     if d in {Distribution.debian, Distribution.ubuntu} and (version_codename or extracted_codename):
173         version_id = version_codename or extracted_codename
174 
175     return d, version_id
176
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mkosi/distributions/__init__.py b/mkosi/distributions/__init__.py
--- a/mkosi/distributions/__init__.py
+++ b/mkosi/distributions/__init__.py
@@ -72,6 +72,8 @@
 
 
 class Distribution(StrEnum):
+    # Please consult docs/distribution-policy.md and contact one
+    # of the mkosi maintainers before implementing a new distribution.
     fedora       = enum.auto()
     debian       = enum.auto()
     ubuntu       = enum.auto()

{"golden_diff": "diff --git a/mkosi/distributions/__init__.py b/mkosi/distributions/__init__.py\n--- a/mkosi/distributions/__init__.py\n+++ b/mkosi/distributions/__init__.py\n@@ -72,6 +72,8 @@\n \n \n class Distribution(StrEnum):\n+    # Please consult docs/distribution-policy.md and contact one\n+    # of the mkosi maintainers before implementing a new distribution.\n     fedora       = enum.auto()\n     debian       = enum.auto()\n     ubuntu       = enum.auto()\n", "issue": "[Meta] declare a policy about adding new distributions\nBefore people start creating issues asking to support their favorite distribution, I think that mkosi should declare its policy regarding new distributions support.\r\n\r\nThe policy should state in which terms (if any) you will be willing to support a new distributions.\n", "before_files": [{"content": "# SPDX-License-Identifier: LGPL-2.1+\n\nimport enum\nimport importlib\nimport re\nfrom collections.abc import Sequence\nfrom typing import TYPE_CHECKING, Optional, cast\n\nfrom mkosi.architecture import Architecture\nfrom mkosi.util import StrEnum, read_os_release\n\nif TYPE_CHECKING:\n    from mkosi.state import MkosiState\n\n\nclass PackageType(StrEnum):\n    none   = enum.auto()\n    rpm    = enum.auto()\n    deb    = enum.auto()\n    pkg    = enum.auto()\n    ebuild = enum.auto()\n\n\nclass DistributionInstaller:\n    @classmethod\n    def pretty_name(cls) -> str:\n        raise NotImplementedError\n\n    @classmethod\n    def setup(cls, state: \"MkosiState\") -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def install(cls, state: \"MkosiState\") -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def install_packages(cls, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def remove_packages(cls, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def filesystem(cls) -> str:\n        return \"ext4\"\n\n    @staticmethod\n    def architecture(arch: Architecture) -> str:\n        return str(arch)\n\n    @classmethod\n    def package_type(cls) -> PackageType:\n        return PackageType.none\n\n    @classmethod\n    def default_release(cls) -> str:\n        return \"\"\n\n    @classmethod\n    def default_tools_tree_distribution(cls) -> Optional[\"Distribution\"]:\n        return None\n\n    @classmethod\n    def tools_tree_repositories(cls) -> list[str]:\n        return []\n\n    @classmethod\n    def tools_tree_packages(cls) -> list[str]:\n        return []\n\n\nclass Distribution(StrEnum):\n    fedora       = enum.auto()\n    debian       = enum.auto()\n    ubuntu       = enum.auto()\n    arch         = enum.auto()\n    opensuse     = enum.auto()\n    mageia       = enum.auto()\n    centos       = enum.auto()\n    rhel_ubi     = enum.auto()\n    openmandriva = enum.auto()\n    rocky        = enum.auto()\n    alma         = enum.auto()\n    gentoo       = enum.auto()\n    custom       = enum.auto()\n\n    def is_centos_variant(self) -> bool:\n        return self in (Distribution.centos, Distribution.alma, Distribution.rocky)\n\n    def is_dnf_distribution(self) -> bool:\n        return self in (\n            Distribution.fedora,\n            Distribution.mageia,\n            Distribution.centos,\n            Distribution.rhel_ubi,\n            Distribution.openmandriva,\n            Distribution.rocky,\n            Distribution.alma,\n        )\n\n    def is_apt_distribution(self) -> bool:\n        return self in (Distribution.debian, Distribution.ubuntu)\n\n    def setup(self, state: \"MkosiState\") -> None:\n        return self.installer().setup(state)\n\n    def install(self, state: \"MkosiState\") -> None:\n        return self.installer().install(state)\n\n    def install_packages(self, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        return self.installer().install_packages(state, packages)\n\n    def remove_packages(self, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        return self.installer().remove_packages(state, packages)\n\n    def filesystem(self) -> str:\n        return self.installer().filesystem()\n\n    def architecture(self, arch: Architecture) -> str:\n        return self.installer().architecture(arch)\n\n    def package_type(self) -> PackageType:\n        return self.installer().package_type()\n\n    def default_release(self) -> str:\n        return self.installer().default_release()\n\n    def default_tools_tree_distribution(self) -> Optional[\"Distribution\"]:\n        return self.installer().default_tools_tree_distribution()\n\n    def tools_tree_repositories(self) -> list[str]:\n        return self.installer().tools_tree_repositories()\n\n    def tools_tree_packages(self) -> list[str]:\n        return self.installer().tools_tree_packages()\n\n    def installer(self) -> type[DistributionInstaller]:\n        modname = str(self).replace('-', '_')\n        mod = importlib.import_module(f\"mkosi.distributions.{modname}\")\n        installer = getattr(mod, \"Installer\")\n        assert issubclass(installer, DistributionInstaller)\n        return cast(type[DistributionInstaller], installer)\n\n\ndef detect_distribution() -> tuple[Optional[Distribution], Optional[str]]:\n    try:\n        os_release = read_os_release()\n    except FileNotFoundError:\n        return None, None\n\n    dist_id = os_release.get(\"ID\", \"linux\")\n    dist_id_like = os_release.get(\"ID_LIKE\", \"\").split()\n    version = os_release.get(\"VERSION\", None)\n    version_id = os_release.get(\"VERSION_ID\", None)\n    version_codename = os_release.get(\"VERSION_CODENAME\", None)\n    extracted_codename = None\n\n    if version:\n        # extract Debian release codename\n        m = re.search(r\"\\((.*?)\\)\", version)\n        if m:\n            extracted_codename = m.group(1)\n\n    d: Optional[Distribution] = None\n    for the_id in [dist_id, *dist_id_like]:\n        d = Distribution.__members__.get(the_id, None)\n        if d is not None:\n            break\n\n    if d in {Distribution.debian, Distribution.ubuntu} and (version_codename or extracted_codename):\n        version_id = version_codename or extracted_codename\n\n    return d, version_id\n", "path": "mkosi/distributions/__init__.py"}], "after_files": [{"content": "# SPDX-License-Identifier: LGPL-2.1+\n\nimport enum\nimport importlib\nimport re\nfrom collections.abc import Sequence\nfrom typing import TYPE_CHECKING, Optional, cast\n\nfrom mkosi.architecture import Architecture\nfrom mkosi.util import StrEnum, read_os_release\n\nif TYPE_CHECKING:\n    from mkosi.state import MkosiState\n\n\nclass PackageType(StrEnum):\n    none   = enum.auto()\n    rpm    = enum.auto()\n    deb    = enum.auto()\n    pkg    = enum.auto()\n    ebuild = enum.auto()\n\n\nclass DistributionInstaller:\n    @classmethod\n    def pretty_name(cls) -> str:\n        raise NotImplementedError\n\n    @classmethod\n    def setup(cls, state: \"MkosiState\") -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def install(cls, state: \"MkosiState\") -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def install_packages(cls, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def remove_packages(cls, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        raise NotImplementedError\n\n    @classmethod\n    def filesystem(cls) -> str:\n        return \"ext4\"\n\n    @staticmethod\n    def architecture(arch: Architecture) -> str:\n        return str(arch)\n\n    @classmethod\n    def package_type(cls) -> PackageType:\n        return PackageType.none\n\n    @classmethod\n    def default_release(cls) -> str:\n        return \"\"\n\n    @classmethod\n    def default_tools_tree_distribution(cls) -> Optional[\"Distribution\"]:\n        return None\n\n    @classmethod\n    def tools_tree_repositories(cls) -> list[str]:\n        return []\n\n    @classmethod\n    def tools_tree_packages(cls) -> list[str]:\n        return []\n\n\nclass Distribution(StrEnum):\n    # Please consult docs/distribution-policy.md and contact one\n    # of the mkosi maintainers before implementing a new distribution.\n    fedora       = enum.auto()\n    debian       = enum.auto()\n    ubuntu       = enum.auto()\n    arch         = enum.auto()\n    opensuse     = enum.auto()\n    mageia       = enum.auto()\n    centos       = enum.auto()\n    rhel_ubi     = enum.auto()\n    openmandriva = enum.auto()\n    rocky        = enum.auto()\n    alma         = enum.auto()\n    gentoo       = enum.auto()\n    custom       = enum.auto()\n\n    def is_centos_variant(self) -> bool:\n        return self in (Distribution.centos, Distribution.alma, Distribution.rocky)\n\n    def is_dnf_distribution(self) -> bool:\n        return self in (\n            Distribution.fedora,\n            Distribution.mageia,\n            Distribution.centos,\n            Distribution.rhel_ubi,\n            Distribution.openmandriva,\n            Distribution.rocky,\n            Distribution.alma,\n        )\n\n    def is_apt_distribution(self) -> bool:\n        return self in (Distribution.debian, Distribution.ubuntu)\n\n    def setup(self, state: \"MkosiState\") -> None:\n        return self.installer().setup(state)\n\n    def install(self, state: \"MkosiState\") -> None:\n        return self.installer().install(state)\n\n    def install_packages(self, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        return self.installer().install_packages(state, packages)\n\n    def remove_packages(self, state: \"MkosiState\", packages: Sequence[str]) -> None:\n        return self.installer().remove_packages(state, packages)\n\n    def filesystem(self) -> str:\n        return self.installer().filesystem()\n\n    def architecture(self, arch: Architecture) -> str:\n        return self.installer().architecture(arch)\n\n    def package_type(self) -> PackageType:\n        return self.installer().package_type()\n\n    def default_release(self) -> str:\n        return self.installer().default_release()\n\n    def default_tools_tree_distribution(self) -> Optional[\"Distribution\"]:\n        return self.installer().default_tools_tree_distribution()\n\n    def tools_tree_repositories(self) -> list[str]:\n        return self.installer().tools_tree_repositories()\n\n    def tools_tree_packages(self) -> list[str]:\n        return self.installer().tools_tree_packages()\n\n    def installer(self) -> type[DistributionInstaller]:\n        modname = str(self).replace('-', '_')\n        mod = importlib.import_module(f\"mkosi.distributions.{modname}\")\n        installer = getattr(mod, \"Installer\")\n        assert issubclass(installer, DistributionInstaller)\n        return cast(type[DistributionInstaller], installer)\n\n\ndef detect_distribution() -> tuple[Optional[Distribution], Optional[str]]:\n    try:\n        os_release = read_os_release()\n    except FileNotFoundError:\n        return None, None\n\n    dist_id = os_release.get(\"ID\", \"linux\")\n    dist_id_like = os_release.get(\"ID_LIKE\", \"\").split()\n    version = os_release.get(\"VERSION\", None)\n    version_id = os_release.get(\"VERSION_ID\", None)\n    version_codename = os_release.get(\"VERSION_CODENAME\", None)\n    extracted_codename = None\n\n    if version:\n        # extract Debian release codename\n        m = re.search(r\"\\((.*?)\\)\", version)\n        if m:\n            extracted_codename = m.group(1)\n\n    d: Optional[Distribution] = None\n    for the_id in [dist_id, *dist_id_like]:\n        d = Distribution.__members__.get(the_id, None)\n        if d is not None:\n            break\n\n    if d in {Distribution.debian, Distribution.ubuntu} and (version_codename or extracted_codename):\n        version_id = version_codename or extracted_codename\n\n    return d, version_id\n", "path": "mkosi/distributions/__init__.py"}]}