# 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 (rhs := startswith(key1, "file://")):
- path = Path(rhs).resolve()
- if m := versionre.match(path.name):
+ if m := versionre.match(Path(rhs).name):
version = int(m.group(1))
if key3 := find_rpm_gpgkey(
context,
key=f"RPM-GPG-KEY-fedora-{version + 1}-primary",
required=False,
):
- # 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
) -> Optional[str]:
root = context.config.tools() if context.config.tools_tree_certificates else Path("/")
+ # We assume here that GPG keys will only ever be relative symlinks and never absolute symlinks.
+
if gpgpath := next((root / "usr/share/distribution-gpg-keys").rglob(key), None):
- return (Path("/") / gpgpath.relative_to(root)).as_uri()
+ return (Path("/") / gpgpath.resolve().relative_to(root)).as_uri()
if gpgpath := next(Path(context.sandbox_tree / "etc/pki/rpm-gpg").rglob(key), None):
- return (Path("/") / gpgpath.relative_to(context.sandbox_tree)).as_uri()
+ return (Path("/") / gpgpath.resolve().relative_to(context.sandbox_tree)).as_uri()
if fallback and context.config.repository_key_fetch:
return fallback