about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ravanan/command-line-tool.scm2
-rw-r--r--ravanan/store.scm14
-rw-r--r--ravanan/workflow.scm4
3 files changed, 7 insertions, 13 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index c47bb3c..84b6421 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -493,7 +493,7 @@ The returned G-expression will reference an @code{inputs-directory} variable."
      ((eq? (object-type input)
            'File)
       #~,(let ((path-in-inputs-directory
-                (expand-file-name #$(store-item-name (assoc-ref input "path"))
+                (expand-file-name #$(basename (assoc-ref input "path"))
                                   inputs-directory)))
            (copy-file #$(assoc-ref input "path")
                       path-in-inputs-directory)
diff --git a/ravanan/store.scm b/ravanan/store.scm
index 5cb4a64..00d26e6 100644
--- a/ravanan/store.scm
+++ b/ravanan/store.scm
@@ -31,8 +31,7 @@
             script->store-data-file
             script->store-stdout-file
             script->store-stderr-file
-            intern-file
-            store-item-name))
+            intern-file))
 
 (define %store-files-directory
   "files")
@@ -110,7 +109,8 @@ interned path and location."
                       (file-name-join* %store-files-directory
                                        (string-append sha1
                                                       "-"
-                                                      (basename path)))
+                                                      (basename path))
+                                       (basename path))
                       store)))
                 (if (file-exists? interned-path)
                     (format (current-error-port)
@@ -120,6 +120,7 @@ interned path and location."
                       (format (current-error-port)
                               "Interning ~a into store as ~a~%"
                               path interned-path)
+                      (mkdir (dirname interned-path))
                       ;; Hard link if on the same filesystem. Else, copy.
                       ((if (same-filesystem? path
                                              (expand-file-name %store-files-directory
@@ -140,11 +141,4 @@ interned path and location."
               (just (vector-map (cut intern-file <> store)
                                 secondary-files)))))))
 
-;; Length of a base-16 encoded SHA1 hash
-(define %store-hash-length 40)
 
-(define (store-item-name path)
-  "Return the basename of store item @var{path} with the store hash stripped out."
-  (string-drop (basename path)
-               ;; the hash and the dash after the hash
-               (1+ %store-hash-length)))
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 2770f31..5452ec4 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -455,8 +455,8 @@ files found into the @var{store} and return a tree of the fully resolved inputs.
     "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"))
+                  (string=? (basename (assoc-ref* candidate "path"))
+                            (secondary-path (basename (assoc-ref* input "path"))
                                             secondary-file)))
                 (or (assoc-ref input "secondaryFiles")
                     (user-error "Missing secondaryFiles in input ~a"