]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Look for the CentOS Stream official GPG in /etc/pki/rpm-gpg as well
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 16 Jan 2025 14:31:10 +0000 (15:31 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 16 Jan 2025 16:02:52 +0000 (17:02 +0100)
Turns out the key names in /etc/pki/rpm-gpg are slightly different
so let's update the logic to search properly for both.

mkosi/distributions/centos.py

index 6ef2a366f398abac659a6f056a22436bcdb28e2b..3cbbaabfc2018dbea6005e1c782411a849966d53 100644 (file)
@@ -98,16 +98,36 @@ class Installer(DistributionInstaller):
 
     @staticmethod
     def gpgurls(context: Context) -> tuple[str, ...]:
+        # First, start with the names of the appropriate keys in /etc/pki/rpm-gpg.
+
+        if context.config.release == "9":
+            rel = "RPM-GPG-KEY-centosofficial"
+        else:
+            rel = "RPM-GPG-KEY-centosofficial-SHA256"
+
+        one = find_rpm_gpgkey(context, rel, required=False)
+
+        # Next, follow up with the names of the appropriate keys in /usr/share/distribution-gpg-keys.
+
         if context.config.release == "9":
             rel = "RPM-GPG-KEY-CentOS-Official"
         else:
             rel = "RPM-GPG-KEY-CentOS-Official-SHA256"
 
-        return tuple(
-            find_rpm_gpgkey(context, key, f"https://www.centos.org/keys/{key}")
-            for key in (rel, "RPM-GPG-KEY-CentOS-SIG-Extras")
+        # The key in /usr/share/distribution-gpg-keys is only required if we didn't find one in
+        # /etc/pki/rpm-gpg.
+        two = find_rpm_gpgkey(context, rel, f"https://www.centos.org/keys/{rel}", required=bool(one))
+
+        # Finally, look up the key for the SIG-Extras repository.
+
+        sig = find_rpm_gpgkey(
+            context,
+            "RPM-GPG-KEY-CentOS-SIG-Extras",
+            "https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-Extras",
         )
 
+        return tuple(key for key in (one, two, sig) if key is not None)
+
     @classmethod
     def repository_variants(cls, context: Context, repo: str) -> Iterable[RpmRepository]:
         if context.config.local_mirror: