aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nar-herder/storage.scm55
1 files changed, 30 insertions, 25 deletions
diff --git a/nar-herder/storage.scm b/nar-herder/storage.scm
index 87e2ff1..55e374e 100644
--- a/nar-herder/storage.scm
+++ b/nar-herder/storage.scm
@@ -288,31 +288,36 @@
(define files-count
(database-count-narinfo-files database))
- (call-with-progress-reporter
- (progress-reporter/bar files-count
- (simple-format #f "checking ~A files" files-count)
- (current-error-port))
- (lambda (report)
- (fold-nar-files
- database
- storage-root
- (lambda (file _)
- (let* ((full-filename
- (string-append storage-root
- (uri-decode (assq-ref file 'url))))
- (file-size
- (stat:size (stat full-filename)))
- (database-size
- (assq-ref file 'size)))
- (report)
- (unless (= file-size database-size)
- (newline)
- (log-msg 'WARN "file " full-filename
- " has inconsistent size (database: "
- database-size ", file: " file-size ")"))
- #f))
- #f
- #:stored? 'both))))
+ (let ((not-stored-count
+ (call-with-progress-reporter
+ (progress-reporter/bar files-count
+ (simple-format #f "checking ~A files" files-count)
+ (current-error-port))
+ (lambda (report)
+ (fold-nar-files
+ database
+ storage-root
+ (lambda (file not-stored-count)
+ (let* ((full-filename
+ (string-append storage-root
+ (uri-decode (assq-ref file 'url)))))
+ (if (file-exists? full-filename)
+ (let ((file-size
+ (stat:size (stat full-filename)))
+ (database-size
+ (assq-ref file 'size)))
+ (report)
+ (unless (= file-size database-size)
+ (newline)
+ (log-msg 'WARN "file " full-filename
+ " has inconsistent size (database: "
+ database-size ", file: " file-size ")"))
+ not-stored-count)
+ (+ 1 not-stored-count))))
+ 0
+ #:stored? 'both)))))
+
+ (log-msg 'INFO "finished checking, " not-stored-count " files not stored")))
(define (at-most max-length lst)
"If LST is shorter than MAX-LENGTH, return it and the empty list; otherwise