about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-04-13 01:34:42 +0100
committerArun Isaac2024-04-13 01:38:11 +0100
commit9bacaf6df1fa3e2b1f66441ebc197906c9dafc5c (patch)
tree40a2fb3bb2f750901d743a92ec7148c9cc163952
parentb73b787d0fe6843de65f1206270cff8de3333b83 (diff)
downloadccwl-9bacaf6df1fa3e2b1f66441ebc197906c9dafc5c.tar.gz
ccwl-9bacaf6df1fa3e2b1f66441ebc197906c9dafc5c.tar.lz
ccwl-9bacaf6df1fa3e2b1f66441ebc197906c9dafc5c.zip
ccwl: Restrict #:requirements parameter to YAML serializable trees.
This is in keeping with the way the #:other parameter is handled.

* ccwl/ccwl.scm (command, js-expression): Restrict #:requirements
parameter to YAML serializable trees.
-rw-r--r--ccwl/ccwl.scm10
1 files changed, 6 insertions, 4 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index d4f766b..3fc5364 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -468,12 +468,13 @@ identifiers defined in the commands."
                     (condition (ccwl-violation extra)
                                (formatted-message "Unexpected extra positional argument ~a in command definition"
                                                   (syntax->datum extra))))))))
-         (apply (syntax-lambda** (#:key stdin stderr stdout (requirements #''()) (other #'()) #:key* inputs outputs run)
+         (apply (syntax-lambda** (#:key stdin stderr stdout (requirements #'()) (other #'()) #:key* inputs outputs run)
                   (when (null? run)
                     (raise-exception
                      (condition (ccwl-violation x)
                                 (formatted-message "Missing ~a key in command definition"
                                                    #:run))))
+                  (ensure-yaml-serializable requirements "#:requirements")
                   (ensure-yaml-serializable other "#:other")
                   (let ((flattened-args (run-args run (map input-spec-id inputs))))
                     #`(make-command
@@ -513,7 +514,7 @@ identifiers defined in the commands."
                                          (formatted-message "Invalid #:stdout parameter ~a. #:stdout parameter must be a string"
                                                             (syntax->datum stdout))))
                              stdout)
-                       #,requirements
+                       '#,requirements
                        '#,other)))
                 #'(args ...)))))))
 
@@ -548,18 +549,19 @@ identifiers defined in the commands."
                     (condition (ccwl-violation extra)
                                (formatted-message "Unexpected extra positional argument ~a in js-expression definition"
                                                   (syntax->datum extra))))))))
-         (apply (syntax-lambda** (#:key expression (requirements #''()) (other #'()) #:key* inputs outputs)
+         (apply (syntax-lambda** (#:key expression (requirements #'()) (other #'()) #:key* inputs outputs)
                   (unless expression
                     (raise-exception
                      (condition (ccwl-violation x)
                                 (formatted-message "Missing ~a key in command definition"
                                                    #:expression))))
+                  (ensure-yaml-serializable requirements "#:requirements")
                   (ensure-yaml-serializable other "#:other")
                   #`(make-js-expression
                      (list #,@(map input inputs))
                      #,expression
                      (list #,@(map output outputs))
-                     #,requirements
+                     '#,requirements
                      '#,other))
                 #'(args ...)))))))