summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-09-13 04:26:52 +0100
committerArun Isaac2024-09-13 04:30:56 +0100
commit66f6a98fe2c8ef35bfa62284ac0979be6f20c052 (patch)
treef4771ac726d1376f29c90a1cf1373897f8c07913
parent99f1bcc440b81aefde733149598cfa6c396bcde9 (diff)
downloadravanan-66f6a98fe2c8ef35bfa62284ac0979be6f20c052.tar.gz
ravanan-66f6a98fe2c8ef35bfa62284ac0979be6f20c052.tar.lz
ravanan-66f6a98fe2c8ef35bfa62284ac0979be6f20c052.zip
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.
-rw-r--r--ravanan/command-line-tool.scm10
1 files 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)))