From 66f6a98fe2c8ef35bfa62284ac0979be6f20c052 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 13 Sep 2024 04:26:52 +0100 Subject: command-line-tool: Do not embed stdout-filename outside main body. stdout-output->value cannot access the inputs variable, and thus will fail when stdout-filename is a parameter reference that needs to be evaluated. To avoid this, pass it in as an argument. * ravanan/command-line-tool.scm (build-command-line-tool-script)[stdout-output->value]: Accept stdout-filename as argument instead of G-expression embedding. Pass stdout-filename as argument to stdout-output->value. --- ravanan/command-line-tool.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index 5170df4..7a50ee3 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -830,6 +830,7 @@ named @var{name} with @var{inputs} using tools from Guix manifest #~(append (map (cut stdout-output->value workflow-output-directory stdout-directory + #$stdout-filename <>) '#$stdout-outputs) (map (cut other-output->value @@ -943,21 +944,22 @@ directory of the workflow." (define (stdout-output->value workflow-output-directory stdout-directory + stdout-filename output) (cons (assoc-ref output "id") (path->value - (if (string=? #$stdout-filename + (if (string=? stdout-filename (file-name-join* stdout-directory "stdout")) ;; If stdout filename is unspecified, rename it to a ;; hash of its contents. (let ((hashed-filename (file-name-join* stdout-directory - (sha1-hash #$stdout-filename)))) - (rename-file #$stdout-filename + (sha1-hash stdout-filename)))) + (rename-file stdout-filename hashed-filename) hashed-filename) ;; Else, return the stdout filename as it is. - #$stdout-filename) + stdout-filename) workflow-output-directory %nothing))) -- cgit v1.2.3