[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/06: gnu-build: Issue a warning unless every phase returns #t.
From: |
Mark H. Weaver |
Subject: |
02/06: gnu-build: Issue a warning unless every phase returns #t. |
Date: |
Fri, 16 Mar 2018 09:09:34 -0400 (EDT) |
mhw pushed a commit to branch core-updates
in repository guix.
commit d8a3b1b9e847d4a44d2695f95af77170d4d2788f
Author: Mark H Weaver <address@hidden>
Date: Fri Mar 16 07:26:13 2018 -0400
gnu-build: Issue a warning unless every phase returns #t.
* guix/build/gnu-build-system.scm (gnu-build): Issue a warning if a phase
returns a value other than #t.
---
guix/build/gnu-build-system.scm | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index f49de0e..18d76a3 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -746,17 +746,26 @@ in order. Return #t if all the PHASES succeeded, #f
otherwise."
;; The trick is to #:allow-other-keys everywhere, so that each procedure in
;; PHASES can pick the keyword arguments it's interested in.
- (every (match-lambda
- ((name . proc)
- (let ((start (current-time time-monotonic)))
- (format #t "starting phase `~a'~%" name)
- (let ((result (apply proc args))
- (end (current-time time-monotonic)))
- (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f
seconds~%"
- name result
- (elapsed-time end start))
-
- ;; Dump the environment variables as a shell script, for handy
debugging.
- (system "export > $NIX_BUILD_TOP/environment-variables")
- result))))
- phases))
+ (for-each (match-lambda
+ ((name . proc)
+ (let ((start (current-time time-monotonic)))
+ (format #t "starting phase `~a'~%" name)
+ (let ((result (apply proc args))
+ (end (current-time time-monotonic)))
+ (format #t "phase `~a' ~:[failed~;succeeded~] after ~,1f
seconds~%"
+ name result
+ (elapsed-time end start))
+
+ ;; Issue a warning unless the result is #t.
+ (unless (eqv? result #t)
+ (format (current-error-port) "\
+## WARNING: phase `~a' returned `~s'. Return values other than #t
+## are deprecated. Please migrate this package so that its phase
+## procedures report errors by raising an exception, and otherwise
+## always return #t.~%"
+ name result))
+
+ ;; Dump the environment variables as a shell script, for
handy debugging.
+ (system "export > $NIX_BUILD_TOP/environment-variables")
+ result))))
+ phases))
- branch core-updates updated (2a69f48 -> 60ff6ec), Mark H. Weaver, 2018/03/16
- 01/06: packages: Issue a warning unless the snippet returns #t., Mark H. Weaver, 2018/03/16
- 02/06: gnu-build: Issue a warning unless every phase returns #t.,
Mark H. Weaver <=
- 03/06: gnu: cross-base: Return #t from all phases., Mark H. Weaver, 2018/03/16
- 05/06: gnu: libstdc++: Return #t from chdir phase., Mark H. Weaver, 2018/03/16
- 06/06: gettext-boot0: Return #t from chdir phase., Mark H. Weaver, 2018/03/16
- 04/06: gnu: All snippets report errors using exceptions, else return #t., Mark H. Weaver, 2018/03/16