# SPDX-License-Identifier: LGPL-2.1+
import subprocess
+import textwrap
from pathlib import Path
from typing import NamedTuple, Optional
for plugin in plugindir.iterdir():
f.write(f"%__transaction_{plugin.stem} %{{nil}}\n")
+ # Write an rpm sequoia policy that allows SHA1 as various distribution GPG keys (OpenSUSE) still use SHA1 for
+ # various things.
+ # TODO: Remove when all rpm distribution GPG keys have stopped using SHA1.
+ if not (p := context.pkgmngr / "etc/crypto-policies/back-ends/rpm-sequoia.config").exists():
+ p.parent.mkdir(parents=True, exist_ok=True)
+ p.write_text(
+ textwrap.dedent(
+ """
+ [hash_algorithms]
+ sha1.second_preimage_resistance = "always"
+ sha224 = "always"
+ sha256 = "always"
+ sha384 = "always"
+ sha512 = "always"
+ default_disposition = "never"
+ """
+ )
+ )
+
def rpm_cmd(context: Context) -> list[PathString]:
return ["env", "HOME=/", "rpm", "--root", context.root]
for subdir in (
Path("etc/pki"),
Path("etc/ssl"),
- Path("etc/crypto-policies"),
Path("etc/ca-certificates"),
Path("etc/pacman.d/gnupg"),
Path("var/lib/ca-certificates"),