guix: substitutes: Make progress reporting configurable.
authorChristopher Baines <mail@cbaines.net>
Wed, 9 Dec 2020 18:56:05 +0000 (18:56 +0000)
committerChristopher Baines <mail@cbaines.net>
Tue, 9 Mar 2021 20:19:33 +0000 (20:19 +0000)
commitfd5b77503e852b78a43e1bee4d6bdfbbb1f27e8f
tree4787e67bb5b3710607a3ce47d5dfed05c1d19133
parentd019bce1a3e174079ad0ed94e18a0080e632d36b
guix: substitutes: Make progress reporting configurable.

Rather than always outputting to (current-error-port) in
lookup-narinfos (which is called from within lookup-narinfos/diverse), take a
procedure which should return a progress reporter, and defer any output to
that.

As this is now general purpose code, make the default behaviour to output
nothing. Maintain the current behaviour of the substitute script by moving the
progress reporter implementation there, and passing it in when calling
lookup-narinfos/diverse.

These changes should be generally useful, but I'm particularly looking at
getting guix weather to do progress reporting differently, with this new
flexibility.

* guix/substitutes.scm (fetch-narinfos): Take a procedure to make a
progress-reporter, and use that rather than the hardcoded behaviour.
(lookup-narinfos): Add #:make-progress-reporter keyword argument, and pass
this through to fetch-narinfos.
(lookup-narinfos/diverse): Add a #:make-progress-reporter keyword argument,
and pass this through to lookup-narinfos.
* guix/scripts/substitute.scm (process-query): Pass a progress-reporter to
lookup-narinfos/diverse.
guix/scripts/substitute.scm
guix/substitutes.scm