guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/11: guix package: "guix package -f FILE" ensures FILE returns a packa


From: guix-commits
Subject: 01/11: guix package: "guix package -f FILE" ensures FILE returns a package.
Date: Wed, 18 Sep 2019 17:10:36 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit f9c0400392843540a87985a67ffb9fb6e4dbc2fa
Author: Ludovic Courtès <address@hidden>
Date:   Wed Sep 18 14:55:44 2019 +0200

    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.
---
 guix/scripts/package.scm |  6 +++++-
 tests/guix-package.sh    | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a43c965..21737f4 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 79d6ec6..79e8928 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`" = ""



reply via email to

[Prev in Thread] Current Thread [Next in Thread]