From 9b7dafebf6d913ef590db84de40dfb104fa6110d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 31 May 2023 22:42:55 +0200 Subject: [PATCH] fedora: Add Enterprise Linux Next (ELN) support Let's add support for ELN (https://docs.fedoraproject.org/en-US/eln/) which builds Fedora with the RHEL toolchain. --- mkosi/config.py | 3 +++ mkosi/distributions/fedora.py | 24 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/mkosi/config.py b/mkosi/config.py index 391513713..cc665b6d0 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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 diff --git a/mkosi/distributions/fedora.py b/mkosi/distributions/fedora.py index b1076892d..af4338886 100644 --- a/mkosi/distributions/fedora.py +++ b/mkosi/distributions/fedora.py @@ -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) -- 2.47.2