Ludovic Courtès schreef op zo 16-01-2022 om 23:19 [+0100]: > Hi, > > Maxime Devos skribis: > > > Follow-up to . > > > > To test, you can do > > > > $ make check > > $ ./pre-inst-env guix refresh -t github -u zig > > > > and verify that the version and sha256/base32 has been updated > > (zig@0.9.0 doesn't work though; patches aren't applying cleanly). > > Nice, applied! > > One comment: > > > +(define (call-with-releases thunk tags releases) > > + (mock ((guix http-client) http-fetch [...]) > > + (parameterize ((%github-api "mock://")) > > + (thunk)))) > > I think the whole point of having the ‘%github-api’ parameter is that it > allows us to mock the HTTP server instead of having to override bindings > such as ‘http-fetch’. > > I’d have a slight preference for doing that, similar to what is done in > tests/cpan.scm for instance. WDYT? tests/cpan.scm uses 'with-http-server', which I do not find ideal because the answers the HTTP server gives depend on the order the HTTP server was queried, without verifying the URI. Mocking 'http-fetch' allows me not to worry about ordering and allows verifying the URI. It might be possible to modify 'with-http-server' into something (with-http-server*?) that allows looking at the HTTP headers and URI and dynamically generate a response based on that. Due to the mocking, %github-api isn't truly necessary, but having "https://api.github.com" in a single location helps avoiding typos like writing "http://" instead of "https://" somewhere, or adjusting the domain name if GitHub decided to change it for whatever reason (hopefully unlikely?), or if Tor becomes very popular among the general public and GitHub has an ".onion" address, then it could be changed to the ".onion" address easily, ... Greetings, Maxime.