guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: size: 'store-profile' takes a list of store items.


From: Ludovic Courtès
Subject: 01/05: size: 'store-profile' takes a list of store items.
Date: Tue, 24 May 2016 21:53:34 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit a371aa225c2fb0a7071609d10bbddbef353a0da5
Author: Ludovic Courtès <address@hidden>
Date:   Tue May 24 20:51:49 2016 +0200

    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.
---
 guix/scripts/size.scm |   17 ++++++++++++-----
 tests/size.scm        |    4 ++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm
index be1e8ca..8a79747 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)
diff --git a/tests/size.scm b/tests/size.scm
index fcd5902..068ebc1 100644
--- a/tests/size.scm
+++ b/tests/size.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015, 2016 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -54,7 +54,7 @@
     (mbegin %store-monad
       (built-derivations (list file2))
       (mlet %store-monad ((profiles (store-profile
-                                     (derivation->output-path file2)))
+                                     (list (derivation->output-path file2))))
                           (bash     (interned-file
                                      (search-bootstrap-binary
                                       "bash" (%current-system)) "bash"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]