From: Daan De Meyer Date: Thu, 19 Oct 2023 17:46:21 +0000 (+0200) Subject: Modernize mageia and openmandriva a bit X-Git-Tag: v19~60^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c4a52b0678ad8f1d331aff69bf7bf8ae3f1e0ea;p=thirdparty%2Fmkosi.git Modernize mageia and openmandriva a bit --- diff --git a/mkosi/distributions/mageia.py b/mkosi/distributions/mageia.py index 94cdb3a64..4f4efdcd7 100644 --- a/mkosi/distributions/mageia.py +++ b/mkosi/distributions/mageia.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ import shutil +import urllib.parse from collections.abc import Sequence from mkosi.architecture import Architecture @@ -33,36 +34,30 @@ class Installer(DistributionInstaller): @classmethod def setup(cls, state: MkosiState) -> None: - release = state.config.release.strip("'") - arch = state.config.distribution.architecture(state.config.architecture) + gpgurls = ( + find_rpm_gpgkey( + state, + "RPM-GPG-KEY-Mageia", + "https://mirrors.kernel.org/mageia/distrib/$releasever/$basearch/media/core/release/media_info/pubkey", + ), + ) + + repos = [] if state.config.local_mirror: - release_url = f"baseurl={state.config.local_mirror}" - updates_url = None + repos += [Repo("core-release", f"baseurl={state.config.local_mirror}", gpgurls)] elif state.config.mirror: - baseurl = f"{state.config.mirror}/distrib/{release}/{arch}/media/core/" - release_url = f"baseurl={baseurl}/release/" - if release == "cauldron": - updates_url = None - else: - updates_url = f"baseurl={baseurl}/updates/" + url = f"baseurl={urllib.parse.urljoin(state.config.mirror, 'distrib/$releasever/$basearch/media/core/')}" + repos += [ + Repo("core-release", f"{url}/release", gpgurls), + Repo("core-updates", f"{url}/updates/", gpgurls) + ] else: - baseurl = f"https://www.mageia.org/mirrorlist/?release={release}&arch={arch}§ion=core" - release_url = f"mirrorlist={baseurl}&repo=release" - if release == "cauldron": - updates_url = None - else: - updates_url = f"mirrorlist={baseurl}&repo=updates" - - gpgurl = find_rpm_gpgkey( - state, - "RPM-GPG-KEY-Mageia", - f"https://mirrors.kernel.org/mageia/distrib/{release}/{arch}/media/core/release/media_info/pubkey", - ) - - repos = [Repo(f"mageia-{release}", release_url, (gpgurl,))] - if updates_url is not None: - repos += [Repo(f"mageia-{release}-updates", updates_url, (gpgurl,))] + url = "mirrorlist=https://www.mageia.org/mirrorlist/?release=$releasever&arch=$basearch§ion=core" + repos += [ + Repo("core-release", f"{url}&repo=release", gpgurls), + Repo("core-updates", f"{url}&repo=updates", gpgurls) + ] setup_dnf(state, repos) @@ -88,6 +83,7 @@ class Installer(DistributionInstaller): def architecture(arch: Architecture) -> str: a = { Architecture.x86_64 : "x86_64", + Architecture.arm64 : "aarch64", }.get(arch) if not a: diff --git a/mkosi/distributions/openmandriva.py b/mkosi/distributions/openmandriva.py index 4dd405446..88b243ff3 100644 --- a/mkosi/distributions/openmandriva.py +++ b/mkosi/distributions/openmandriva.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1+ import shutil +import urllib.parse from collections.abc import Sequence from mkosi.architecture import Architecture @@ -33,34 +34,26 @@ class Installer(DistributionInstaller): @classmethod def setup(cls, state: MkosiState) -> None: - release = state.config.release.strip("'") - arch = state.config.distribution.architecture(state.config.architecture) mirror = state.config.mirror or "http://mirror.openmandriva.org" - if release[0].isdigit(): - release_model = "rock" - elif release == "cooker": - release_model = "cooker" - else: - release_model = release + gpgurls = ( + find_rpm_gpgkey( + state, + "RPM-GPG-KEY-OpenMandriva", + "https://raw.githubusercontent.com/OpenMandrivaAssociation/openmandriva-repos/master/RPM-GPG-KEY-OpenMandriva", + ), + ) + + repos = [] if state.config.local_mirror: - release_url = f"baseurl={state.config.local_mirror}" - updates_url = None + repos += [Repo("main-release", f"baseurl={state.config.local_mirror}", gpgurls)] else: - baseurl = f"{mirror}/{release_model}/repository/{arch}/main" - release_url = f"baseurl={baseurl}/release/" - updates_url = f"baseurl={baseurl}/updates/" - - gpgurl = find_rpm_gpgkey( - state, - "RPM-GPG-KEY-OpenMandriva", - "https://raw.githubusercontent.com/OpenMandrivaAssociation/openmandriva-repos/master/RPM-GPG-KEY-OpenMandriva", - ) - - repos = [Repo("openmandriva", release_url, (gpgurl,))] - if updates_url is not None: - repos += [Repo("updates", updates_url, (gpgurl,))] + url = f"baseurl={urllib.parse.urljoin(mirror, '$releasever/repository/$basearch/main')}" + repos += [ + Repo("main-release", f"{url}/release", gpgurls), + Repo("main-updates", f"{url}/updates", gpgurls), + ] setup_dnf(state, repos) @@ -89,7 +82,9 @@ class Installer(DistributionInstaller): @staticmethod def architecture(arch: Architecture) -> str: a = { - Architecture.x86_64 : "x86_64", + Architecture.x86_64 : "x86_64", + Architecture.arm64 : "aarch64", + Architecture.riscv64 : "riscv64", }.get(arch) if not a: