mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-20 06:37:08 +01:00
download-nar: Improve output.
Report errors that occur, output the "Downloading from " line before starting to report progress and end the output with a newline.
This commit is contained in:
parent
a11107a3b2
commit
3bb3fddb5c
1 changed files with 19 additions and 14 deletions
|
@ -73,29 +73,34 @@ (define (download-nar item)
|
|||
(catch #t
|
||||
(lambda ()
|
||||
(http-fetch (string->uri url)))
|
||||
(lambda args
|
||||
(lambda (key . args)
|
||||
(format #t "Unable to fetch from ~a, ~a: ~a~%"
|
||||
(uri-host (string->uri url))
|
||||
key
|
||||
args)
|
||||
(values #f #f)))))
|
||||
(if (not port)
|
||||
(loop rest)
|
||||
(let* ((reporter (progress-reporter/file
|
||||
url
|
||||
size
|
||||
(current-error-port)
|
||||
#:abbreviation nar-uri-abbreviation))
|
||||
(port-with-progress
|
||||
(progress-report-port reporter port
|
||||
#:download-size size)))
|
||||
(begin
|
||||
(if size
|
||||
(format #t "Downloading from ~a (~,2h MiB)...~%" url
|
||||
(/ size (expt 2 20.)))
|
||||
(format #t "Downloading from ~a...~%" url))
|
||||
(if (string-contains url "/lzip")
|
||||
(restore-lzipped-nar port-with-progress
|
||||
item
|
||||
size)
|
||||
(begin
|
||||
(let* ((reporter (progress-reporter/file
|
||||
url
|
||||
size
|
||||
(current-error-port)
|
||||
#:abbreviation nar-uri-abbreviation))
|
||||
(port-with-progress
|
||||
(progress-report-port reporter port
|
||||
#:download-size size)))
|
||||
(if (string-contains url "/lzip")
|
||||
(restore-lzipped-nar port-with-progress
|
||||
item
|
||||
size)
|
||||
(restore-file port-with-progress
|
||||
item)))
|
||||
(newline)
|
||||
#t))))
|
||||
(()
|
||||
#f))))
|
||||
|
|
Loading…
Reference in a new issue