~ruther/guix-local

75726135ce017f37ae57181e011ceea95c56dd3a — Ludovic Courtès 10 years ago 7a8ac75
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.
1 files changed, 9 insertions(+), 6 deletions(-)

M guix/build/download.scm
M guix/build/download.scm => guix/build/download.scm +9 -6
@@ 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))