aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-09-11 23:13:26 +0100
committerArun Isaac2024-09-12 17:08:55 +0100
commit0276dd6e97404c73fa5e9479f70419b7574d0b7d (patch)
tree5c0030a95a71abd6346350e4815dd5f5f5891b29
parent90454030fbaa3f5709f496fa850223b833498286 (diff)
downloadravanan-0276dd6e97404c73fa5e9479f70419b7574d0b7d.tar.gz
ravanan-0276dd6e97404c73fa5e9479f70419b7574d0b7d.tar.lz
ravanan-0276dd6e97404c73fa5e9479f70419b7574d0b7d.zip
command-line-tool: Support File type staging entries.
* ravanan/command-line-tool.scm (build-command-line-tool-script): Support File type staging entries.
-rw-r--r--ravanan/command-line-tool.scm30
1 files changed, 23 insertions, 7 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index cfca932..0c8c292 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -683,9 +683,17 @@ named @var{name} with @var{inputs} using tools from Guix manifest
(assoc-ref* env-var-requirement "envDef"))))
(define (files-to-stage initial-work-dir-requirement)
- (vector-map->list (lambda (dirent)
- #~(list #$(coerce-expression (assoc-ref dirent "entryname"))
- #$(coerce-expression (assoc-ref dirent "entry"))))
+ (vector-map->list (lambda (listing-entry)
+ (if (string? listing-entry)
+ ;; File
+ #~(let ((entry #$(coerce-expression listing-entry)))
+ (list (assoc-ref entry "basename")
+ entry))
+ ;; Dirent
+ #~(list #$(coerce-expression
+ (assoc-ref listing-entry "entryname"))
+ #$(coerce-expression
+ (assoc-ref listing-entry "entry")))))
(assoc-ref initial-work-dir-requirement
"listing")))
@@ -917,12 +925,20 @@ named @var{name} with @var{inputs} using tools from Guix manifest
(call-with-current-directory outputs-directory
(lambda ()
;; Stage files.
- ;; We currently support Dirent only. TODO: Support
- ;; others.
+ ;; We currently support File and Dirent only. TODO:
+ ;; Support others.
(map (match-lambda
((entry-name entry)
- (call-with-output-file entry-name
- (cut put-string <> entry))))
+ (cond
+ ;; Stuff string literal into a file.
+ ((string? entry)
+ (call-with-input-file entry-name
+ (cut put-string <> entry)))
+ ;; Symlink to the file.
+ ((eq? (object-type entry)
+ 'File)
+ (symlink (assoc-ref entry "path")
+ entry-name)))))
(list #$@(from-maybe
(maybe-bind
(find-requirement requirements