about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-06-26 19:02:18 +0100
committerArun Isaac2025-06-26 19:02:18 +0100
commit3cd7ea8e2545cf46c2c5715462924e03a80e89ee (patch)
treed834b40e2e89b2c0fff30b6b6f1f9766ce46a8b2
parente6c1b526ad0104923586a3f6801a231baef11a4a (diff)
downloadravanan-3cd7ea8e2545cf46c2c5715462924e03a80e89ee.tar.gz
ravanan-3cd7ea8e2545cf46c2c5715462924e03a80e89ee.tar.lz
ravanan-3cd7ea8e2545cf46c2c5715462924e03a80e89ee.zip
command-line-tool: Wrap vectors and alists when embedding in G-exps.
*
ravanan/command-line-tool.scm (build-command-line-tool-script)[vector->gexp,
alist->gexp]: New functions.
[run-command-gexp]: Use vector->gexp and alist->gexp.
-rw-r--r--ravanan/command-line-tool.scm18
1 files changed, 16 insertions, 2 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 948b61a..c4ba42c 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -596,14 +596,28 @@ named @var{name} using tools from Guix manifest in @var{manifest-file} and on
       (cons "valueFrom"
             (coerce-expression (assoc-ref* argument "valueFrom")))))
 
+  (define (vector->gexp vec)
+    ;; FIXME: G-expressions in vectors are not properly substituted. Fix this in
+    ;; Guix.
+    #~(vector #$@(vector->list vec)))
+
+  (define (alist->gexp alist)
+    ;; FIXME: G-expressions as values in dotted alists are not properly
+    ;; substituted. Fix this in Guix.
+    #~(list #$@(map (match-lambda
+                      ((key . value)
+                       #~(cons #$key #$value)))
+                    alist)))
+
   (define run-command-gexp
     #~(run-command (append-map (lambda (arg)
                                  (if (command-line-binding? arg)
                                      (command-line-binding->args arg)
                                      (list arg)))
                                (build-command #$(assoc-ref cwl "baseCommand")
-                                              #$(vector-map coerce-argument
-                                                            (assoc-ref cwl "arguments"))
+                                              #$(vector->gexp
+                                                 (vector-map (compose alist->gexp coerce-argument)
+                                                             (assoc-ref cwl "arguments")))
                                               #$(assoc-ref cwl "inputs")
                                               inputs))
                    #$(coerce-expression (assoc-ref cwl "stdin"))