derivations: Micro-optimize `derivation-hash'.

* guix/derivations.scm (derivation-hash): Use a UTF-8-encoded string
  output port.  This makes things deterministic, and slightly faster.
This commit is contained in:
Ludovic Courtès 2013-06-14 15:48:29 +02:00
parent 62751a5ddd
commit 0bd31a2188
1 changed files with 3 additions and 2 deletions

View File

@ -469,8 +469,9 @@ in SIZE bytes."
(drv (make-derivation outputs inputs sources (drv (make-derivation outputs inputs sources
system builder args env-vars))) system builder args env-vars)))
(sha256 (sha256
(string->utf8 (call-with-output-string (with-fluids ((%default-port-encoding "UTF-8"))
(cut write-derivation drv <>)))))))))) (string->utf8 (call-with-output-string
(cut write-derivation drv <>)))))))))))
(define (store-path type hash name) ; makeStorePath (define (store-path type hash name) ; makeStorePath
"Return the store path for NAME/HASH/TYPE." "Return the store path for NAME/HASH/TYPE."