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.
This commit is contained in:
Ludovic Courtès 2016-05-24 20:51:49 +02:00
parent a61cd1d0fd
commit a371aa225c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 14 additions and 7 deletions

View File

@ -123,13 +123,20 @@ substitutes."
store))) store)))
(values (requisites store item) store)))) (values (requisites store item) store))))
(define (store-profile item) (define (mappend-map mproc lst)
"Apply MPROC to each item of LST and concatenate the resulting list."
(with-monad %store-monad
(>>= (mapm %store-monad mproc lst)
(lambda (lstlst)
(return (concatenate lstlst))))))
(define (store-profile items)
"Return as a monadic value a list of <profile> objects representing the "Return as a monadic value a list of <profile> objects representing the
profile of ITEM and its requisites." profile of ITEMS and their requisites."
(mlet* %store-monad ((refs (>>= (requisites* item) (mlet* %store-monad ((refs (>>= (mappend-map requisites* items)
(lambda (refs) (lambda (refs)
(return (delete-duplicates (return (delete-duplicates
(cons item refs)))))) (append items refs))))))
(sizes (mapm %store-monad (sizes (mapm %store-monad
(lambda (item) (lambda (item)
(>>= (file-size item) (>>= (file-size item)
@ -286,7 +293,7 @@ Report the size of PACKAGE and its dependencies.\n"))
(run-with-store store (run-with-store store
(mlet* %store-monad ((item (ensure-store-item file)) (mlet* %store-monad ((item (ensure-store-item file))
(profile (store-profile item))) (profile (store-profile (list item))))
(if map-file (if map-file
(begin (begin
(profile->page-map profile map-file) (profile->page-map profile map-file)

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -54,7 +54,7 @@
(mbegin %store-monad (mbegin %store-monad
(built-derivations (list file2)) (built-derivations (list file2))
(mlet %store-monad ((profiles (store-profile (mlet %store-monad ((profiles (store-profile
(derivation->output-path file2))) (list (derivation->output-path file2))))
(bash (interned-file (bash (interned-file
(search-bootstrap-binary (search-bootstrap-binary
"bash" (%current-system)) "bash" "bash" (%current-system)) "bash"