about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2025-04-23 01:19:50 +0100
committerArun Isaac2025-04-23 01:29:36 +0100
commit378b7c09ed1a16ac17b03793c14dcd236c5eafe0 (patch)
tree03cb7456a6847734f1851f529c2edd7348282f53
parent26d44d5b1bce2248608dec162021c9f71d1145c3 (diff)
downloadravanan-378b7c09ed1a16ac17b03793c14dcd236c5eafe0.tar.gz
ravanan-378b7c09ed1a16ac17b03793c14dcd236c5eafe0.tar.lz
ravanan-378b7c09ed1a16ac17b03793c14dcd236c5eafe0.zip
workflow: Use secondary-path.
* ravanan/workflow.scm (resolve-inputs)[match-secondary-file-pattern]:
Accept secondary-file. Call secondary-path.
[check-secondary-files]: Pass secondary-file, instead of just the
pattern, to match-secondary-file-pattern.
-rw-r--r--ravanan/workflow.scm26
1 files changed, 12 insertions, 14 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index fff69f5..2770f31 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -451,14 +451,13 @@ is the class of the workflow."
 (define (resolve-inputs inputs formal-inputs store)
   "Traverse @var{inputs} and @var{formal-inputs} recursively, intern any
 files found into the @var{store} and return a tree of the fully resolved inputs."
-  (define (match-secondary-file-pattern input pattern)
-    "Return @code{#t} if secondary file @var{pattern} matches at least one secondary
-file in @var{input}."
-    ;; TODO: Implement caret characters in SecondaryFileSchema DSL.
-    (vector-any (lambda (secondary-file)
-                  (string=? (store-item-name (assoc-ref* secondary-file "path"))
-                            (string-append (store-item-name (assoc-ref* input "path"))
-                                           pattern)))
+  (define (match-secondary-file-pattern input secondary-file)
+    "Return @code{#t} if @var{secondary-file} matches at least one secondary file in
+@var{input}."
+    (vector-any (lambda (candidate)
+                  (string=? (store-item-name (assoc-ref* candidate "path"))
+                            (secondary-path (store-item-name (assoc-ref* input "path"))
+                                            secondary-file)))
                 (or (assoc-ref input "secondaryFiles")
                     (user-error "Missing secondaryFiles in input ~a"
                                 input))))
@@ -467,12 +466,11 @@ file in @var{input}."
     "Check if all required @var{secondary-files} are present in @var{input}. If not,
 error out."
     (vector-for-each (lambda (secondary-file)
-                       (let ((pattern (assoc-ref* secondary-file "pattern")))
-                         (when (and (assoc-ref* secondary-file "required")
-                                    (not (match-secondary-file-pattern input pattern)))
-                           (user-error "Secondary file ~a missing in input ~a"
-                                       pattern
-                                       input))))
+                       (when (and (assoc-ref* secondary-file "required")
+                                  (not (match-secondary-file-pattern input secondary-file)))
+                         (user-error "Secondary file ~a missing in input ~a"
+                                     (assoc-ref* secondary-file "pattern")
+                                     input)))
                      secondary-files))
 
   (define (resolve inputs types maybe-secondary-files)