summaryrefslogtreecommitdiff
path: root/guix/scripts/package.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/scripts/package.scm')
-rw-r--r--guix/scripts/package.scm24
1 files changed, 24 insertions, 0 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 1f9355ff22..ccca614d88 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -281,6 +281,9 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(display (_ "
-i, --install=PACKAGE install PACKAGE"))
(display (_ "
+ -e, --install-from-expression=EXP
+ install the package EXP evaluates to"))
+ (display (_ "
-r, --remove=PACKAGE remove PACKAGE"))
(display (_ "
-u, --upgrade=REGEXP upgrade all the installed packages matching REGEXP"))
@@ -325,6 +328,10 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(option '(#\i "install") #t #f
(lambda (opt name arg result)
(alist-cons 'install arg result)))
+ (option '(#\e "install-from-expression") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'install (read/eval-package-expression arg)
+ result)))
(option '(#\r "remove") #t #f
(lambda (opt name arg result)
(alist-cons 'remove arg result)))
@@ -490,6 +497,19 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(delete-duplicates (map input->name+path deps) same?))
+ (define (package->tuple p)
+ (let ((path (package-derivation (%store) p))
+ (deps (package-transitive-propagated-inputs p)))
+ `(,(package-name p)
+ ,(package-version p)
+
+ ;; When given a package via `-e', install the first of its
+ ;; outputs (XXX).
+ ,(car (package-outputs p))
+
+ ,path
+ ,(canonicalize-deps deps))))
+
;; First roll back if asked to.
(if (and (assoc-ref opts 'roll-back?) (not dry-run?))
(begin
@@ -515,6 +535,8 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(install (append
upgrade
(filter-map (match-lambda
+ (('install . (? package? p))
+ #f)
(('install . (? store-path?))
#f)
(('install . package)
@@ -530,6 +552,8 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
install))
(install* (append
(filter-map (match-lambda
+ (('install . (? package? p))
+ (package->tuple p))
(('install . (? store-path? path))
(let-values (((name version)
(package-name->name+version