diff options
author | Alex Kost <alezost@gmail.com> | 2014-11-02 13:58:21 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2014-11-04 15:51:22 +0300 |
commit | d38bd08c74009ffa2a3d764054f1ca39c9192fff (patch) | |
tree | 011f3ba92f1728ecb857a89c39cfa6fbb62ddd0e /emacs/guix-main.scm | |
parent | 62f261d88cb737f9f3f3d2fffacc7d2b5a599d80 (diff) | |
download | patches-d38bd08c74009ffa2a3d764054f1ca39c9192fff.tar patches-d38bd08c74009ffa2a3d764054f1ca39c9192fff.tar.gz |
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
Diffstat (limited to 'emacs/guix-main.scm')
-rw-r--r-- | emacs/guix-main.scm | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index 1dd57bb71a..62eeabba1e 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -106,6 +106,38 @@ (manifest-entry-version entry) (manifest-entry-output entry))) +(define (manifest-entry->package-specification entry) + (call-with-values + (lambda () (manifest-entry->name+version+output entry)) + make-package-specification)) + +(define (manifest-entries->package-specifications entries) + (map manifest-entry->package-specification entries)) + +(define (generation-package-specifications profile number) + "Return a list of package specifications for generation NUMBER." + (let ((manifest (profile-manifest + (generation-file-name profile number)))) + (manifest-entries->package-specifications + (manifest-entries manifest)))) + +(define (generation-package-specifications+paths profile number) + "Return a list of package specifications and paths for generation NUMBER. +Each element of the list is a list of the package specification and its path." + (let ((manifest (profile-manifest + (generation-file-name profile number)))) + (map (lambda (entry) + (list (manifest-entry->package-specification entry) + (manifest-entry-item entry))) + (manifest-entries manifest)))) + +(define (generation-difference profile number1 number2) + "Return a list of package specifications for outputs installed in generation +NUMBER1 and not installed in generation NUMBER2." + (let ((specs1 (generation-package-specifications profile number1)) + (specs2 (generation-package-specifications profile number2))) + (lset-difference string=? specs1 specs2))) + (define (manifest-entries->hash-table entries) "Return a hash table of name keys and lists of matching manifest ENTRIES." (let ((table (make-hash-table (length entries)))) @@ -625,8 +657,15 @@ See 'entry-sexps' for details." (generation-file-name profile (car search-vals)) profile)) (manifest (profile-manifest profile)) - (patterns (apply (patterns-maker entry-type search-type) - manifest search-vals)) + (patterns (if (and (eq? entry-type 'output) + (eq? search-type 'generation-diff)) + (match search-vals + ((g1 g2) + (map specification->output-pattern + (generation-difference profile g1 g2))) + (_ '())) + (apply (patterns-maker entry-type search-type) + manifest search-vals))) (->sexps ((pattern-transformer entry-type) manifest params))) (append-map ->sexps patterns))) |