aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-10-11 01:22:25 +0100
committerArun Isaac2024-10-11 01:23:32 +0100
commit1c58262843fdf58520945bf531401de775a44a8b (patch)
tree6e1d54683ad0398e6cbb07b275b9e7f78d4e15c4
parent2f3a764de2e12103cbb9c1fab43b67deaa5623df (diff)
downloadravanan-1c58262843fdf58520945bf531401de775a44a8b.tar.gz
ravanan-1c58262843fdf58520945bf531401de775a44a8b.tar.lz
ravanan-1c58262843fdf58520945bf531401de775a44a8b.zip
workflow: Do not re-intern files that have already been interned.
* ravanan/workflow.scm (intern-file): Do not re-intern files that have already been interned into the store.
-rw-r--r--ravanan/workflow.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index 1656e1e..9877876 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -460,7 +460,9 @@ interned path and location."
(if (string-prefix? store path)
;; If file is already a store path, return it as is.
path
- ;; Else, intern it and return the interned path.
+ ;; Else, intern it if it isn't already and return the interned
+ ;; path. Not re-interning already interned files saves us a lot of
+ ;; time especially with large files.
(let ((interned-path
(expand-file-name
(file-name-join* %store-files-directory
@@ -468,7 +470,8 @@ interned path and location."
"-"
(basename path)))
store)))
- (copy-file path interned-path)
+ (unless (file-exists? interned-path)
+ (copy-file path interned-path))
interned-path))))
(maybe-assoc-set file
(cons "location" (just (string-append "file://" interned-path)))