about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-01-28 22:09:28 +0000
committerArun Isaac2026-01-28 23:01:20 +0000
commit41db9dc5ab7e14c8c0fb7d669a615c62c4008916 (patch)
tree8d24d64aedcd962029acf881ab99a06fc4306fdf
parent99a795badb938ba4e126138b0d72c6a23ea4de8c (diff)
downloadravanan-41db9dc5ab7e14c8c0fb7d669a615c62c4008916.tar.gz
ravanan-41db9dc5ab7e14c8c0fb7d669a615c62c4008916.tar.lz
ravanan-41db9dc5ab7e14c8c0fb7d669a615c62c4008916.zip
command-line-tool: Report unimplemented staging types. HEAD main
We report the implementation status as an error, rather than crash
with an incoherent backtrace.
-rw-r--r--ravanan/command-line-tool.scm47
1 files changed, 34 insertions, 13 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 8fa7d23..184d296 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -1,5 +1,5 @@
 ;;; ravanan --- High-reproducibility CWL runner powered by Guix
-;;; Copyright © 2024, 2025 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2024–2026 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ravanan.
 ;;;
@@ -829,23 +829,44 @@ directory of the workflow."
                                                secondary-files)))))))
 
                 ;; Stage files.
-                ;; We currently support File and Dirent only. TODO: Support others.
                 (define (stage-files entries outputs-directory)
                   ;; Stage entries and return an association list mapping files
                   ;; (presumably input files) that were staged.
                   (filter-map (match-lambda
                                 ((entry-name entry)
-                                 (cond
-                                  ;; Stuff string literal into a file.
-                                  ((string? entry)
-                                   (call-with-input-file entry-name
-                                     (cut put-string <> entry))
-                                   #f)
-                                  ;; Symlink to the file.
-                                  ((eq? (object-type entry)
-                                        'File)
-                                   (cons entry
-                                         (stage-file entry entry-name))))))
+                                 (let ((type (object-type entry)))
+                                   (cond
+                                    ;; Stuff string literal into a file.
+                                    ((eq? type 'string)
+                                     (call-with-input-file entry-name
+                                       (cut put-string <> entry))
+                                     #f)
+                                    ;; Symlink to the file.
+                                    ((eq? type 'File)
+                                     (cons entry
+                                           (stage-file entry entry-name)))
+                                    ;; TODO: Implement unimplemented staging
+                                    ;; types.
+                                    ((eq? type 'null)
+                                     (error "Staging null not implemented yet"
+                                            entry-name))
+                                    ((eq? type 'Directory)
+                                     (error "Staging Directory not implemented yet"
+                                            entry-name entry))
+                                    ((and (cwl-array-type? type)
+                                          (eq? (cwl-array-type-subtype type)
+                                               'File))
+                                     (error "Staging array of File objects not implemented yet"
+                                            entry-name entry))
+                                    ((and (cwl-array-type? type)
+                                          (eq? (cwl-array-type-subtype type)
+                                               'Directory))
+                                     (error "Staging array of Directory objects not implemented yet"
+                                            entry-name entry))
+                                    ;; Error out on invalid staging entry.
+                                    (else
+                                     (user-error "Invalid staging entry ~a: ~s"
+                                                 entry-name entry))))))
                               entries))
 
                 (define (set-staged-path input staging-mapping)