diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-05-24 20:51:49 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-05-24 23:05:28 +0200 |
| commit | a371aa225c2fb0a7071609d10bbddbef353a0da5 (patch) | |
| tree | c41ff70edd434bae052bd57e320dfdfa3a816706 | |
| parent | a61cd1d0fd642c45bc61ef52f09d8f62ce3976b8 (diff) | |
size: 'store-profile' takes a list of store items.
* guix/scripts/size.scm (mappend-map): New procedure.
(store-profile): Change 'item' to 'items' and adjust code accordingly.
(guix-size): Update caller.
* tests/size.scm ("store-profile"): Likewise.
| -rw-r--r-- | guix/scripts/size.scm | 17 | ||||
| -rw-r--r-- | tests/size.scm | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index be1e8ca0876..8a7974729bf 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm | |||
| @@ -123,13 +123,20 @@ substitutes." | |||
| 123 | store))) | 123 | store))) |
| 124 | (values (requisites store item) store)))) | 124 | (values (requisites store item) store)))) |
| 125 | 125 | ||
| 126 | (define (store-profile item) | 126 | (define (mappend-map mproc lst) |
| 127 | "Apply MPROC to each item of LST and concatenate the resulting list." | ||
| 128 | (with-monad %store-monad | ||
| 129 | (>>= (mapm %store-monad mproc lst) | ||
| 130 | (lambda (lstlst) | ||
| 131 | (return (concatenate lstlst)))))) | ||
| 132 | |||
| 133 | (define (store-profile items) | ||
| 127 | "Return as a monadic value a list of <profile> objects representing the | 134 | "Return as a monadic value a list of <profile> objects representing the |
| 128 | profile of ITEM and its requisites." | 135 | profile of ITEMS and their requisites." |
| 129 | (mlet* %store-monad ((refs (>>= (requisites* item) | 136 | (mlet* %store-monad ((refs (>>= (mappend-map requisites* items) |
| 130 | (lambda (refs) | 137 | (lambda (refs) |
| 131 | (return (delete-duplicates | 138 | (return (delete-duplicates |
| 132 | (cons item refs)))))) | 139 | (append items refs)))))) |
| 133 | (sizes (mapm %store-monad | 140 | (sizes (mapm %store-monad |
| 134 | (lambda (item) | 141 | (lambda (item) |
| 135 | (>>= (file-size item) | 142 | (>>= (file-size item) |
| @@ -286,7 +293,7 @@ Report the size of PACKAGE and its dependencies.\n")) | |||
| 286 | 293 | ||
| 287 | (run-with-store store | 294 | (run-with-store store |
| 288 | (mlet* %store-monad ((item (ensure-store-item file)) | 295 | (mlet* %store-monad ((item (ensure-store-item file)) |
| 289 | (profile (store-profile item))) | 296 | (profile (store-profile (list item)))) |
| 290 | (if map-file | 297 | (if map-file |
| 291 | (begin | 298 | (begin |
| 292 | (profile->page-map profile map-file) | 299 | (profile->page-map profile map-file) |
diff --git a/tests/size.scm b/tests/size.scm index fcd590283dc..068ebc1d687 100644 --- a/tests/size.scm +++ b/tests/size.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -54,7 +54,7 @@ | |||
| 54 | (mbegin %store-monad | 54 | (mbegin %store-monad |
| 55 | (built-derivations (list file2)) | 55 | (built-derivations (list file2)) |
| 56 | (mlet %store-monad ((profiles (store-profile | 56 | (mlet %store-monad ((profiles (store-profile |
| 57 | (derivation->output-path file2))) | 57 | (list (derivation->output-path file2)))) |
| 58 | (bash (interned-file | 58 | (bash (interned-file |
| 59 | (search-bootstrap-binary | 59 | (search-bootstrap-binary |
| 60 | "bash" (%current-system)) "bash" | 60 | "bash" (%current-system)) "bash" |
