diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-01-03 21:59:49 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-01-04 11:51:48 +0100 |
commit | ed63b7f87e88b0ce9c4a78bf0529599de9172b1f (patch) | |
tree | 5c40a3dcaf5c1efe1ff7e0155dbbc02552b509ba /guix/scripts/hash.scm | |
parent | d005f809f8209dfb3e4b4ee02b6f2beeb1d8f2e6 (diff) |
guix hash: Honor '-H' when used alongside '-r'.
* guix/scripts/hash.scm (guix-hash): When 'recursive? is true, use
'open-hash-port' instead of 'open-sha256-port'.
* tests/guix-hash.sh: Add test for 'guix hash -r -H sha512'.
Diffstat (limited to 'guix/scripts/hash.scm')
-rw-r--r-- | guix/scripts/hash.scm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index 797b99f053..b8622373cc 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de> @@ -151,7 +151,8 @@ and 'base16' ('hex' and 'hexadecimal' can be used as well).\n")) ;; Catch and gracefully report possible '&nar-error' conditions. (with-error-handling (if (assoc-ref opts 'recursive?) - (let-values (((port get-hash) (open-sha256-port))) + (let-values (((port get-hash) + (open-hash-port (assoc-ref opts 'hash-algorithm)))) (write-file file port #:select? select?) (force-output port) (get-hash)) |