if context.config.key is not None:
cmdline += ["--default-key", context.config.key]
- cmdline += ["--output", "-", "-"]
+ cmdline += [
+ "--output", workdir(context.staging / context.config.output_signature),
+ workdir(context.staging / context.config.output_checksum),
+ ]
home = Path(context.config.environment.get("GNUPGHOME", INVOKING_USER.home() / ".gnupg"))
if not home.exists():
if sys.stderr.isatty():
env |= dict(GPG_TTY=os.ttyname(sys.stderr.fileno()))
- options: list[PathString] = ["--bind", home, home]
+ options: list[PathString] = [
+ "--bind", home, home,
+ "--bind", context.staging, workdir(context.staging),
+ ]
# gpg can communicate with smartcard readers via this socket so bind mount it in if it exists.
if (p := Path("/run/pcscd/pcscd.comm")).exists():
options += ["--bind", p, p]
- with (
- complete_step("Signing SHA256SUMS…"),
- open(context.staging / context.config.output_checksum, "rb") as i,
- open(context.staging / context.config.output_signature, "wb") as o,
- ):
+ with (complete_step("Signing SHA256SUMS…")):
run(
cmdline,
env=env,
- stdin=i,
- stdout=o,
sandbox=context.sandbox(
binary="gpg",
options=options,