summaryrefslogtreecommitdiff
path: root/guix/scripts/size.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-24 20:51:49 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-24 23:05:28 +0200
commita371aa225c2fb0a7071609d10bbddbef353a0da5 (patch)
treec41ff70edd434bae052bd57e320dfdfa3a816706 /guix/scripts/size.scm
parenta61cd1d0fd642c45bc61ef52f09d8f62ce3976b8 (diff)
downloadguix-patches-a371aa225c2fb0a7071609d10bbddbef353a0da5.tar
guix-patches-a371aa225c2fb0a7071609d10bbddbef353a0da5.tar.gz
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.
Diffstat (limited to 'guix/scripts/size.scm')
-rw-r--r--guix/scripts/size.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index be1e8ca087..8a7974729b 100644
--- a/guix/scripts/size.scm
+++ b/guix/scripts/size.scm
@@ -123,13 +123,20 @@ substitutes."
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
-profile of ITEM and its requisites."
- (mlet* %store-monad ((refs (>>= (requisites* item)
+profile of ITEMS and their requisites."
+ (mlet* %store-monad ((refs (>>= (mappend-map requisites* items)
(lambda (refs)
(return (delete-duplicates
- (cons item refs))))))
+ (append items refs))))))
(sizes (mapm %store-monad
(lambda (item)
(>>= (file-size item)
@@ -286,7 +293,7 @@ Report the size of PACKAGE and its dependencies.\n"))
(run-with-store store
(mlet* %store-monad ((item (ensure-store-item file))
- (profile (store-profile item)))
+ (profile (store-profile (list item))))
(if map-file
(begin
(profile->page-map profile map-file)