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

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Mon, 6 Feb 2023 14:15:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61322 in the body.
You can then email your comments to 61322 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#61322; Package guix-patches. (Mon, 06 Feb 2023 14:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 06 Feb 2023 14:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH] status: Print a hint when a 'package-cache' hook fails to
 build.
Date: Mon,  6 Feb 2023 15:13:52 +0100
* 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.
---
 guix/channels.scm |  9 +++++++--
 guix/status.scm   | 18 +++++++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

Hello!

This patch mitigates a longstanding user interface issue.  When pulling
from a channel set where one of them has an issue, such as a reference to
an unbound variable, you get something rather unhelpful like this:

--8<---------------cut here---------------start------------->8---
$ guix pull -C ~/.config/guix/hpc-channels.scm -p /tmp/chantest
Updating channel 'guix-hpc' from Git repository at 'https://gitlab.inria.fr/guix-hpc/guix-hpc.git'...
Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.org/git/guix.git'...
Authenticating channel 'guix', commits 9edb3f6 to a582d86 (64 new commits)...
Building from these channels:
  guix      https://git.savannah.gnu.org/git/guix.git	a582d86
  guix-hpc  https://gitlab.inria.fr/guix-hpc/guix-hpc.git	0e522d1

[...]

 guix-daemon  399B                               205KiB/s 00:00 [##################] 100.0%
 guix-a582d8634  14KiB                           1.2MiB/s 00:00 [##################] 100.0%
building /gnu/store/c4racwl5ns6vpyjsx1ad3fxh9n48g0pl-guix-hpc.drv...
building CA certificate bundle...
listing Emacs sub-directories...
building fonts directory...
building directory of Info manuals...
building profile with 2 packages...
building /gnu/store/p2a500wi4nvznq85sf08jych48lpfijl-inferior-script.scm.drv...
building package cache...
\builder for `/gnu/store/pm5crwjcclblmdh8y15jk6i5wxml6j9g-guix-package-cache.drv' failed to produce output path `/gnu/store/12x6ka57amgv28rdnkc2wsq3hs8gr6gw-guix-package-cache'
build of /gnu/store/pm5crwjcclblmdh8y15jk6i5wxml6j9g-guix-package-cache.drv failed
View build log at '/var/log/guix/drvs/pm/5crwjcclblmdh8y15jk6i5wxml6j9g-guix-package-cache.drv.gz'.
cannot build derivation `/gnu/store/06d4wla2l7qqldcaxif2qzgpsk377hvr-profile.drv': 1 dependencies couldn't be built
guix pull: error: build of `/gnu/store/06d4wla2l7qqldcaxif2qzgpsk377hvr-profile.drv' failed
--8<---------------cut here---------------end--------------->8---

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 pastix-nopython-notest <at> 6.0.3 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---

We probably cannot reliably “extract” the actual error from the build
log, but we can at least hint in the right direction.  This is what
this patch does.  Now you would get:

--8<---------------cut here---------------start------------->8---
build of /gnu/store/dib9aa6g0zn3cvv7hvfrby7cnmpyrw2m-guix-package-cache.drv failed
hint: 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: guix guix-hpc.

View build log at '/var/log/guix/drvs/di/b9aa6g0zn3cvv7hvfrby7cnmpyrw2m-guix-package-cache.drv.gz'.
cannot build derivation `/gnu/store/y11nksh5lhyj09zqszlg9pvg89wzpv5p-profile.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/y11nksh5lhyj09zqszlg9pvg89wzpv5p-profile.drv' failed
--8<---------------cut here---------------end--------------->8---

Thoughts?

Ludo’.

diff --git a/guix/channels.scm b/guix/channels.scm
index 40cbc4bb3a..d44e7a0a3a 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -952,6 +952,10 @@ (define build
                       (backtrace))))
               (mkdir #$output))))
 
+    (define channels
+      (map (compose string->symbol manifest-entry-name)
+           (manifest-entries manifest)))
+
     (gexp->derivation-in-inferior "guix-package-cache" build
                                   profile
 
@@ -960,8 +964,9 @@ (define build
                                   ;; instead of failing.
                                   #:silent-failure? #t
 
-                                  #:properties '((type . profile-hook)
-                                                 (hook . package-cache))
+                                  #:properties `((type . profile-hook)
+                                                 (hook . package-cache)
+                                                 (channels . ,channels))
                                   #:local-build? #t)))
 
 (define %channel-profile-hooks
diff --git a/guix/status.scm b/guix/status.scm
index 2c69f49fb5..5580c80ea9 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2017-2022 Ludovic Courtès <ludo <at> gnu.org>
+;;; Copyright © 2017-2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado <at> elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -22,6 +22,7 @@ (define-module (guix status)
   #:use-module (guix i18n)
   #:use-module (guix colors)
   #:use-module (guix progress)
+  #:autoload   (guix ui) (display-hint)
   #:autoload   (guix build syscalls) (terminal-columns)
   #:autoload   (guix build download) (nar-uri-abbreviation)
   #:use-module (guix store)
@@ -526,6 +527,21 @@ (define erase-current-line*
      (erase-current-line*)                      ;erase spinner or progress bar
      (format port (failure (G_ "build of ~a failed")) drv)
      (newline port)
+     (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))))))))
      (match (derivation-log-file drv)
        (#f
         (format port (failure (G_ "Could not find build log for '~a'."))

base-commit: 25947bbc3217306742694304fa9b6499f0126c7a
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#61322; Package guix-patches. (Tue, 07 Feb 2023 12:00:03 GMT) Full text and rfc822 format available.

Message #8 received at 61322 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>, 61322 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#61322] [PATCH] status: Print a hint when a 'package-cache'
 hook fails to build.
Date: Tue, 07 Feb 2023 12:56:05 +0100
Hi,

On Mon, 06 Feb 2023 at 15:13, Ludovic Courtès <ludo <at> gnu.org> 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 pastix-nopython-notest <at> 6.0.3 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




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Fri, 10 Feb 2023 23:15:01 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Fri, 10 Feb 2023 23:15:02 GMT) Full text and rfc822 format available.

Message #13 received at 61322-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 61322-done <at> debbugs.gnu.org
Subject: Re: bug#61322: [PATCH] status: Print a hint when a 'package-cache'
 hook fails to build.
Date: Sat, 11 Feb 2023 00:13:53 +0100
Hello!

zimoun <zimon.toutoune <at> gmail.com> skribis:

>> 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 pastix-nopython-notest <at> 6.0.3 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?

Nope.  As I wrote, I agree it would be nicer, but I don’t see how we
could reliably “extract” the actual error from the build log.

Pushed as 3ab8559436356ef89aa60135d3558681d64443ae.

Thanks for taking a look!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Mar 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.