summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-06-14 15:48:29 +0200
committerLudovic Courtès <ludo@gnu.org>2013-06-14 15:48:29 +0200
commit0bd31a2188b6ee29b6280f58a577799d73a07ecf (patch)
tree6e27482e7b8dd5d421dd64ee6b5a32c2da6bef1f
parent62751a5ddd6e15cf80800f3549cfe3224c84a097 (diff)
downloadguix-0bd31a2188b6ee29b6280f58a577799d73a07ecf.tar.gz
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.
-rw-r--r--guix/derivations.scm5
1 files changed, 3 insertions, 2 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index cf329819c4..3c433a2685 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -469,8 +469,9 @@ in SIZE bytes."
               (drv    (make-derivation outputs inputs sources
                                        system builder args env-vars)))
          (sha256
-          (string->utf8 (call-with-output-string
-                         (cut write-derivation drv <>))))))))))
+          (with-fluids ((%default-port-encoding "UTF-8"))
+            (string->utf8 (call-with-output-string
+                           (cut write-derivation drv <>)))))))))))
 
 (define (store-path type hash name)               ; makeStorePath
   "Return the store path for NAME/HASH/TYPE."