aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-11-01 17:12:15 +0100
committerLudovic Courtès <ludo@gnu.org>2013-11-01 23:21:00 +0100
commit537630c5a743251024b6bbd8b4eecf8811439cc6 (patch)
tree230a8807f4f4d0d96348233eadb6d2054390e69e /guix
parent2876b9892583bc1245d77fd10286025cd8433ede (diff)
downloadgnu-guix-537630c5a743251024b6bbd8b4eecf8811439cc6.tar
gnu-guix-537630c5a743251024b6bbd8b4eecf8811439cc6.tar.gz
guix package: Separate '--remove' option processing.
* guix/scripts/package.scm (options->removable): New procedure. (guix-package)[process-actions]: Use it. Rename 'remove*' to 'remove' and 'install*' to 'install'.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/package.scm27
1 files changed, 16 insertions, 11 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index 941b2cdca7..e0c7b6ed15 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -692,6 +692,17 @@ return the new list of manifest entries."
(append to-upgrade to-install))
+(define (options->removable options manifest)
+ "Given options, return the list of manifest entries to be removed from
+MANIFEST."
+ (let ((remove (filter-map (match-lambda
+ (('remove . package)
+ package)
+ (_ #f))
+ options)))
+ (filter (cut manifest-installed? manifest <>)
+ remove)))
+
;;;
;;; Entry point.
@@ -839,16 +850,10 @@ more information.~%"))
opts))
(else
(let* ((manifest (profile-manifest profile))
- (install* (options->installable opts manifest))
- (remove (filter-map (match-lambda
- (('remove . package)
- package)
- (_ #f))
- opts))
- (remove* (filter (cut manifest-installed? manifest <>)
- remove))
+ (install (options->installable opts manifest))
+ (remove (options->removable opts manifest))
(entries
- (append install*
+ (append install
(fold (lambda (package result)
(match package
(($ <manifest-entry> name _ out _ ...)
@@ -858,7 +863,7 @@ more information.~%"))
result))))
(manifest-entries
(manifest-remove manifest remove))
- install*)))
+ install)))
(new (make-manifest entries)))
(when (equal? profile %current-profile)
@@ -867,7 +872,7 @@ more information.~%"))
(if (manifest=? new manifest)
(format (current-error-port) (_ "nothing to be done~%"))
(let ((prof-drv (profile-derivation (%store) new)))
- (show-what-to-remove/install remove* install* dry-run?)
+ (show-what-to-remove/install remove install dry-run?)
(show-what-to-build (%store) (list prof-drv)
#:use-substitutes?
(assoc-ref opts 'substitutes?)