Fixes a regression introduced in
1d0be47ab6 whereby the total size for
directories (coming from substitutes) would be 4KiB. This led the
progress bar to go back to the start, typically.
* guix/progress.scm (progress-reporter/trace): Add 'total'. In 'start',
initialize it. Adjust 'report' to update it. Adjust 'stop' to prefer
SIZE as the actual size and then TOTAL. Do not use the size of FILE as
the total since that could be 4KiB when FILE is a directory.
Fixes <https://bugs.gnu.org/32895>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.
* guix/progress.scm (progress-reporter/trace): In 'stop', make sure SIZE
is an integer. Previously we'd generate a "@ download-progress" trace
with #f for the 'transferred' number when downloading files whose size
is not known in advance.
Among other things, this removes (guix utils), (guix ui), (guix config),
etc. from the closure of (guix build download), as was the case since
798648515b.
* guix/utils.scm (<progress-reporter>, call-with-progress-reporter):
Move to...
* guix/progress.scm: ... here. New file.
* Makefile.am (MODULES): Add it.
* guix/build/download.scm (current-terminal-columns)
(nearest-exact-integer, duration->seconds, seconds->string)
(byte-count->string, progress-bar, string-pad-middle)
(rate-limited, progress-reporter/file, dump-port*)
(time-monotonic): Move to progress.scm.
* guix/scripts/download.scm: Adjust accordingly.
* guix/scripts/substitute.scm: Likewise.