guix package: "guix package -f FILE" ensures FILE returns a package.

* guix/scripts/package.scm (options->installable): Add clause for
'install option with a non-package object.
* tests/guix-package.sh: Add test.
This commit is contained in:
Ludovic Courtès 2019-09-18 14:55:44 +02:00
parent cf48ea9539
commit f9c0400392
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 16 additions and 1 deletions

View File

@ -607,7 +607,11 @@ and upgrades."
(let-values (((package output)
(specification->package+output spec)))
(package->manifest-entry* package output))))
(_ #f))
(('install . obj)
(leave (G_ "cannot install non-package object: ~s~%")
obj))
(_
#f))
opts))
(fold manifest-transaction-install-entry

View File

@ -331,6 +331,17 @@ cat > "$module_dir/package.scm"<<EOF
EOF
guix package --bootstrap --install-from-file="$module_dir/package.scm"
# Make sure an error is raised if the file doesn't return a package.
cat > "$module_dir/package.scm"<<EOF
(use-modules (gnu packages base))
(define my-package coreutils) ;returns *unspecified*
EOF
if guix package --bootstrap --install-from-file="$module_dir/package.scm"
then false; else true; fi
rm "$module_dir/package.scm"
# This one should not show up in searches since it's no supported on the
# current system.
test "`guix package -A super-non-portable-emacs`" = ""