]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
fedora: Add Enterprise Linux Next (ELN) support 1600/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 May 2023 20:42:55 +0000 (22:42 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 May 2023 20:53:01 +0000 (22:53 +0200)
Let's add support for ELN (https://docs.fedoraproject.org/en-US/eln/)
which builds Fedora with the RHEL toolchain.

mkosi/config.py
mkosi/distributions/fedora.py

index 391513713a30a777db82d1b7b8f5057ac4207574..cc665b6d0ae094b9afabcdce805dffeeb93a8348 100644 (file)
@@ -222,6 +222,7 @@ def config_default_mirror(namespace: argparse.Namespace) -> Optional[str]:
         setattr(namespace, "architecture", Architecture.native())
 
     d = getattr(namespace, "distribution")
+    r = getattr(namespace, "release", None)
     a = getattr(namespace, "architecture")
 
     if d == Distribution.debian:
@@ -238,6 +239,8 @@ def config_default_mirror(namespace: argparse.Namespace) -> Optional[str]:
             return "https://geo.mirror.pkgbuild.com"
     elif d == Distribution.opensuse:
         return "https://download.opensuse.org"
+    elif d == Distribution.fedora and r == "eln":
+        return "https://odcs.fedoraproject.org/composes/production/latest-Fedora-ELN/compose"
 
     return None
 
index b1076892d4977840391c00d4a14b5d477c9f502d..af43388866e5391f53a5d21f09a443f0b504428a 100644 (file)
@@ -31,10 +31,16 @@ class FedoraInstaller(DistributionInstaller):
     @classmethod
     def install_packages(cls, state: MkosiState, packages: Sequence[str], apivfs: bool = True) -> None:
         release = parse_fedora_release(state.config.release)
+        release_url = updates_url = appstream_url = baseos_url = extras_url = crb_url = None
 
         if state.config.local_mirror:
             release_url = f"baseurl={state.config.local_mirror}"
-            updates_url = None
+        elif release == "eln":
+            assert state.config.mirror
+            appstream_url = f"baseurl={state.config.mirror}/AppStream/$basearch/os"
+            baseos_url = f"baseurl={state.config.mirror}/BaseOS/$basearch/os"
+            extras_url = f"baseurl={state.config.mirror}/Extras/$basearch/os"
+            crb_url = f"baseurl={state.config.mirror}/CRB/$basearch/os"
         elif state.config.mirror:
             directory = "development" if release == "rawhide" else "releases"
             release_url = f"baseurl={state.config.mirror}/{directory}/$releasever/Everything/$basearch/os/"
@@ -54,9 +60,15 @@ class FedoraInstaller(DistributionInstaller):
         # See: https://fedoraproject.org/security/
         gpgurl = "https://fedoraproject.org/fedora.gpg"
 
-        repos = [Repo("fedora", release_url, [gpgurl])]
-        if updates_url is not None:
-            repos += [Repo("updates", updates_url, [gpgurl])]
+        repos = []
+        for name, url in (("fedora",    release_url),
+                          ("updates",   updates_url),
+                          ("appstream", appstream_url),
+                          ("baseos",    baseos_url),
+                          ("extras",    extras_url),
+                          ("crb",       crb_url)):
+            if url:
+                repos += [Repo(name, url, [gpgurl])]
 
         setup_dnf(state, repos)
         invoke_dnf(state, "install", packages, apivfs=apivfs)
@@ -95,9 +107,9 @@ def parse_fedora_release(release: str) -> str:
 
 
 def fedora_release_at_least(release: str, threshold: str) -> bool:
-    if release == 'rawhide':
+    if release in ("rawhide", "eln"):
         return True
-    if threshold == 'rawhide':
+    if threshold in ("rawhide", "eln"):
         return False
     # If neither is 'rawhide', both must be integers
     return int(release) >= int(threshold)