summary refs log tree commit diff
diff options
context:
space:
mode:
-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`" = ""