From 18ae1ec3ecfe22d55d6cdf595a442afebbc5595a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 18 May 2020 22:10:20 +0200 Subject: guix hash, guix download: Add '--hash'. * guix/scripts/download.scm (%default-options): Add 'hash-algorithm'. (show-help, %options): Add "--hash". (guix-download): Honor it. * guix/scripts/hash.scm (%default-options): Add 'hash-algorithm'. (show-help, %options): Add "--hash". (guix-hash): Honor it. * tests/guix-hash.sh: Test '-H sha512'. * doc/guix.texi (Invoking guix download): Document it. (Invoking guix hash): Document it. --- tests/guix-hash.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/guix-hash.sh b/tests/guix-hash.sh index 190c9e7f8a..1c595b49ed 100644 --- a/tests/guix-hash.sh +++ b/tests/guix-hash.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2013, 2014, 2016 Ludovic Courtès +# Copyright © 2013, 2014, 2016, 2020 Ludovic Courtès # Copyright © 2016 Jan Nieuwenhuizen # # This file is part of GNU Guix. @@ -31,6 +31,10 @@ test `echo -n | guix hash -` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9 test `guix hash -f nix-base32 /dev/null` = 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73 test `guix hash -f hex /dev/null` = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 test `guix hash -f base32 /dev/null` = 4oymiquy7qobjgx36tejs35zeqt24qpemsnzgtfeswmrw6csxbkq +test `guix hash -H sha512 -f hex /dev/null` = cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e + +if guix hash -H abcd1234 /dev/null; +then false; else true; fi mkdir "$tmpdir" echo -n executable > "$tmpdir/exe" -- cgit v1.2.3