From 91f9ebb25bb842c9ba918cc2547960dcdaabf562 Mon Sep 17 00:00:00 2001 From: Kristian Klausen Date: Sat, 11 Jun 2022 13:28:41 +0200 Subject: [PATCH] Add support for multiple keyrings We want all @archlinux.org keys in one place, so they can all be exported to WKD (#142). This commit adds basic support for the expected keyrings we need in the short term (support staff and service accounts (ex: @renovate)). Fix #141 --- libkeyringctl/cli.py | 9 +++++++++ libkeyringctl/types.py | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/libkeyringctl/cli.py b/libkeyringctl/cli.py index 3334c17..932076b 100644 --- a/libkeyringctl/cli.py +++ b/libkeyringctl/cli.py @@ -15,6 +15,7 @@ from .keyring import convert from .keyring import export from .keyring import inspect_keyring from .keyring import list_keyring +from .types import Keyring from .types import TrustFilter from .util import absolute_path from .util import cwd @@ -32,6 +33,12 @@ parser.add_argument( default=False, help="force the execution of subcommands (e.g. overwriting of files)", ) +parser.add_argument( + "--keyring", + choices=[e.value for e in Keyring], + default=Keyring.packager.value, + help="Keyring to use", +) subcommands = parser.add_subparsers(dest="subcommand") convert_parser = subcommands.add_parser( @@ -143,6 +150,8 @@ def main() -> None: # noqa: ignore=C901 with TemporaryDirectory(prefix="arch-keyringctl-") as tempdir: project_root = Path(".").absolute() keyring_root = Path("keyring").absolute() + if args.keyring != "packager": + keyring_root = Path(args.keyring).absolute() working_dir = Path(tempdir) debug(f"Working directory: {working_dir}") with cwd(working_dir): diff --git a/libkeyringctl/types.py b/libkeyringctl/types.py index 98222cd..ebffb99 100644 --- a/libkeyringctl/types.py +++ b/libkeyringctl/types.py @@ -10,6 +10,12 @@ Username = NewType("Username", str) PacketKind = NewType("PacketKind", str) +class Keyring(Enum): + packager = "packager" + support = "support" + service = "service" + + class Trust(Enum): unknown = auto revoked = auto()