aboutsummaryrefslogtreecommitdiff
path: root/guix/substitutes.scm
Commit message (Collapse)AuthorAge
* substitute: Gracefully handle TLS termination while fetching narinfos.Ludovic Courtès2023-03-27
| | | | | | | Fixes <https://issues.guix.gnu.org/62476>. * guix/substitutes.scm (call-with-connection-error-handling): Add 'gnutls-error case.
* guix: Strip #:use-module lists.Ludovic Courtès2023-03-13
| | | | | | | | | | | | This was obtained by setting up this environment: guix shell -D guix --with-input=guile@3.0.9=guile-next \ --with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2 -- make -j5 then adding 'unused-module' to (@@ (guix build compiler) %warnings), building, and checking all the "unused module" warnings and removing those that were definitely unused.
* substitutes: Log the failing queries.Mathieu Othacehe2023-01-07
| | | | | | * guix/substitutes.scm (%debug?): New variable. (handle-narinfo-response): Log the failing queries if the %debug? parameter is set.
* substitutes: Build correct narinfo URLs for cache URLs without trailing slash.Ludovic Courtès2021-12-12
| | | | | | | | | | | | 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.
* substitutes: Properly construct URLs.Hartmut Goebel2021-07-16
| | | | | | | | | 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.
* substitutes: Reduce negative TTLs.Ludovic Courtès2021-05-16
| | | | | * guix/substitutes.scm (%narinfo-negative-ttl): Change to 15mn. (%narinfo-transient-error-ttl): Halve.
* substitutes: lookup-narinfos: Return the number of requests made.Christopher Baines2021-03-17
| | | | | | | | | 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.
* guix: substitutes: Make progress reporting configurable.Christopher Baines2021-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | 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: Split (guix substitutes) from (guix scripts substitute).Christopher Baines2021-03-05
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).