From 1c58262843fdf58520945bf531401de775a44a8b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 11 Oct 2024 01:22:25 +0100 Subject: 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. --- ravanan/workflow.scm | 7 +++++-- 1 file 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))) -- cgit v1.2.3