(define* (manifest-show-transaction manifest transaction #:key dry-run?) "Display what will/would be installed/removed from MANIFEST by TRANSACTION." (define (display-entries entries action-string) (match entries ((($ name version output item _) ..1) (let ((len (length name)) (package-strings (map (lambda (name version output item) (if (package? item) (format #f " ~a-~a\t~a" name version output) (format #f " ~a-~a\t~a\t~a" name version output item))) name version output item))) (format (current-error-port) (N_ "The following package ~:[will~;would~] be ~a:~%~{~a~%~}~%" "The following packages ~:[will~;would~] be ~a:~%~{~a~%~}~%" len) dry-run? action-string package-strings))) (_ #f))) (let* ((remove (manifest-matching-entries manifest (manifest-transaction-remove transaction))) (install (manifest-transaction-install transaction)) (upgrade (append-map (lambda (entry) (manifest-matching-entries manifest (list (manifest-pattern (name (manifest-entry-name entry)) (output (manifest-entry-output entry)))))) install))) (display-entries upgrade "upgraded (removed)") (display-entries install "installed") (display-entries remove "removed")))