From 9bacaf6df1fa3e2b1f66441ebc197906c9dafc5c Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 13 Apr 2024 01:34:42 +0100 Subject: 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. --- ccwl/ccwl.scm | 10 ++++++---- 1 file 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 ...))))))) -- cgit v1.2.3