aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-03-18 23:04:07 +0100
committerLudovic Courtès <ludo@gnu.org>2013-03-18 23:04:07 +0100
commita4f08f9258805bf3d783db9a20d66d60209d8853 (patch)
treed2004be6a8bc07ba705ee1c92118cb5865eadddb /guix
parent71f4b81aa5a3daa73e9d4d09ee8b18fac5b9a451 (diff)
downloadgnu-guix-a4f08f9258805bf3d783db9a20d66d60209d8853.tar
gnu-guix-a4f08f9258805bf3d783db9a20d66d60209d8853.tar.gz
guix package: Report packages to be removed/installed.
* guix/scripts/package.scm (guix-package)[process-actions](show-what-to-remove/install): New procedure. Call it before `show-what-to-build'.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/package.scm40
1 files changed, 40 insertions, 0 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index f14677c519..6de2f1beb6 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -552,6 +552,44 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
,path
,(canonicalize-deps deps))))
+ (define (show-what-to-remove/install remove install dry-run?)
+ ;; Tell the user what's going to happen in high-level terms.
+ ;; TODO: Report upgrades more clearly.
+ (match remove
+ (((name version _ path _) ..1)
+ (let ((len (length name))
+ (remove (map (cut format #f " ~a-~a\t~a" <> <> <>)
+ name version path)))
+ (if dry-run?
+ (format (current-error-port)
+ (N_ "The following package would be removed:~% ~{~a~%~}~%"
+ "The following packages would be removed:~% ~{~a~%~}~%"
+ len)
+ remove)
+ (format (current-error-port)
+ (N_ "The following package will be removed:~% ~{~a~%~}~%"
+ "The following packages will be removed:~% ~{~a~%~}~%"
+ len)
+ remove))))
+ (_ #f))
+ (match install
+ (((name version _ path _) ..1)
+ (let ((len (length name))
+ (install (map (cut format #f " ~a-~a\t~a" <> <> <>)
+ name version path)))
+ (if dry-run?
+ (format (current-error-port)
+ (N_ "The following package would be installed:~% ~{~a~%~}~%"
+ "The following packages would be installed:~% ~{~a~%~}~%"
+ len)
+ install)
+ (format (current-error-port)
+ (N_ "The following package will be installed:~% ~{~a~%~}~%"
+ "The following packages will be installed:~% ~{~a~%~}~%"
+ len)
+ install))))
+ (_ #f)))
+
;; First roll back if asked to.
(if (and (assoc-ref opts 'roll-back?) (not dry-run?))
(begin
@@ -619,6 +657,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
package)
(_ #f))
opts))
+ (remove* (filter-map (cut assoc <> installed) remove))
(packages (append install*
(fold (lambda (package result)
(match package
@@ -630,6 +669,7 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(when (equal? profile %current-profile)
(ensure-default-profile))
+ (show-what-to-remove/install remove* install* dry-run?)
(show-what-to-build (%store) drv dry-run?)
(or dry-run?