mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-05-26 11:01:48 +02:00
gnu: Improve error reporting of the use-.*modules macros.
Suggested by Julien Lepiller and myglc2 at <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00106.html>. * gnu.scm (%try-use-modules): New procedure. (package-module-hint, service-module-hint): New procedures. (try-use-modules): New macro. (use-package-modules, use-service-modules, use-system-modules): Use it. * tests/guix-system.sh: Test it.
This commit is contained in:
@@ -68,6 +68,34 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Reporting of module not found errors.
|
||||
|
||||
cat > "$tmpfile" <<EOF
|
||||
;; Line 1.
|
||||
(use-modules (gnu))
|
||||
(use-service-modules openssh)
|
||||
EOF
|
||||
|
||||
if guix system build "$tmpfile" -n 2> "$errorfile"
|
||||
then false
|
||||
else
|
||||
grep "$tmpfile:3:2: .*module .*openssh.*not found" "$errorfile"
|
||||
grep "Try.*use-service-modules ssh" "$errorfile"
|
||||
fi
|
||||
|
||||
cat > "$tmpfile" <<EOF
|
||||
;; Line 1.
|
||||
(use-modules (gnu))
|
||||
(use-package-modules qemu)
|
||||
EOF
|
||||
|
||||
if guix system build "$tmpfile" -n 2> "$errorfile"
|
||||
then false
|
||||
else
|
||||
grep "$tmpfile:3:2: .*module .*qemu.*not found" "$errorfile"
|
||||
grep "Try.*use-package-modules virtualization" "$errorfile"
|
||||
fi
|
||||
|
||||
# Reporting of unbound variables.
|
||||
|
||||
cat > "$tmpfile" <<EOF
|
||||
|
||||
Reference in New Issue
Block a user