Subject: [bug#61322] [PATCH] status: Print a hint when a 'package-cache' hook fails to build.

From: zimoun <[email-masked]>
Date: Tue, 07 Feb 2023 12:56:05 +0100

Hi,

On Mon, 06 Feb 2023 at 15:13, Ludovic Courtès <[email-masked]> wrote:
> * guix/channels.scm (package-cache-file): Add 'channels' to the #:properties
> list.
> * guix/status.scm (print-build-event): Upon failure, display a hint when
> the derivation is a 'package-cache' hook.

Cool!  A minor comment.

> In this case the relevant bit in the build log is:
>
> --8<---------------cut here---------------start------------->8---
> In inria/hiepacs.scm:
>    879:41  3 (inputs #<package [email-masked] inria/hi?>)
> In ice-9/boot-9.scm:
>   1685:16  2 (raise-exception _ #:continuable? _)
>   1780:13  1 (_ #<&compound-exception components: (#<&undefined-vari?>)
> In unknown file:
>            0 (backtrace #<undefined>)
>
> (exception unbound-variable (value #f) (value "Unbound variable: ~S") (value (python2-numpy)) (value #f))
> --8<---------------cut here---------------end--------------->8---

[...]

> +     (let ((properties (and=> (false-if-exception
> +                               (read-derivation-from-file drv))
> +                              derivation-properties)))
> +       (when (and (pair? properties)
> +                  (eq? (assq-ref properties 'type) 'profile-hook)
> +                  (eq? (assq-ref properties 'hook) 'package-cache))
> +         (display-hint (format #f (G_ "This usually indicates a bug in one of
> +the channels you are pulling from, or some incompatibility among them.  You
> +can check the build log and report the issue to the channel developers.
> +
> +The channels you are pulling from are: ~a.")
> +                               (string-join
> +                                (map symbol->string
> +                                     (or (assq-ref properties 'channels)
> +                                         '(guix))))))))

Would it be possible to also detect and also display the unbound
variable, e.g., python2-numpy?

Cheers,
simon