[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/07: database: 'register-items' shows a progress bar.
From: |
Ludovic Courtès |
Subject: |
04/07: database: 'register-items' shows a progress bar. |
Date: |
Sun, 23 Sep 2018 17:34:31 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit f0addd6461658d13eadf5f6e3bdb89aa02a6e902
Author: Ludovic Courtès <address@hidden>
Date: Sun Sep 23 22:51:51 2018 +0200
database: 'register-items' shows a progress bar.
* guix/store/database.scm (register-items): Add #:log-port. Use
'progress-reporter/bar' to show a progress report.
(register-path): Pass #:log-port to 'register-items'.
---
guix/store/database.scm | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/guix/store/database.scm b/guix/store/database.scm
index 0879a95..5d094fa 100644
--- a/guix/store/database.scm
+++ b/guix/store/database.scm
@@ -23,6 +23,7 @@
#:use-module (guix serialization)
#:use-module (guix store deduplication)
#:use-module (guix base16)
+ #:use-module (guix progress)
#:use-module (guix build syscalls)
#:use-module ((guix build utils)
#:select (mkdir-p executable-file?))
@@ -234,7 +235,8 @@ be used internally by the daemon's build hook."
#:prefix prefix #:state-directory state-directory
#:deduplicate? deduplicate?
#:reset-timestamps? reset-timestamps?
- #:schema schema))
+ #:schema schema
+ #:log-port (%make-void-port "w")))
(define %epoch
;; When it all began.
@@ -245,12 +247,14 @@ be used internally by the daemon's build hook."
(deduplicate? #t)
(reset-timestamps? #t)
registration-time
- (schema (sql-schema)))
+ (schema (sql-schema))
+ (log-port (current-error-port)))
"Register all of ITEMS, a list of <store-info> records as returned by
'read-reference-graph', in the database under PREFIX/STATE-DIRECTORY. ITEMS
must be in topological order (with leaves first.) If the database is
initially empty, apply SCHEMA to initialize it. REGISTRATION-TIME must be the
-registration time to be recorded in the database; #f means \"now\"."
+registration time to be recorded in the database; #f means \"now\".
+Write a progress report to LOG-PORT."
;; Priority for options: first what is given, then environment variables,
;; then defaults. %state-directory, %store-directory, and
@@ -302,4 +306,12 @@ registration time to be recorded in the database; #f means
\"now\"."
(mkdir-p db-dir)
(parameterize ((sql-schema schema))
(with-database (string-append db-dir "/db.sqlite") db
- (for-each (cut register db <>) items))))
+ (let* ((prefix (format #f "registering ~a items" (length items)))
+ (progress (progress-reporter/bar (length items)
+ prefix log-port)))
+ (call-with-progress-reporter progress
+ (lambda (report)
+ (for-each (lambda (item)
+ (register db item)
+ (report))
+ items)))))))
- branch master updated (e10bf49 -> fce2254), Ludovic Courtès, 2018/09/23
- 02/07: serialization: Remove redundancy in 'write-file'., Ludovic Courtès, 2018/09/23
- 03/07: store-copy: Display a progress bar when copying store items., Ludovic Courtès, 2018/09/23
- 04/07: database: 'register-items' shows a progress bar.,
Ludovic Courtès <=
- 01/07: system: Mention '--skip-checks' in initrd diagnostics., Ludovic Courtès, 2018/09/23
- 05/07: database: Register each store item only once., Ludovic Courtès, 2018/09/23
- 07/07: vm: Use "cache=loose" for all 9p mounts., Ludovic Courtès, 2018/09/23
- 06/07: vm: Disable deduplication for 'guix system vm-image'., Ludovic Courtès, 2018/09/23