diff options
author | Marius Bakke <mbakke@fastmail.com> | 2019-04-08 00:54:01 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2019-04-08 00:54:01 +0200 |
commit | ba00235a9652bb129ff6867ffc3c7cfafe1cca09 (patch) | |
tree | 1ce56f512707e89362e1fed3d5b26d690462fbda /guix/scripts/size.scm | |
parent | f19ccdc62ca721b68745c35b046826b356f46c62 (diff) | |
parent | 0e2b0b05accdea7c3f016f8483d0ec04021114d3 (diff) |
Merge branch 'master' into staging
Diffstat (limited to 'guix/scripts/size.scm')
-rw-r--r-- | guix/scripts/size.scm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index 25218a2945..f549ce05b8 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -34,6 +34,7 @@ #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 vlist) #:export (profile? profile-file profile-self-size @@ -142,11 +143,20 @@ profile of ITEMS and their requisites." (lambda (size) (return (cons item size))))) refs))) + (define size-table + (fold (lambda (pair result) + (match pair + ((item . size) + (vhash-cons item size result)))) + vlist-null sizes)) + (define (dependency-size item) (mlet %store-monad ((deps (requisites* (list item)))) (foldm %store-monad (lambda (item total) - (return (+ (assoc-ref sizes item) total))) + (return (+ (match (vhash-assoc item size-table) + ((_ . size) size)) + total))) 0 (delete-duplicates (cons item deps))))) |