From 537630c5a743251024b6bbd8b4eecf8811439cc6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 1 Nov 2013 17:12:15 +0100 Subject: 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'. --- guix/scripts/package.scm | 27 ++++++++++++++++----------- 1 file 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 (($ 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?) -- cgit 1.4.1