summaryrefslogtreecommitdiff
path: root/guix/hash.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-07-24 19:56:35 +0200
commit706ae8e15c8d36b0aee7c19c54c143d3e17f5784 (patch)
treee9fe8ebfb1417d30979b5413165599f066a1c504 /guix/hash.scm
parent3e95125e9bd0676d4a9add9105217ad3eaef3ff0 (diff)
parent8440db459a10daa24282038f35bc0b6771bd51ab (diff)
downloadguix-patches-706ae8e15c8d36b0aee7c19c54c143d3e17f5784.tar
guix-patches-706ae8e15c8d36b0aee7c19c54c143d3e17f5784.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/hash.scm')
-rw-r--r--guix/hash.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/guix/hash.scm b/guix/hash.scm
index 39834043e1..8d7ba21425 100644
--- a/guix/hash.scm
+++ b/guix/hash.scm
@@ -101,6 +101,7 @@ output port."
(open-sha256-md))
(define digest #f)
+ (define position 0)
(define (finalize!)
(let ((ptr (md-read sha256-md 0)))
@@ -114,14 +115,18 @@ output port."
0)
(let ((ptr (bytevector->pointer bv offset)))
(md-write sha256-md ptr len)
+ (set! position (+ position len))
len)))
+ (define (get-position)
+ position)
+
(define (close)
(unless digest
(finalize!)))
(values (make-custom-binary-output-port "sha256"
- write! #f #f
+ write! get-position #f
close)
(lambda ()
(unless digest