[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
31/295: packages: Recognize SHA3 and BLAKE2s for 'content-hash'.
From: |
guix-commits |
Subject: |
31/295: packages: Recognize SHA3 and BLAKE2s for 'content-hash'. |
Date: |
Mon, 27 Jul 2020 06:25:10 -0400 (EDT) |
dannym pushed a commit to branch wip-desktop
in repository guix.
commit 0505eda9c7cf688757f6f8be8bc3e65ad9f0805e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Jun 23 16:35:58 2020 +0200
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.
---
guix/packages.scm | 5 ++++-
tests/packages.scm | 26 ++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index 1e0ec41..68ef718 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -191,7 +191,10 @@ its first argument has the right size for the chosen
algorithm."
(define-content-hash-constructor build-content-hash
(sha256 32)
- (sha512 64))
+ (sha512 64)
+ (sha3-256 32)
+ (sha3-512 64)
+ (blake2s-256 64))
(define-syntax content-hash
(lambda (s)
diff --git a/tests/packages.scm b/tests/packages.scm
index c7b6f66..26377b2 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"
- 13/295: gnu: Add python2-selectors2., (continued)
- 13/295: gnu: Add python2-selectors2., guix-commits, 2020/07/27
- 19/295: gnu: ilmbase: Update to 2.5.2., guix-commits, 2020/07/27
- 17/295: gnu: exempi: Delete the static library., guix-commits, 2020/07/27
- 14/295: gnu: python-greenlet: Update to 0.4.16., guix-commits, 2020/07/27
- 21/295: gnu: x265: Update to 3.4., guix-commits, 2020/07/27
- 22/295: gnu: Add emacs-browse-kill-ring., guix-commits, 2020/07/27
- 25/295: gnu: python-setproctitle: Fix indentation., guix-commits, 2020/07/27
- 23/295: gnu: Add r-shapforxgboost., guix-commits, 2020/07/27
- 28/295: daemon: Map directly to gcrypt hash functions., guix-commits, 2020/07/27
- 29/295: daemon: Remove OpenSSL hash compatibility wrappers., guix-commits, 2020/07/27
- 31/295: packages: Recognize SHA3 and BLAKE2s for 'content-hash'.,
guix-commits <=
- 32/295: gnu: libtiff: Use HTTPS., guix-commits, 2020/07/27
- 33/295: gnu: lxqt: Update to 0.15.0., guix-commits, 2020/07/27
- 39/295: gnu: r-renv: Update to 0.11.0., guix-commits, 2020/07/27
- 41/295: gnu: r-officer: Update to 0.3.12., guix-commits, 2020/07/27
- 43/295: gnu: r-raster: Update to 3.3-7., guix-commits, 2020/07/27
- 44/295: gnu: r-emmeans: Update to 1.4.8., guix-commits, 2020/07/27
- 82/295: gnu: Add rust-sha2-0.9., guix-commits, 2020/07/27
- 93/295: gnu: Rename rust-unicase-2.6 to rust-unicase-2., guix-commits, 2020/07/27
- 69/295: gnu: rust-block-padding-0.1: Don't skip build., guix-commits, 2020/07/27
- 67/295: gnu: Add rust-cpuid-bool-0.1., guix-commits, 2020/07/27