[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/11: compile: Report the name of the file that cannot be compiled.
From: |
guix-commits |
Subject: |
01/11: compile: Report the name of the file that cannot be compiled. |
Date: |
Mon, 15 Jul 2019 04:18:16 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 38302bd9392cc9518b04e2726cf6a38ee75922cc
Author: Ludovic Courtès <address@hidden>
Date: Sun Jul 14 17:07:09 2019 +0200
compile: Report the name of the file that cannot be compiled.
Fixes <https://bugs.gnu.org/36640>.
Reported by Robert Vollmert <address@hidden>.
* guix/build/compile.scm (call/exit-on-exception): Add 'file' parameter
and honor it.
(exit-on-exception): Likewise.
(compile-files): Pass FILE to 'exit-on-exception'.
---
guix/build/compile.scm | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/guix/build/compile.scm b/guix/build/compile.scm
index 29865f2..c127456 100644
--- a/guix/build/compile.scm
+++ b/guix/build/compile.scm
@@ -129,8 +129,9 @@ front."
(lambda ()
(set! path initial-value)))))
-(define (call/exit-on-exception thunk)
- "Evaluate THUNK and exit right away if an exception is thrown."
+(define (call/exit-on-exception file thunk)
+ "Evaluate THUNK and exit right away if an exception is thrown. Report FILE
+as the file that was being compiled when the exception was thrown."
(catch #t
thunk
(const #f)
@@ -141,15 +142,18 @@ front."
(stack (make-stack #t))
(depth (stack-length stack))
(frame (and (> depth 1) (stack-ref stack 1))))
+ (newline port)
+ (format port "error: failed to compile '~a':~%~%" file)
(false-if-exception (display-backtrace stack port))
(print-exception port frame key args)))
;; Don't go any further.
(primitive-exit 1))))
-(define-syntax-rule (exit-on-exception exp ...)
- "Evaluate EXP and exit if an exception is thrown."
- (call/exit-on-exception (lambda () exp ...)))
+(define-syntax-rule (exit-on-exception file exp ...)
+ "Evaluate EXP and exit if an exception is thrown. Report FILE as the faulty
+file when an exception is thrown."
+ (call/exit-on-exception file (lambda () exp ...)))
(define* (compile-files source-directory build-directory files
#:key
@@ -173,6 +177,7 @@ files are for HOST, a GNU triplet such as
\"x86_64-linux-gnu\"."
;; Exit as soon as something goes wrong.
(exit-on-exception
+ file
(with-target host
(lambda ()
(let ((relative (relative-file source-directory file)))
- branch master updated (2f3c0fb -> 9af75a2), guix-commits, 2019/07/15
- 02/11: syscalls: Use 'define-as-needed' for 'AT_' constants introduced in Guile 2.2.5., guix-commits, 2019/07/15
- 01/11: compile: Report the name of the file that cannot be compiled.,
guix-commits <=
- 06/11: download: Use the new 'derivation' calling convention., guix-commits, 2019/07/15
- 03/11: derivations: 'derivation' primitive accepts <derivation> and #:sources., guix-commits, 2019/07/15
- 05/11: gnu: guile-bootstrap: Use the new 'derivation' calling convention., guix-commits, 2019/07/15
- 07/11: derivations: 'map-derivation' uses the new 'derivation' calling convention., guix-commits, 2019/07/15
- 10/11: gexp: 'lowered-gexp-guile' now returns a <derivation-input>., guix-commits, 2019/07/15
- 04/11: gexp: <lowered-gexp> separates sources from derivation inputs., guix-commits, 2019/07/15
- 09/11: derivations: Deprecate the previous calling convention., guix-commits, 2019/07/15
- 11/11: channels: Avoid use of 'derivation-input-path'., guix-commits, 2019/07/15
- 08/11: derivations: Update tests to use new calling convention., guix-commits, 2019/07/15