]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
centos: Add Special Interest Group (SIG) repositories
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Jul 2023 10:36:39 +0000 (12:36 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 4 Jul 2023 11:09:46 +0000 (13:09 +0200)
See https://wiki.centos.org/SpecialInterestGroup for more information
on SIGs. This commit only adds the Hyperscale SIG repositories. More can
be added later on an as-needed basis.

mkosi/distributions/centos.py

index aa43ce5f5e49562e6dd9aad0f376f2aa0bd49d97..5c84f3f0a9f4a265d1a84fe730c2e302cb4a6262 100644 (file)
@@ -140,6 +140,38 @@ class CentosInstaller(DistributionInstaller):
     def _mirror_repo_url(cls, repo: str) -> str:
         return f"http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo={repo}"
 
+    @classmethod
+    def _sig_repos(cls, config: MkosiConfig, release: int) -> list[Repo]:
+        if config.local_mirror or config.distribution != Distribution.centos:
+            return []
+
+        sigs = (
+            (
+                "hyperscale",
+                (f"packages-{c}" for c in ("main", "experimental", "facebook", "hotfixes", "spin", "intel")),
+                "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-HyperScale",
+            ),
+        )
+
+        repos = []
+
+        for sig, components, gpgurl in sigs:
+            for c in components:
+                if config.mirror:
+                    if release <= 8:
+                        url = f"baseurl={config.mirror}/centos/$stream/{sig}/$basearch/{c}"
+                    else:
+                        url = f"baseurl={config.mirror}/SIGs/$stream/{sig}/$basearch/{c}"
+                else:
+                    if release <= 8:
+                        url = f"mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo={sig}-{c}"
+                    else:
+                        url = f"metalink=https://mirrors.centos.org/metalink?repo=centos-{sig}-sig-{c}-$stream&arch=$basearch"
+
+                repos += [Repo(f"{sig}-{c}", url, [gpgurl], enabled=False)]
+
+        return repos
+
     @classmethod
     def _epel_repos(cls, config: MkosiConfig) -> list[Repo]:
         epel_gpgurl = "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-$releasever"
@@ -202,7 +234,7 @@ class CentosInstaller(DistributionInstaller):
             if url:
                 repos += [Repo(name, url, [gpgurl])]
 
-        return repos + cls._epel_repos(config)
+        return repos + cls._epel_repos(config) + cls._sig_repos(config, release)
 
     @classmethod
     def _stream_repos(cls, config: MkosiConfig, release: int) -> list[Repo]:
@@ -233,4 +265,4 @@ class CentosInstaller(DistributionInstaller):
             if url:
                 repos += [Repo(name, url, [gpgurl])]
 
-        return repos + cls._epel_repos(config)
+        return repos + cls._epel_repos(config) + cls._sig_repos(config, release)