]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
distributions: drop Debian workaround for lack of VERSION_CODENAME 2946/head
authorLuca Boccassi <bluca@debian.org>
Wed, 7 Aug 2024 22:39:06 +0000 (23:39 +0100)
committerLuca Boccassi <bluca@debian.org>
Thu, 8 Aug 2024 12:00:21 +0000 (13:00 +0100)
It has been present since Debian 9, so we can rely on it now.
It is wrong on sid, but that's a separate issue that this old
workaround doesn't solve anyway.

mkosi/distributions/__init__.py

index c2d24f57dc27e416967037590420736df0029efb..5bd334f6749ab25d46de586465032d25a84ab399 100644 (file)
@@ -2,7 +2,6 @@
 
 import enum
 import importlib
-import re
 import urllib.parse
 from collections.abc import Sequence
 from typing import TYPE_CHECKING, Optional, cast
@@ -172,16 +171,8 @@ def detect_distribution() -> tuple[Optional[Distribution], Optional[str]]:
 
     dist_id = os_release.get("ID", "linux")
     dist_id_like = os_release.get("ID_LIKE", "").split()
-    version = os_release.get("VERSION", None)
     version_id = os_release.get("VERSION_ID", None)
     version_codename = os_release.get("VERSION_CODENAME", None)
-    extracted_codename = None
-
-    if version:
-        # extract Debian release codename
-        m = re.search(r"\((.*?)\)", version)
-        if m:
-            extracted_codename = m.group(1)
 
     d: Optional[Distribution] = None
     for the_id in [dist_id, *dist_id_like]:
@@ -189,8 +180,8 @@ def detect_distribution() -> tuple[Optional[Distribution], Optional[str]]:
         if d is not None:
             break
 
-    if d in {Distribution.debian, Distribution.ubuntu} and (version_codename or extracted_codename):
-        version_id = version_codename or extracted_codename
+    if d in {Distribution.debian, Distribution.ubuntu} and version_codename:
+        version_id = version_codename
 
     return d, version_id