Subject: Re: [PATCH v2 3/4] refresh: Support non-tarball sources.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 03 Jan 2022 14:55:19 +0100

Hi Maxime,

Thanks for the updated patch set!  Overall it LGTM.  I found this one
bug:

Maxime Devos <[email-masked]> skribis:

> From: Sarah Morgensen <[email-masked]>
>
> * guix/scripts/refresh.scm (update-package): Use 'file-hash*' instead of
> 'port-sha256'.  Rename TARBALL to OUTPUT.

[...]

> -                (let ((hash (call-with-input-file tarball
> -                              port-sha256)))
> +                (let ((hash (file-hash* output)))

This is incorrect because ‘file-hash*’ defaults to #:recursive? #t (IOW
it computes the hash of a nar containing OUTPUT instead of the hash of
OUTPUT).  You can see the problem for instance by running:

  ./pre-inst-env guix refresh -u mailutils && \
  ./pre-inst-env guix build -S mailutils
  # hash mismatch error

I think we need to check whether OUTPUT is a file or a directory and
pass #:recursive? accordingly.

WDYT?

Thanks,
Ludo’.