Move `sha256' to (guix utils).

* guix/derivations.scm (sha256): Move to...
* guix/utils.scm (sha256): ... here.
This commit is contained in:
Ludovic Courtès 2012-06-01 23:29:55 +02:00
parent e87088c9d5
commit d0a92b7531
2 changed files with 14 additions and 7 deletions

View file

@ -25,9 +25,6 @@ (define-module (guix derivations)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 rdelim) #:use-module (ice-9 rdelim)
#:use-module (guix store) #:use-module (guix store)
#:use-module ((chop hash)
#:select (bytevector-hash
hash-method/sha256))
#:export (derivation? #:export (derivation?
derivation-outputs derivation-outputs
derivation-inputs derivation-inputs
@ -187,9 +184,6 @@ (define (write-list lst)
env-vars)) env-vars))
(display ")" port)))) (display ")" port))))
(define (sha256 bv)
"Return the SHA256 of BV as a bytevector."
(bytevector-hash hash-method/sha256 bv))
(define (derivation-hash drv) ; `hashDerivationModulo' in derivations.cc (define (derivation-hash drv) ; `hashDerivationModulo' in derivations.cc
"Return the hash of DRV, modulo its fixed-output inputs, as a bytevector." "Return the hash of DRV, modulo its fixed-output inputs, as a bytevector."

View file

@ -19,9 +19,13 @@
(define-module (guix utils) (define-module (guix utils)
#:use-module (srfi srfi-60) #:use-module (srfi srfi-60)
#:use-module (rnrs bytevectors) #:use-module (rnrs bytevectors)
#:use-module ((chop hash)
#:select (bytevector-hash
hash-method/sha256))
#:export (bytevector-quintet-length #:export (bytevector-quintet-length
bytevector->base32-string bytevector->base32-string
bytevector->nix-base32-string)) bytevector->nix-base32-string
sha256))
(define bytevector-quintet-ref (define bytevector-quintet-ref
(let* ((ref bytevector-u8-ref) (let* ((ref bytevector-u8-ref)
@ -98,3 +102,12 @@ (define bytevector->base32-string
(define bytevector->nix-base32-string (define bytevector->nix-base32-string
(make-bytevector->base32-string %nix-base32-chars)) (make-bytevector->base32-string %nix-base32-chars))
;;;
;;; Hash.
;;;
(define (sha256 bv)
"Return the SHA256 of BV as a bytevector."
(bytevector-hash hash-method/sha256 bv))