Message ID | 20230206141352.29287-1-ludo@gnu.org |
---|---|
State | New |
Headers | show |
Series | [bug#61322] status: Print a hint when a 'package-cache' hook fails to build. | expand |
Hi, On Mon, 06 Feb 2023 at 15:13, Ludovic Courtès <ludo@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@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
Hello! zimoun <zimon.toutoune@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@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’.
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@gnu.org> +;;; Copyright © 2017-2023 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@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'."))