diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-06-23 16:35:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-06-27 23:42:20 +0200 |
commit | 0505eda9c7cf688757f6f8be8bc3e65ad9f0805e (patch) | |
tree | c7df1f68255275323aaa1d736eaf4711642a4f39 /tests/packages.scm | |
parent | 8e6c1415d87272c0221ce328715fc0dd1dd3e032 (diff) | |
download | guix-0505eda9c7cf688757f6f8be8bc3e65ad9f0805e.tar.gz |
packages: Recognize SHA3 and BLAKE2s for 'content-hash'.
* guix/packages.scm (build-content-hash): Add 'sha3-256', 'sha3-512', and 'blake2s-256'. * tests/packages.scm ("package-source-derivation, origin, sha3-512"): New test.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r-- | tests/packages.scm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index c7b6f669b5..26377b269b 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -524,6 +524,32 @@ (build-derivations %store (list drv)) (call-with-input-file output get-string-all))) +(test-equal "package-source-derivation, origin, sha3-512" + "hello, sha3" + (let* ((bash (search-bootstrap-binary "bash" (%current-system))) + (builder (add-text-to-store %store "my-fixed-builder.sh" + "echo -n hello, sha3 > $out" '())) + (method (lambda* (url hash-algo hash #:optional name + #:rest rest) + (and (eq? hash-algo 'sha3-512) + (raw-derivation name bash (list builder) + #:sources (list builder) + #:hash hash + #:hash-algo hash-algo)))) + (source (origin + (method method) + (uri "unused://") + (file-name "origin-sha3") + (hash (content-hash + (gcrypt:bytevector-hash (string->utf8 "hello, sha3") + (gcrypt:lookup-hash-algorithm + 'sha3-512)) + sha3-512)))) + (drv (package-source-derivation %store source)) + (output (derivation->output-path drv))) + (build-derivations %store (list drv)) + (call-with-input-file output get-string-all))) + (unless (network-reachable?) (test-skip 1)) (test-equal "package-source-derivation, snippet" "OK" |