summaryrefslogtreecommitdiff
path: root/guix/substitutes.scm
AgeCommit message (Collapse)Author
2021-12-12substitutes: Build correct narinfo URLs for cache URLs without trailing slash.Ludovic Courtès
Fixes <https://issues.guix.gnu.org/51441>. Reported by Z572 <873216071@qq.com> and Peng Mei Yu <pengmeiyu@riseup.net>. Previously, passing '--substitute-urls=https://mirror.sjtu.edu.cn/guix', without a trailing slash, would fail due to incorrectly constructed narinfo URLs. Users would have to explicitly add a trailing slash. * guix/substitutes.scm (narinfo-request): Ensure BASE has a trailing slash.
2021-07-16substitutes: Properly construct URLs.Hartmut Goebel
Use relative URIs and "resolve-uri-reference" (which implements the algorithm specified in RFC 3986 section 5.2.2) for building the URL, instead of just appending strings. This avoids issued if the cache-url ends with a slash. * guix/substitutes.scm (narinfo-request): Use resolve-uri-reference for constructing the url.
2021-05-16substitutes: Reduce negative TTLs.Ludovic Courtès
* guix/substitutes.scm (%narinfo-negative-ttl): Change to 15mn. (%narinfo-transient-error-ttl): Halve.
2021-03-17substitutes: lookup-narinfos: Return the number of requests made.Christopher Baines
As an additional value, in addition to the narinfos. This value is useful in the weather script for reporting how many requests to the substitute server were made. * guix/substitutes.scm (lookup-narinfos): Additionally return the number of requests made.
2021-03-09guix: substitutes: Make progress reporting configurable.Christopher Baines
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.
2021-03-05guix: Split (guix substitutes) from (guix scripts substitute).Christopher Baines
This means there's a module for working with substitutes, rather than all the code sitting in the script. The need for this can be seen with the weather and challenge scripts, that now don't have to use code from the substitute script, but can instead use the substitute module. The separation here between the actual functionality of the substitute script and the underlying functionality used both there and elsewhere should make maintenance easier moving forward. This commit just moves code, none of the code should have been changed significantly. * guix/scripts/substitute.scm (%narinfo-cache-directory, %narinfo-ttl, %narinfo-negative-ttl, %narinfo-transient-error-ttl, %unreachable-hosts): Move variables to guix/substitutes.scm. (narinfo-cache-file, cached-narinfo, cache-narinfo!, narinfo-request, read-to-eof, call-with-connection-error-handling, fetch-narinfos, lookup-narinfos, lookup-narinfos/diverse): Move procedures to guix/substitutes.scm. * guix/substitutes.scm: New file. * Makefile.am: Add it. * guix/narinfo.scm: Remove redundant module. * guix/scripts/challenge.scm: Change (guix scripts substitute) to (guix substitutes). * guix/scripts/weather.scm: Change (guix scripts substitute) to (guix substitutes).