From 2d53554a58d08c3bc8f5afc6a35da8d797c53c13 Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Fri, 23 Feb 2024 10:09:13 +0200 Subject: [PATCH] sigstore-python-conformance: Handle --staging sigstore-python expects the order "sigstore [--staging] ". Signed-off-by: Jussi Kukkonen --- sigstore-python-conformance | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sigstore-python-conformance b/sigstore-python-conformance index 427fd97..eab5557 100755 --- a/sigstore-python-conformance +++ b/sigstore-python-conformance @@ -25,17 +25,23 @@ subcmd = fixed_args[0] if subcmd in SUBCMD_REPLACEMENTS: fixed_args[0] = SUBCMD_REPLACEMENTS[subcmd] -# Replace incompatible flags. -fixed_args = [ARG_REPLACEMENTS[arg] if arg in ARG_REPLACEMENTS else arg for arg in fixed_args] +# Build base command with optional staging argument +command = ["sigstore"] +if "--staging" in fixed_args: + command.append("--staging") + fixed_args.remove("--staging") # Fix-up the subcommand: the conformance suite uses `verify`, but # `sigstore` requires `verify identity` for identity based verifications. subcommand, *fixed_args = fixed_args if subcommand == "sign": - fixed_args = ["sigstore", "sign", *fixed_args] + command.append("sign") elif subcommand == "verify": - fixed_args = ["sigstore", "verify", "identity", *fixed_args] + command.extend(["verify", "identity"]) else: raise ValueError(f"unsupported subcommand: {subcommand}") -os.execvp("sigstore", fixed_args) +# Replace incompatible flags. +command.extend(ARG_REPLACEMENTS[arg] if arg in ARG_REPLACEMENTS else arg for arg in fixed_args) + +os.execvp("sigstore", command)