summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2024-09-13 06:00:39 +0100
committerArun Isaac2024-09-13 06:00:39 +0100
commit434bbd348ecf4631c890837894360d28af2f2e58 (patch)
tree3d35ce94c68d45af43a07e4bde0b80548e883c77
parent5f2f55e1ea609da53dd214ae54c90efeb45730be (diff)
downloadravanan-434bbd348ecf4631c890837894360d28af2f2e58.tar.gz
ravanan-434bbd348ecf4631c890837894360d28af2f2e58.tar.lz
ravanan-434bbd348ecf4631c890837894360d28af2f2e58.zip
command-line-tool: Add nameroot and nameext fields.
*
ravanan/command-line-tool.scm (resolve-inputs)[canonicalize-file-value],
(build-command-line-tool-script)[canonicalize-file-value]: Add
nameroot and nameext fields.
-rw-r--r--ravanan/command-line-tool.scm14
1 files changed, 9 insertions, 5 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index b0cb28d..a1ff88b 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -318,11 +318,11 @@ G-expressions are inserted."
 files found into the @var{store} and return a tree of the fully
 resolved inputs.
 
-The returned @code{File} type objects are updated with
-@code{basename}, @code{checksum} and @code{size} fields, and
-store-interned paths in the @code{location} and @code{path}
-fields. The @code{basename} field contains the basename of the
-original path, and not the store-interned path."
+The returned @code{File} type objects are updated with @code{basename},
+@code{nameroot}, @code{nameext}, @code{checksum} and @code{size} fields, and
+store-interned paths in the @code{location} and @code{path} fields. The
+@code{basename} field contains the basename of the original path, and not the
+store-interned path."
   (define (canonicalize-file-input input)
     "Canonicalize @code{File} type @var{input} and its secondary files."
     (let* ((path (or (and (assoc-ref input "location")
@@ -333,6 +333,8 @@ original path, and not the store-interned path."
         (cons "location" (just interned-path))
         (cons "path" (just interned-path))
         (cons "basename" (just (basename path)))
+        (cons "nameroot" (just (file-name-stem path)))
+        (cons "nameext" (just (file-name-extension path)))
         (cons "checksum" (just (checksum path)))
         (cons "size" (just (stat:size (stat path))))
         (cons "secondaryFiles"
@@ -854,6 +856,8 @@ named @var{name} with @var{inputs} using tools from Guix manifest
                                                     workflow-output-path))
                     (cons "path" workflow-output-path)
                     (cons "basename" (basename path))
+                    (cons "nameroot" (file-name-stem path))
+                    (cons "nameext" (file-name-extension path))
                     (cons "size" (stat:size (stat path)))
                     (cons "checksum" (checksum path)))))