From: Daan De Meyer Date: Mon, 19 Feb 2024 12:31:55 +0000 (+0100) Subject: Give CentOS SIG repositories a higher priority X-Git-Tag: v21~44^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=958c03e16f4e16f90e9a1329c98610e695c2717f;p=thirdparty%2Fmkosi.git Give CentOS SIG repositories a higher priority CentOS SIGs often ship rebuilds of existing packages which can get out of date when CentOS 9 Stream ships a newer version. Let's make sure that the SIG rebuild is still installed by giving all SIG repositories a priority of 50. --- diff --git a/mkosi/distributions/centos.py b/mkosi/distributions/centos.py index 050e6100e..b065ae917 100644 --- a/mkosi/distributions/centos.py +++ b/mkosi/distributions/centos.py @@ -17,6 +17,8 @@ from mkosi.log import die from mkosi.util import listify from mkosi.versioncomp import GenericVersion +CENTOS_SIG_REPO_PRIORITY = 50 + class Installer(DistributionInstaller): @classmethod @@ -355,18 +357,21 @@ class Installer(DistributionInstaller): f"baseurl={join_mirror(mirror, f'centos/$stream/{sig}/$basearch/{c}')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-debuginfo", f"baseurl={join_mirror(mirror, f'centos-debuginfo/$stream/{sig}/$basearch')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-source", f"baseurl={join_mirror(mirror, f'centos/$stream/{sig}/Source')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) else: yield RpmRepository( @@ -374,18 +379,21 @@ class Installer(DistributionInstaller): f"baseurl={join_mirror(mirror, f'centos-stream/SIGs/$stream/{sig}/$basearch/{c}')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-debuginfo", f"baseurl={join_mirror(mirror, f'centos-stream/SIGs/$stream/{sig}/$basearch/{c}/debug')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-source", f"baseurl={join_mirror(mirror, f'centos-stream/SIGs/$stream/{sig}/source/{c}')}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) else: if GenericVersion(context.config.release) <= 8: @@ -394,6 +402,7 @@ class Installer(DistributionInstaller): f"mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo={sig}-{c}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) # These can't be retrieved from the mirrorlist. yield RpmRepository( @@ -401,12 +410,14 @@ class Installer(DistributionInstaller): f"baseurl=http://debuginfo.centos.org/centos/$stream/{sig}/$basearch", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-source", f"baseurl=https://vault.centos.org/$stream/{sig}/Source/{c}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) else: url = "metalink=https://mirrors.centos.org/metalink" @@ -415,18 +426,21 @@ class Installer(DistributionInstaller): f"{url}?arch=$basearch&repo=centos-{sig}-sig-{c}-$stream", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-debuginfo", f"{url}?arch=$basearch&repo=centos-{sig}-sig-{c}-debug-$stream", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( f"{sig}-{c}-source", f"{url}?arch=source&repo=centos-{sig}-sig-{c}-source-$stream", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) yield RpmRepository( @@ -434,6 +448,7 @@ class Installer(DistributionInstaller): f"baseurl=https://buildlogs.centos.org/centos/$stream/{sig}/$basearch/{c}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) if GenericVersion(context.config.release) >= 9: @@ -442,4 +457,5 @@ class Installer(DistributionInstaller): f"baseurl=https://buildlogs.centos.org/centos/$stream/{sig}/$basearch/{c}", gpgurls, enabled=False, + priority=CENTOS_SIG_REPO_PRIORITY, ) diff --git a/mkosi/installer/dnf.py b/mkosi/installer/dnf.py index 799f3e22b..8cb9b7a54 100644 --- a/mkosi/installer/dnf.py +++ b/mkosi/installer/dnf.py @@ -84,6 +84,8 @@ class Dnf(PackageManager): f.write(f"sslclientcert={repo.sslclientcert}\n") if repo.sslclientkey: f.write(f"sslclientkey={repo.sslclientkey}\n") + if repo.priority: + f.write(f"priority={repo.priority}\n") for i, url in enumerate(repo.gpgurls): f.write("gpgkey=" if i == 0 else len("gpgkey=") * " ") diff --git a/mkosi/installer/rpm.py b/mkosi/installer/rpm.py index 18da69cc1..ab1f44280 100644 --- a/mkosi/installer/rpm.py +++ b/mkosi/installer/rpm.py @@ -17,6 +17,7 @@ class RpmRepository(NamedTuple): sslcacert: Optional[Path] = None sslclientkey: Optional[Path] = None sslclientcert: Optional[Path] = None + priority: Optional[int] = None def find_rpm_gpgkey(context: Context, key: str) -> Optional[str]: diff --git a/mkosi/installer/zypper.py b/mkosi/installer/zypper.py index 152aa2d93..1ea97882b 100644 --- a/mkosi/installer/zypper.py +++ b/mkosi/installer/zypper.py @@ -87,6 +87,9 @@ class Zypper(PackageManager): ) ) + if repo.priority: + f.write(f"priority={repo.priority}\n") + for i, url in enumerate(repo.gpgurls): f.write("gpgkey=" if i == 0 else len("gpgkey=") * " ") f.write(f"{url}\n")