From: Daan De Meyer Date: Tue, 17 Sep 2024 15:30:39 +0000 (+0200) Subject: Use workdir() for calculate_signature() X-Git-Tag: v25~285^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f18c3d60e1133b350e29063efdafd0b9d8c6cf11;p=thirdparty%2Fmkosi.git Use workdir() for calculate_signature() --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index ac21e4355..91ef1eb92 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2016,7 +2016,10 @@ def calculate_signature(context: Context) -> None: 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(): @@ -2026,22 +2029,19 @@ def calculate_signature(context: Context) -> None: 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,