package: Preserve the installed package output when upgrading.

* guix/scripts/package.scm (guix-package)[find-package]: Add optional
  parameter `output'.  Use it.
  [process-actions]: When computing UPGRADE, pass OUTPUT to
  `find-package'.
This commit is contained in:
Ludovic Courtès 2013-05-08 15:11:20 +02:00
parent fd982732f4
commit ce3b7a619d

View file

@ -520,10 +520,11 @@ (define (find-best-packages-by-name name version)
((_ version pkgs ...) pkgs) ((_ version pkgs ...) pkgs)
(#f '())))) (#f '()))))
(define (find-package name) (define* (find-package name #:optional (output "out"))
;; Find the package NAME; NAME may contain a version number and a ;; Find the package NAME; NAME may contain a version number and a
;; sub-derivation name. If the version number is not present, ;; sub-derivation name. If the version number is not present,
;; return the preferred newest version. ;; return the preferred newest version. If the sub-derivation name is not
;; present, use OUTPUT.
(define request name) (define request name)
(define (ensure-output p sub-drv) (define (ensure-output p sub-drv)
@ -535,7 +536,7 @@ (define (ensure-output p sub-drv)
(let*-values (((name sub-drv) (let*-values (((name sub-drv)
(match (string-rindex name #\:) (match (string-rindex name #\:)
(#f (values name "out")) (#f (values name output))
(colon (values (substring name 0 colon) (colon (values (substring name 0 colon)
(substring name (+ 1 colon)))))) (substring name (+ 1 colon))))))
((name version) ((name version)
@ -687,7 +688,8 @@ (define (show-what-to-remove/install remove install dry-run?)
(and (any (cut regexp-exec <> name) (and (any (cut regexp-exec <> name)
upgrade-regexps) upgrade-regexps)
(upgradeable? name version path) (upgradeable? name version path)
(find-package name))) (find-package name
(or output "out"))))
(_ #f)) (_ #f))
installed)))) installed))))
(install (append (install (append