summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-17 11:23:34 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-17 14:22:07 +0100
commitfd4c832bdbc4bc3e9479ad1bab6590d03ae78b60 (patch)
treed433dd8882cb342486141fa16662e5ab17891eda /guix
parent886a76073e4654449f413831897ffde736a07c91 (diff)
downloadpatches-fd4c832bdbc4bc3e9479ad1bab6590d03ae78b60.tar
patches-fd4c832bdbc4bc3e9479ad1bab6590d03ae78b60.tar.gz
lint: derivation: Adjust exception handling for Guile 3.
This makes sure the "derivation: invalid arguments" test passes on Guile 3.0.0. Without this change, the lint warning would only include the format string instead of the key and arguments. * guix/lint.scm (exception-with-kind-and-args?): New procedure. (check-derivation): Use it.
Diffstat (limited to 'guix')
-rw-r--r--guix/lint.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index d2f24c61f8..697bd24a1e 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -905,16 +905,31 @@ descriptions maintained upstream."
(origin-uris origin))
'())))
+(cond-expand
+ (guile-3
+ ;; Guile 3.0.0 does not export this predicate.
+ (define exception-with-kind-and-args?
+ (exception-predicate &exception-with-kind-and-args)))
+ (else ;Guile 2
+ (define exception-with-kind-and-args?
+ (const #f))))
+
(define (check-derivation package)
"Emit a warning if we fail to compile PACKAGE to a derivation."
(define (try system)
- (catch #t
+ (catch #t ;TODO: Remove 'catch' when Guile 2.x is no longer supported.
(lambda ()
(guard (c ((store-protocol-error? c)
(make-warning package
(G_ "failed to create ~a derivation: ~a")
(list system
(store-protocol-error-message c))))
+ ((exception-with-kind-and-args? c)
+ (make-warning package
+ (G_ "failed to create ~a derivation: ~s")
+ (list system
+ (cons (exception-kind c)
+ (exception-args c)))))
((message-condition? c)
(make-warning package
(G_ "failed to create ~a derivation: ~a")