diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-02-20 12:25:14 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-02-20 23:18:08 +0100 |
commit | c6d37be9511f6f10b766541977311341a9115ee9 (patch) | |
tree | f077a83f1cdcd7f6a577fb4b4488a0ac7c63ebd9 | |
parent | 62d4575de2871cbd97157a12fcbcce63a460d93b (diff) | |
download | patches-c6d37be9511f6f10b766541977311341a9115ee9.tar patches-c6d37be9511f6f10b766541977311341a9115ee9.tar.gz |
guix hash: Don't load the whole file in memory.
* guix/scripts/hash.scm (guix-hash)[eof->null]: Remove.
(guix-hash): Use 'port-sha256' to compute the hash instead of
'get-bytevector-all' and co.
-rw-r--r-- | guix/scripts/hash.scm | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index ca3928b8e3..4e66aa0f3e 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; ;;; This file is part of GNU Guix. @@ -99,11 +99,6 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16' (alist-cons 'argument arg result)) %default-options)) - (define (eof->null x) - (if (eof-object? x) - #vu8() - x)) - (let* ((opts (parse-options)) (args (filter-map (match-lambda (('argument . value) @@ -117,8 +112,7 @@ Supported formats: 'nix-base32' (default), 'base32', and 'base16' (catch 'system-error (lambda () (format #t "~a~%" - (call-with-input-file file - (compose fmt sha256 eof->null get-bytevector-all)))) + (fmt (call-with-input-file file port-sha256)))) (lambda args (leave (_ "~a~%") (strerror (system-error-errno args)))))) |