Subject: [bug#45601] [PATCH] gnu: Add wyhash.

From: Leo Famulari <[email-masked]>
Date: Sun, 3 Jan 2021 21:07:55 -0500

On Fri, Jan 01, 2021 at 09:19:29PM +0000, Ryan Prior via Guix-patches via wrote:
> * gnu/packages/datastructures.scm (wyhash): New variable.

Thanks!

Pushed as 4a829b2d55bc9b0ad5a335c8228a7d2371fa1d9a with the following
changes...

I corrected the commit message (changing "datastructures.scm" to
"digest.scm"), tweaked the logic of the builder to be more idiomatic,
and removed the period at the end of the synopsis (`guix lint`
complained).

> +       #:builder
> +       (begin
> +         (use-modules (guix build utils))
> +         (let* ((out (string-append (assoc-ref %outputs "out")))
> +                (src (string-append out "/include"))
> +                (doc (string-append out "/share/doc/" ,name "-" ,version)))
> +           (mkdir-p src)
> +           (mkdir-p doc)
> +           (chdir (assoc-ref %build-inputs "source"))
> +           (install-file "wyhash.h" src)
> +           (install-file "LICENSE" doc)
> +           (install-file "README.md" doc))
> +         #t)))

Regarding the builder:

1) install-file does mkdir-p [0], so that can be omitted.
2) I think it's more clear to use "include" rather than "src" when
binding the output's include directory
3) Using with-directory-excursion instead of chdir is more in tune with
a functional coding style [1], in my opinion

[0]
https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm?h=version-1.2.0#n310

[1]
https://guix.gnu.org/manual/en/html_node/Programming-Paradigm.html