guix-commits
[Top][All Lists]
Advanced

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

02/02: profiles: 'manual-database' hook reports progress.


From: guix-commits
Subject: 02/02: profiles: 'manual-database' hook reports progress.
Date: Fri, 1 Feb 2019 13:33:19 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit f6fe7da3721070f81a4b0378285cb6398b935c52
Author: Ludovic Courtès <address@hidden>
Date:   Fri Feb 1 19:25:38 2019 +0100

    profiles: 'manual-database' hook reports progress.
    
    * guix/profiles.scm (manual-database)[build](compute-entries): Write a
    progress report.
---
 guix/profiles.scm | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 598e0ac..efe5ecb 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès 
<address@hidden>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès 
<address@hidden>
 ;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
 ;;; Copyright © 2014, 2016 Alex Kost <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
@@ -1300,12 +1300,22 @@ the entries in MANIFEST."
                          (srfi srfi-19))
 
             (define (compute-entries)
-              (append-map (lambda (directory)
-                            (let ((man (string-append directory "/share/man")))
-                              (if (directory-exists? man)
-                                  (mandb-entries man)
-                                  '())))
-                          '#$(manifest-inputs manifest)))
+              ;; This is the most expensive part (I/O and CPU, due to
+              ;; decompression), so report progress as we traverse INPUTS.
+              (let* ((inputs '#$(manifest-inputs manifest))
+                     (total  (length inputs)))
+                (append-map (lambda (directory count)
+                              (format #t "\r[~3d/~3d] building list of \
+man-db entries..."
+                                      count total)
+                              (force-output)
+                              (let ((man (string-append directory
+                                                        "/share/man")))
+                                (if (directory-exists? man)
+                                    (mandb-entries man)
+                                    '())))
+                            inputs
+                            (iota total 1))))
 
             (define man-directory
               (string-append #$output "/share/man"))
@@ -1320,6 +1330,7 @@ the entries in MANIFEST."
                                                                   "/index.db")
                                                    entries))
                    (duration (time-difference (current-time) start)))
+              (newline)
               (format #t "~a entries processed in ~,1f s~%"
                       (length entries)
                       (+ (time-second duration)



reply via email to

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