# SPDX-License-Identifier: LGPL-2.1+
+import re
from collections.abc import Iterable, Sequence
+from pathlib import Path
from mkosi.config import Architecture, Config
from mkosi.context import Context
key2 = find_rpm_gpgkey(context, key=f"RPM-GPG-KEY-fedora-{context.config.release}-secondary")
if key1:
+ # During branching, there is always a kerfuffle with the key transition.
+ # For Rawhide, try to load the N+1 key, just in case our local configuration
+ # still indicates that Rawhide==N, but really Rawhide==N+1.
+ if context.config.release == "rawhide" and key1.startswith("file://"):
+ path = Path(key1.removeprefix("file://")).resolve()
+ if m := re.match(r"RPM-GPG-KEY-fedora-(\d+)-(primary|secondary)", path.name):
+ version = int(m.group(1))
+ if key3 := find_rpm_gpgkey(context, key=f"RPM-GPG-KEY-fedora-{version + 1}-primary"):
+ # We yield the resolved path for key1, to make it clear that it's
+ # for version N, and the other key is for version N+1.
+ key1 = path.as_uri()
+ yield key3
+
yield key1
if key2:
yield key2