guix package: --manifest DTRT when combined with --dry-run.

* guix/scripts/package.scm (guix-package)[process-actions]: Process 'manifest
  action regardless of whether 'dry-run? is set.  Adjust the message
  accordingly.
* tests/guix-package.sh: Add error-reporting test.
This commit is contained in:
Ludovic Courtès 2015-05-25 19:33:19 +02:00
parent 2abcc97fd1
commit 5f1087c481
2 changed files with 25 additions and 7 deletions

View File

@ -886,14 +886,16 @@ more information.~%"))
(alist-delete 'delete-generations opts))) (alist-delete 'delete-generations opts)))
(_ #f)) (_ #f))
opts)) opts))
((and (assoc-ref opts 'manifest) ((assoc-ref opts 'manifest)
(not dry-run?))
(let* ((file-name (assoc-ref opts 'manifest)) (let* ((file-name (assoc-ref opts 'manifest))
(user-module (make-user-module '((guix profiles) (user-module (make-user-module '((guix profiles)
(gnu)))) (gnu))))
(manifest (load* file-name user-module))) (manifest (load* file-name user-module)))
(format #t (_ "installing new manifest from ~a with ~d entries.~%") (if (assoc-ref opts 'dry-run?)
(format #t (_ "would install new manifest from '~a' with ~d entries~%")
file-name (length (manifest-entries manifest))) file-name (length (manifest-entries manifest)))
(format #t (_ "installing new manifest from '~a' with ~d entries~%")
file-name (length (manifest-entries manifest))))
(build-and-use-profile manifest))) (build-and-use-profile manifest)))
(else (else
(let* ((manifest (profile-manifest profile)) (let* ((manifest (profile-manifest profile))

View File

@ -245,7 +245,7 @@ guix package -I
unset GUIX_BUILD_OPTIONS unset GUIX_BUILD_OPTIONS
# Applying a manifest file # Applying a manifest file.
cat > "$module_dir/manifest.scm"<<EOF cat > "$module_dir/manifest.scm"<<EOF
(use-package-modules bootstrap) (use-package-modules bootstrap)
@ -254,3 +254,19 @@ EOF
guix package --bootstrap -m "$module_dir/manifest.scm" guix package --bootstrap -m "$module_dir/manifest.scm"
guix package -I | grep guile guix package -I | grep guile
test `guix package -I | wc -l` -eq 1 test `guix package -I | wc -l` -eq 1
# Error reporting.
cat > "$module_dir/manifest.scm"<<EOF
(use-package-modules bootstrap)
(packages->manifest
(list %bootstrap-guile
wonderful-package-that-does-not-exist))
EOF
if guix package --bootstrap -n -m "$module_dir/manifest.scm" \
2> "$module_dir/stderr"
then false
else
cat "$module_dir/stderr"
grep "manifest.scm:[1-3]:.*[Uu]nbound variable.*wonderful-package" \
"$module_dir/stderr"
fi