[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/10: ui: 'warn-about-load-error' provides hints for unbound variables.
From: |
guix-commits |
Subject: |
03/10: ui: 'warn-about-load-error' provides hints for unbound variables. |
Date: |
Fri, 19 Jul 2019 19:32:30 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 723bdb8ef0175716a2bfa93e96c3fd757d7b2679
Author: Ludovic Courtès <address@hidden>
Date: Sat Jul 20 00:33:50 2019 +0200
ui: 'warn-about-load-error' provides hints for unbound variables.
* guix/ui.scm (warn-about-load-error): Add 'unbound-variable' clause.
* tests/guix-build.sh: Add test.
---
guix/ui.scm | 2 ++
tests/guix-build.sh | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index 1812b01..7920335 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -392,6 +392,8 @@ exiting. ARGS is the list of arguments received by the
'throw' handler."
(('syntax-error proc message properties form . rest)
(let ((loc (source-properties->location properties)))
(warning loc (G_ "~a~%") message)))
+ (('unbound-variable _ ...)
+ (report-unbound-variable-error args))
(('srfi-34 obj)
(if (message-condition? obj)
(warning (G_ "failed to load '~a': ~a~%")
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index d16b92d..37666ff 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -146,8 +146,8 @@ test `guix build -d --sources=transitive foo \
| wc -l` -eq 3
-# Unbound variables.
-cat > "$module_dir/foo.scm"<<EOF
+# Unbound variable in thunked field.
+cat > "$module_dir/foo.scm" <<EOF
(define-module (foo)
#:use-module (guix tests)
#:use-module (guix build-system trivial))
@@ -162,6 +162,21 @@ if guix build package-with-something-wrong -n; then false;
else true; fi
guix build package-with-something-wrong -n 2> "$module_dir/err" || true
grep "unbound" "$module_dir/err" # actual error
grep "forget.*(gnu packages base)" "$module_dir/err" # hint
+
+# Unbound variable at the top level.
+cat > "$module_dir/foo.scm" <<EOF
+(define-module (foo)
+ #:use-module (guix tests))
+
+(define-public foo
+ (dummy-package "package-with-something-wrong"
+ (build-system gnu-build-system))) ;unbound variable
+EOF
+
+guix build sed -n 2> "$module_dir/err"
+grep "unbound" "$module_dir/err" # actual error
+grep "forget.*(guix build-system gnu)" "$module_dir/err" # hint
+
rm -f "$module_dir"/*
# Wrong 'define-module' clause reported by 'warn-about-load-error'.
- branch master updated (dd9560a -> 3d33c93), guix-commits, 2019/07/19
- 01/10: gnu: python-jupyter-client: Patch file name of 'ip'., guix-commits, 2019/07/19
- 03/10: ui: 'warn-about-load-error' provides hints for unbound variables.,
guix-commits <=
- 02/10: ui: 'warn-about-load-error' warns about file/module name mismatches., guix-commits, 2019/07/19
- 04/10: gnu: Add emacs-zerodark-theme., guix-commits, 2019/07/19
- 05/10: lint: Update tests to (guix lint) migration., guix-commits, 2019/07/19
- 06/10: lint: 'source' check no longer complains about unavailable mirrors., guix-commits, 2019/07/19
- 08/10: lint: Remove unused imports., guix-commits, 2019/07/19
- 07/10: lint: Add test for 'source'., guix-commits, 2019/07/19
- 10/10: lint: Use the 'warning' procedure for messages., guix-commits, 2019/07/19
- 09/10: lint: source: Stop as soon as a valid URL is found., guix-commits, 2019/07/19