diff options
author | Mark H Weaver <mhw@netris.org> | 2018-03-16 07:24:05 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2018-03-16 09:08:20 -0400 |
commit | daac9c77b9ed25a3c0edf843fdfe5e209ebef58f (patch) | |
tree | 1bd8d36a03a047919ced5a77504570c66439708f | |
parent | 2a69f48e0f86ec99575325e3b28b68c8ea220649 (diff) | |
download | patches-daac9c77b9ed25a3c0edf843fdfe5e209ebef58f.tar patches-daac9c77b9ed25a3c0edf843fdfe5e209ebef58f.tar.gz |
packages: Issue a warning unless the snippet returns #t.
* guix/packages.scm (patch-and-repack): Issue a warning if the snippet
returns a value other than #t.
-rw-r--r-- | guix/packages.scm | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index 0ee4f7104f..ab4b6278d6 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -566,19 +566,26 @@ specifies modules in scope when evaluating SNIPPET." (for-each apply-patch '#+patches) - (unless #+(if snippet - #~(let ((module (make-fresh-user-module))) - (module-use-interfaces! - module - (map resolve-interface '#+modules)) - ((@ (system base compile) compile) - '#+snippet - #:to 'value - #:opts %auto-compilation-options - #:env module)) - #~#t) - (format (current-error-port) - "snippet returned false, indicating failure~%")) + (let ((result #+(if snippet + #~(let ((module (make-fresh-user-module))) + (module-use-interfaces! + module + (map resolve-interface '#+modules)) + ((@ (system base compile) compile) + '#+snippet + #:to 'value + #:opts %auto-compilation-options + #:env module)) + #~#t))) + ;; Issue a warning unless the result is #t. + (unless (eqv? result #t) + (format (current-error-port) "\ +## WARNING: the snippet returned `~s'. Return values other than #t +## are deprecated. Please migrate this package so that its snippet +## reports errors by raising an exception, and otherwise returns #t.~%" + result)) + (unless result + (error "snippet returned false"))) (chdir "..") |