Subject: [bug#51307] [PATCH 0/2] guix hash: eases conversion

From: Ludovic Courtès <[email-masked]>
Date: Sat, 30 Oct 2021 16:48:45 +0200

zimoun <[email-masked]> skribis:

> * guix/scripts/hash.scm (guix-hash)[package?]: New procedure.
> [hash-to-display]: Use it.
> * tests/guix-hash.scm: New test.
> ---
>  guix/scripts/hash.scm | 19 +++++++++++++++++--
>  tests/guix-hash.sh    | 10 ++++++++++
>  2 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm
> index f3363549d3..4f0d41629f 100644
> --- a/guix/scripts/hash.scm
> +++ b/guix/scripts/hash.scm
> @@ -22,6 +22,9 @@
>  
>  (define-module (guix scripts hash)
>    #:use-module (gcrypt hash)
> +  #:use-module ((gnu packages) #:select (find-best-packages-by-name))
> +  #:use-module (guix packages)
> +  #:use-module ((guix utils) #:select (package-name->name+version))

I think I would prefer to keep (guix scripts hash) bare-bones, not
depending on the package machinery.

Most of the time one can run:

  guix hash $(guix build -S PACKAGE)

It’s not quite what you want if the package has patches or a snippet,
but that’s okay IMO.

WDYT?

Thanks,
Ludo’.