From 10252b287d7d3bc338d0aa3e5d2e6c0fc6d1653d Mon Sep 17 00:00:00 2001
From: David Runge <dvzrv@archlinux.org>
Date: Thu, 29 Feb 2024 20:53:42 +0100
Subject: [PATCH] fix(libkeyringctl): Adapt to CLI churn in sequoia-sq 0.34.0

The `sq keyring` command has been moved to `sq toolbox keyring`.
The `sq toolbox packet split` command now outputs to stdout by default
for unknown reasons. Providing an empty string to `--prefix` now
works again and somehow has the command output to files again.

Signed-off-by: David Runge <dvzrv@archlinux.org>
---
 libkeyringctl/sequoia.py | 6 +++---
 libkeyringctl/verify.py  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libkeyringctl/sequoia.py b/libkeyringctl/sequoia.py
index 1e731491..34206a58 100644
--- a/libkeyringctl/sequoia.py
+++ b/libkeyringctl/sequoia.py
@@ -49,7 +49,7 @@ def keyring_split(working_dir: Path, keyring: Path, preserve_filename: bool = Fa
     keyring_dir = Path(mkdtemp(dir=working_dir, prefix="keyring-")).absolute()
 
     with cwd(keyring_dir):
-        system(["sq", "keyring", "split", str(keyring)])
+        system(["sq", "toolbox", "keyring", "split", str(keyring)])
 
     keyrings: List[Path] = list(natural_sort_path(keyring_dir.iterdir()))
 
@@ -75,7 +75,7 @@ def keyring_merge(certificates: List[Path], output: Optional[Path] = None, force
     The result if no output file has been used
     """
 
-    cmd = ["sq", "keyring", "merge"]
+    cmd = ["sq", "toolbox", "keyring", "merge"]
     if force:
         cmd.insert(1, "--force")
     if output:
@@ -103,7 +103,7 @@ def packet_split(working_dir: Path, certificate: Path) -> Iterable[Path]:
     packet_dir = Path(mkdtemp(dir=working_dir, prefix="packet-")).absolute()
 
     with cwd(packet_dir):
-        system(["sq", "toolbox", "packet", "split", str(certificate)])
+        system(["sq", "toolbox", "packet", "split", "--prefix", "''", str(certificate)])
     return natural_sort_path(packet_dir.iterdir())
 
 
diff --git a/libkeyringctl/verify.py b/libkeyringctl/verify.py
index a0c582bc..29c64d86 100644
--- a/libkeyringctl/verify.py
+++ b/libkeyringctl/verify.py
@@ -71,7 +71,7 @@ def verify(  # noqa: ignore=C901
                 keyring_fd = Popen(("sq", "dearmor", f"{str(keyring_path)}"), stdout=PIPE)
                 print(system(["hokey", "lint"], _stdin=keyring_fd.stdout), end="")
             if lint_sq_keyring:
-                print(system(["sq", "keyring", "lint", f"{str(keyring_path)}"]), end="")
+                print(system(["sq", "toolbox", "keyring", "lint", f"{str(keyring_path)}"]), end="")
 
 
 def verify_integrity(certificate: Path, all_fingerprints: Set[Fingerprint]) -> None:  # noqa: ignore=C901
-- 
GitLab

