summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-18 14:55:44 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-18 23:08:28 +0200
commitf9c0400392843540a87985a67ffb9fb6e4dbc2fa (patch)
tree66e294cc022f4383d2f64b7dbfc9ccd567082ef4
parentcf48ea9539020bd6300033a8910ca951225582e6 (diff)
downloadguix-f9c0400392843540a87985a67ffb9fb6e4dbc2fa.tar.gz
guix-f9c0400392843540a87985a67ffb9fb6e4dbc2fa.tar.xz
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.
-rw-r--r--guix/scripts/package.scm6
-rw-r--r--tests/guix-package.sh11
2 files changed, 16 insertions, 1 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a43c96516f..21737f43da 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -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
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 79d6ec65e4..79e89286f1 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -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`" = ""