Skip to content
Snippets Groups Projects
Unverified Commit f9c04003 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

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.
parent cf48ea95
No related branches found
No related tags found
No related merge requests found
...@@ -607,7 +607,11 @@ (define to-install ...@@ -607,7 +607,11 @@ (define to-install
(let-values (((package output) (let-values (((package output)
(specification->package+output spec))) (specification->package+output spec)))
(package->manifest-entry* package output)))) (package->manifest-entry* package output))))
(_ #f)) (('install . obj)
(leave (G_ "cannot install non-package object: ~s~%")
obj))
(_
#f))
opts)) opts))
(fold manifest-transaction-install-entry (fold manifest-transaction-install-entry
......
...@@ -331,6 +331,17 @@ cat > "$module_dir/package.scm"<<EOF ...@@ -331,6 +331,17 @@ cat > "$module_dir/package.scm"<<EOF
EOF EOF
guix package --bootstrap --install-from-file="$module_dir/package.scm" 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 # This one should not show up in searches since it's no supported on the
# current system. # current system.
test "`guix package -A super-non-portable-emacs`" = "" test "`guix package -A super-non-portable-emacs`" = ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment