guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: download: Don't abbreviate things that are not store items.


From: Ludovic Courtès
Subject: 01/03: download: Don't abbreviate things that are not store items.
Date: Thu, 24 Sep 2015 20:16:31 +0000

civodul pushed a commit to branch master
in repository guix.

commit 75726135ce017f37ae57181e011ceea95c56dd3a
Author: Ludovic Courtès <address@hidden>
Date:   Thu Sep 24 21:54:37 2015 +0200

    download: Don't abbreviate things that are not store items.
    
    Fixes a regression introduced in a8be7b9a.
    
    * guix/build/download.scm (store-path-abbreviation): Return STORE-PATH
      if it's not an actual store path.  Fixes an out-of-range exception
      when running tests/substitute.scm and tests/store.scm.
---
 guix/build/download.scm |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/guix/build/download.scm b/guix/build/download.scm
index be4a581..4b7c53d 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -111,12 +111,15 @@ column."
     (string-append left padding right)))
 
 (define* (store-path-abbreviation store-path #:optional (prefix-length 6))
-  "Return an abbreviation of STORE-PATH for display, showing PREFIX-LENGTH
-characters of the hash."
-  (let ((base (basename store-path)))
-    (string-append (string-take base prefix-length)
-                   "…"
-                   (string-drop base 32))))
+  "If STORE-PATH is the file name of a store entry, return an abbreviation of
+STORE-PATH for display, showing PREFIX-LENGTH characters of the hash.
+Otherwise return STORE-PATH."
+  (if (string-prefix? (%store-directory) store-path)
+      (let ((base (basename store-path)))
+        (string-append (string-take base prefix-length)
+                       "…"
+                       (string-drop base 32)))
+      store-path))
 
 (define* (progress-proc file size
                         #:optional (log-port (current-output-port))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]