From: Daan De Meyer Date: Mon, 12 Jun 2023 12:02:28 +0000 (+0200) Subject: centos: Streamline repo configuration a bit X-Git-Tag: v15~114^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1626%2Fhead;p=thirdparty%2Fmkosi.git centos: Streamline repo configuration a bit --- diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index 681e47493..aa43ce5f5 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -193,18 +193,16 @@ class CentosInstaller(DistributionInstaller): crb_url = None powertools_url = f"mirrorlist={cls._mirror_repo_url('PowerTools')}" - repos = [Repo("appstream", appstream_url, [gpgurl])] - if baseos_url is not None: - repos += [Repo("baseos", baseos_url, [gpgurl])] - if extras_url is not None: - repos += [Repo("extras", extras_url, [gpgurl])] - if crb_url is not None: - repos += [Repo("crb", crb_url, [gpgurl])] - if powertools_url is not None: - repos += [Repo("powertools", powertools_url, [gpgurl])] - repos += cls._epel_repos(config) - - return repos + repos = [] + for name, url in (("appstream", appstream_url), + ("baseos", baseos_url), + ("extras", extras_url), + ("crb", crb_url), + ("powertools", powertools_url)): + if url: + repos += [Repo(name, url, [gpgurl])] + + return repos + cls._epel_repos(config) @classmethod def _stream_repos(cls, config: MkosiConfig, release: int) -> list[Repo]: @@ -227,13 +225,12 @@ class CentosInstaller(DistributionInstaller): extras_url = "metalink=https://mirrors.centos.org/metalink?repo=centos-extras-sig-extras-common-$stream&arch=$basearch&protocol=https,http" crb_url = "metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http" - repos = [Repo("appstream", appstream_url, [gpgurl])] - if baseos_url is not None: - repos += [Repo("baseos", baseos_url, [gpgurl])] - if extras_url is not None: - repos += [Repo("extras", extras_url, [extras_gpgurl])] - if crb_url is not None: - repos += [Repo("crb", crb_url, [gpgurl])] - repos += cls._epel_repos(config) + repos = [] + for name, url, gpgurl in (("appstream", appstream_url, gpgurl), + ("baseos", baseos_url, gpgurl), + ("extras", extras_url, extras_gpgurl), + ("crb", crb_url, gpgurl)): + if url: + repos += [Repo(name, url, [gpgurl])] - return repos + return repos + cls._epel_repos(config)