From 3cd7ea8e2545cf46c2c5715462924e03a80e89ee Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 26 Jun 2025 19:02:18 +0100 Subject: 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. --- ravanan/command-line-tool.scm | 18 ++++++++++++++++-- 1 file 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")) -- cgit v1.2.3