aboutsummaryrefslogtreecommitdiff
path: root/scripts/nar-herder.in
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-06-30 19:11:35 +0100
committerChristopher Baines <mail@cbaines.net>2023-06-30 19:11:35 +0100
commit159e2164f376b0ed582534a0880f4ae90fcdb896 (patch)
tree9bd150113ba5bdf2eadf9fe84da0740efb307cb5 /scripts/nar-herder.in
parent6fb868994cfa53dad536a4428c996820232f1938 (diff)
downloadnar-herder-159e2164f376b0ed582534a0880f4ae90fcdb896.tar
nar-herder-159e2164f376b0ed582534a0880f4ae90fcdb896.tar.gz
Show progress for downloading the database dump
Diffstat (limited to 'scripts/nar-herder.in')
-rw-r--r--scripts/nar-herder.in18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/nar-herder.in b/scripts/nar-herder.in
index c4a4bd2..c20aab7 100644
--- a/scripts/nar-herder.in
+++ b/scripts/nar-herder.in
@@ -483,9 +483,21 @@
(when (not (= (response-code response) 200))
(error "unable to fetch database from mirror"))
- (call-with-output-file (assq-ref opts 'database)
- (lambda (output-port)
- (dump-port body output-port)))
+ (let* ((reporter (progress-reporter/file
+ (uri->string database-uri)
+ (response-content-length response)
+ (current-error-port)))
+ (port
+ (progress-report-port
+ reporter
+ body
+ #:download-size (response-content-length response))))
+
+ (call-with-output-file (assq-ref opts 'database)
+ (lambda (output-port)
+ (dump-port port output-port)))
+
+ (close-port port))
(simple-format (current-error-port)
"finished downloading the database\n")))))