diff mbox series

[bug#55911,v2] channels: Print backtrace when generating package cache fails.

Message ID 20220611165938.25093-1-dev@jpoiret.xyz
State Accepted
Headers show
Series [bug#55911,v2] channels: Print backtrace when generating package cache fails. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Josselin Poiret June 11, 2022, 4:59 p.m. UTC
* guix/channels.scm (package-cache-file): Add a throw handler around
the generate-package-cache call, and print backtrace in it.
---
IRC promptly pointed out that Guix has required Guile ver>=2 since way before
guix repl and guix pull were ever a thing, thus drop the Guile 1 compatibility
code.  Enjoy this v2

Best,
Josselin
 guix/channels.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Ludovic Courtès June 16, 2022, 9:10 a.m. UTC | #1
Hi Josselin,

Josselin Poiret <dev@jpoiret.xyz> skribis:

> * guix/channels.scm (package-cache-file): Add a throw handler around
> the generate-package-cache call, and print backtrace in it.
> ---
> IRC promptly pointed out that Guix has required Guile ver>=2 since way before
> guix repl and guix pull were ever a thing, thus drop the Guile 1 compatibility
> code.  Enjoy this v2

That’s a good idea.  Applied!

Thanks for the patch and for paying attention to compatibility!

Ludo’.
diff mbox series

Patch

diff --git a/guix/channels.scm b/guix/channels.scm
index 20f347d34f..fde425327d 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -911,7 +911,14 @@  (define build
                 (format (current-error-port)
                         "Generating package cache for '~a'...~%"
                         #$profile)
-                (generate-package-cache #$output))
+                ;; This script runs through (primitive-load), which by default
+                ;; doesn't print backtraces when it encounters an exception,
+                ;; so manually do it.  Use with-throw-handler because it is
+                ;; supported by all Guile versions.
+                (with-throw-handler #t
+                  (lambda () (generate-package-cache #$output))
+                  (lambda (key . args)
+                      (backtrace))))
               (mkdir #$output))))
 
     (gexp->derivation-in-inferior "guix-package-cache" build