summaryrefslogtreecommitdiff
path: root/guix/scripts/substitute.scm
AgeCommit message (Expand)Author
2016-04-20substitute: Sanitize the client-provided column number....* guix/scripts/substitute.scm (client-terminal-columns): Sanitize the client's column number. Ludovic Courtès
2016-04-20substitute: Install the client's locale....* guix/store.scm (set-build-options): Add #:locale parameter and honor it. * guix/scripts/substitute.scm (guix-substitute): Install the client's locale. Ludovic Courtès
2016-04-20substitute: Internationalize signature and download messages....* guix/scripts/substitute.scm (assert-valid-narinfo): Use gettext for messages. Ludovic Courtès
2016-04-20substitute: Better abbreviate substitute URL in progress report....Suggested by Danny Milosavljevic <dannym@scratchpost.org>. * guix/build/download.scm (nar-uri-abbreviation): New procedure. * guix/scripts/substitute.scm (process-substitution): Use it instead of 'store-path-abbreviation'. Ludovic Courtès
2016-04-15substitute: Honor the number of columns of the client terminal....* guix/store.scm (set-build-options): Add #:terminal-columns parameter and honor it. * guix/scripts/substitute.scm (client-terminal-columns): New procedure. (guix-substitute): Use it to parameterize 'current-terminal-columns'. Ludovic Courtès
2016-03-23substitute: Gracefully handle TLS errors....* guix/scripts/substitute.scm (with-networking): Use 'match-lambda*' and add case for 'gnutls-error'. Ludovic Courtès
2016-03-17substitute: Do not leak file descriptors for TLS connections....Partially fixes <http://bugs.gnu.org/20145>. * guix/scripts/substitute.scm (fetch, download-cache-info): (http-multiple-get, fetch-narinfos, progress-report-port): Use 'close-connection' instead of 'close-port'. Ludovic Courtès
2016-03-17substitute: Cache transient HTTP errors for 10mn....* guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]: Cache transient errors for 10mn. (%narinfo-transient-error-ttl): New variable. Ludovic Courtès
2016-03-17substitute: Update progress for responses different from 200/404....* guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]: Add missing call to 'update-progress!'. Ludovic Courtès
2016-03-16substitute: Honor client-provided empty URL list....Before that, 'guix build --substitute-urls=""' would lead to using the daemon's own URL list instead of the empty list. The 'or*' hack, which is to blame, had become unnecessary since commit fb4bf72be3fbc23bca35ba4b842b7e1517ef0e3a. Reported by Mark H Weaver <mhw@netris.org>. * guix/scripts/substitute.scm (or*): Remove. (%cache-urls): Use 'or' instead of 'or*'. * tests/store.scm ("substitute query, alternating URLs"): Add test with empty URL list. * doc/guix.texi (Common Build Options): Mention the empty string. Ludovic Courtès
2016-03-16substitute: Honor the 'max-age' of 'Cache-Control' headers....This allows substitute servers to tell 'guix substitute' how long they can cache narinfo lookups. * guix/scripts/substitute.scm (cache-narinfo!): Add 'ttl' parameter. [cache-entry]: Honor it. (fetch-narinfos)[handle-narinfo-response]: Check the 'Cache-Control' header of RESPONSE and pass its 'max-age' value to 'cache-narinfo!'. Ludovic Courtès
2016-03-16substitute: Make room for a 'ttl' field in cached entries....* guix/scripts/substitute.scm (cached-narinfo): Expect 'narinfo' sexp version 2 with a 'ttl' field. (cache-narinfo!)[cache-entry]: Produce 'narinfo' sexp version 2 with a 'ttl' field. (remove-expired-cached-narinfos)[expired?]: Read 'narinfo' sexp version 2. Ludovic Courtès
2016-03-14substitute: Keep the initial connection alive....The connection used to fetch /nix-cache-info is now reused for the subsequent narinfo requests. * guix/scripts/substitute.scm (download-cache-info)[download]: Remove. [uri, read-cache-info]: New variables. Rewrite in terms of 'http-fetch' instead of 'fetch'. Return an open port in addition to a <cache-info>. * guix/scripts/substitute.scm (http-multiple-get): Add #:port parameter and honor it. (fetch-narinfos)[do-fetch]: Add 'port' parameter. Adjust to new 'download-cache-info' and 'do-fetch' signatures. Ludovic Courtès
2016-03-14substitute: Remove dead code....This parameter became unused with the switch to HTTP pipelining in commit d3a652037ef879f9279bc056c43d15ba7afcbb25. * guix/scripts/substitute.scm (fetch): Remove #:quiet-404? and adjust accordingly. Ludovic Courtès
2016-03-10substitute: Optimize HTTP pipelining over TLS....* guix/scripts/substitute.scm (http-multiple-get): Write the requests to a bytevector output port before sending them. Ludovic Courtès
2016-03-10substitute: Add HTTPS support....Fixes <http://bugs.gnu.org/22937>. Reported by Chris Marusich <cmmarusich@gmail.com>. * guix/scripts/substitute.scm (fetch): Add 'https' alongside 'http'. Use 'open-connection-for-uri' instead of 'open-socket-for-uri'. Call 'setvbuf' only when PORT matches 'file-port?'. (http-multiple-get): Likewise. Change 'base-url' parameter to 'base-uri'. (fetch-narinfos)[do-fetch]: Add 'https' case alongside 'http'. Pass URI instead of URL to 'http-multiple-get'. * doc/guix.texi (Requirements): Move GnuTLS one level higher and mention HTTPS substitutes. (Substitutes): Mention HTTPS and recommend it. Explain why servers are not authenticated. Add "On Trusting Binaries" subsection. Ludovic Courtès
2016-03-09substitute: Error out on unsupported URL schemes....Reported in <http://bugs.gnu.org/22937> by Chris Marusich <cmmarusich@gmail.com>. * guix/scripts/substitute.scm (fetch): Add 'else' case and call 'leave'. Ludovic Courtès
2015-11-28substitute: Warn upon store prefix mismatches....Suggested by Hynek Urban <hynek.urban@gmail.com>. * guix/scripts/substitute.scm (fetch-narinfos): Move body to... [do-fetch]: ... here. New procedure. Emit a warning when CACHE-INFO's prefix does not match. Ludovic Courtès
2015-10-28substitute: Honor all the specified server URLs....* guix/scripts/substitute.scm (lookup-narinfos/diverse): New procedure. (lookup-narinfo): Use it. (process-query): Change #:cache-url to #:cache-urls. [valid?]: Remove 'narinfo?' check, which is no longer necessary. Use 'lookup-narinfos/diverse' instead of 'lookup-narinfos'. (process-substitution): Change #:cache-url to #:cache-urls. (%cache-url): Rename to... (%cache-urls): ... this. Turn into a list. (guix-substitute): Remove 'getaddrinfo' test with early exit. Adjust calls to 'process-query' and 'process-substitution'. * tests/substitute.scm: Change '%cache-url' to '%cache-urls'. Ludovic Courtès
2015-10-28substitute: 'lookup-narinfos' returns exactly a list of narinfos....* guix/scripts/substitute.scm (lookup-narinfos): Filter out #f values from CACHED, such that the end result is exactly a list of narinfos, not interspersed with #f. * guix/scripts/challenge.scm (discrepancies): Assume REMOTE is a list of narinfos. Ludovic Courtès
2015-10-28substitute: 'http-multiple-get' follows 'fold' style....* guix/scripts/substitute.scm (http-multiple-get): Add 'seed' parameter. Call PROC in 'fold' style. (fetch-narinfos)[handle-narinfo-response]: Adjust accordingly. Update 'http-multiple-get' call accordingly. Ludovic Courtès
2015-10-19substitute: Expose narinfo access....* guix/scripts/substitute.scm: Export <narinfo> accessors. (narinfo-hash->sha256): New procedure. (cache-narinfo!): Ignore EACCES exceptions. Ludovic Courtès
2015-09-16substitute: Improve readability of download progress report....* guix/build/download.scm (string-pad-middle, store-url-abbreviation, store-path-abbreviation): New procedures. (progress-proc): Add #:abbreviation parameter and use it. Generate a better indeterminate progress string. * guix/scripts/substitute.scm (assert-valid-narinfo): Add newlines to output. (process-substitution): Use byte-count->string and store-path-abbreviation. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Steve Sprang
2015-09-04publish: Gracefully handle the lack of a deriver....* guix/scripts/publish.scm (narinfo-string): Catch 'system-error' around 'load-derivation' call; return BASE-INFO upon ENOENT. This allows us to return the narinfo even if DERIVER is missing. Before that, the exception would be uncaught, leading to 500 Internal Error on the client side. Ludovic Courtès
2015-07-13substitute: Improve functional decomposition....* guix/scripts/substitute.scm (display-narinfo-data, process-query, process-substitution): New procedures. Code moved from... (guix-substitute): ... here. Use them. Ludovic Courtès
2015-07-13substitute: Honor "substitute-urls" option passed by "untrusted" clients....* guix/scripts/substitute.scm (or*): New macro. (%cache-url): Honor "untrusted-substitute-urls". * guix/tests.scm (%test-substitute-urls): New variable. (open-connection-for-tests): Use it. * tests/derivations.scm ("derivation-prerequisites-to-build and substitutes", "derivation-prerequisites-to-build and substitutes, non-substitutable build", "derivation-prerequisites-to-build and substitutes, local build"): Pass it to 'set-build-options'. * tests/guix-daemon.sh: Likewise. * tests/store.scm ("substitute query, alternating URLs"): New test. ("substitute query", "substitute", "substitute + build-things with output path", "substitute, corrupt output hash", "substitute --fallback"): Pass #:substitute-urls to 'set-build-options'. Ludovic Courtès
2015-07-13substitute: Store cached narinfo in cache-specific sub-directories....This ensures that switching between different substitute servers doesn't lead to a polluted narinfo cache. * guix/scripts/substitute.scm (narinfo-cache-file): Add 'cache-url' parameter. Add the base32 of CACHE-URL as a sub-directory under %NARINFO-CACHE-DIRECTORY. Update callers. (cached-narinfo): Likewise. Call 'mkdir-p' on the dirname of the cache file. Update callers. (remove-expired-cached-narinfos): Add 'directory' parameter and use it instead of %NARINFO-CACHE-DIRECTORY. (narinfo-cache-directories): New procedure. (maybe-remove-expired-cached-narinfo): Call 'remove-expired-cached-narinfos' for each item returned by 'narinfo-cache-directories'. Ludovic Courtès
2015-07-13substitute: Pass the cache URL instead of <cache> objects....* guix/scripts/substitute.scm (<cache>): Rename to... (<cache-info>): ... this. (open-cache): Rename to... (download-cache-info): ... this. Return a <cache-info> or #f. (open-cache*): Remove. (cache-narinfo!): Take a URL instead of a <cache> as the first parameter. (fetch-narinfos): Likewise. Call 'download-cache-info'. Remove use of 'force'. (guix-substitute): Replace calls to 'open-cache*' with %CACHE-URL. Ludovic Courtès
2015-07-13substitute: Remove unneeded conditionals....* guix/scripts/substitute.scm (guix-substitute): Remove unneeded (if cache ...) forms since CACHE is always true (it's a promise.) Ludovic Courtès
2015-07-07substitute: Avoid infinite loop when updating the substitute list....Reported at <http://lists.gnu.org/archive/html/guix-devel/2015-07/msg00119.html>. * guix/scripts/substitute.scm (http-multiple-get): When RESP has "Connection: close", consume HEAD anyway; always call PROC to read from BODY. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Andy Patterson
2015-05-10Remove assorted Guile 2.0.5 workarounds....* guix/scripts/authenticate.scm (%default-port-conversion-strategy): Remove. * guix/scripts/substitute.scm (fetch): Remove 2.0.5 special cases. * guix/serialization.scm (write-file): Remove 'scandir' workaround. * guix/ui.scm (command-files): Likewise. Ludovic Courtès
2015-05-06download: Work around Guile small-receive-buffer bug....Previously, code using directly (guix build download) was still affected by <http://bugs.gnu.org/15368>. This includes source derivations, the 'guix download' command, and (guix gnu-maintenance). 'guix substitute' was unaffected since it used (guix http-client), which already had the fix. * guix/http-client.scm (open-socket-for-uri): Remove. (http-fetch): Remove #:buffered? argument to 'open-socket-for-uri'; use 'setvbuf' instead. * guix/scripts/substitute.scm (fetch): Likewise. * guix/build/download.scm (open-socket-for-uri): New procedure, taken from guix/http-client.scm, but without the #:buffered? parameter. Ludovic Courtès
2015-05-04substitute: Increase TTL from 24h to 36h....* guix/scripts/substitute.scm (%narinfo-ttl): Increase to 36h. Ludovic Courtès
2015-05-01substitute: Fix file descriptor leak in 'http-multiple-get'....In practice we would not leak much since we reconnect after ~100 requests (with nginx running on hydra.gnu.org.) * guix/scripts/substitute.scm (http-multiple-get): Call 'close-port' before 'connect'. Ludovic Courtès
2015-03-25substitute: Rename cache directory from "substitute-binary" to "substitute"....* guix/scripts/substitute.scm (%narinfo-cache-directory): Change "substitute-binary" to "substitute". * tests/store.scm ("substitute query"): Likewise. * tests/substitute.scm (call-with-narinfo): Likewise. Ludovic Courtès
2015-03-25Rename 'guix substitute-binary' to 'guix substitute'....* guix/scripts/substitute-binary.scm: Rename to... * guix/scripts/substitute.scm: ... this. Adjust module name, entry point, comments, and help string accordingly. * nix/scripts/substitute-binary.in: Rename to... * nix/scripts/substitute.in: ... this. * pre-inst-env.in (NIX_SUBSTITUTERS): Adjust accordingly. * tests/substitute-binary.scm: Rename to... * tests/substitute.scm: ... this. Adjust references to (guix scripts substitute) accordingly. * guix/ui.scm (show-guix-help)[internal?]: Change "substitute-binary" to "substitute". * Makefile.am (MODULES, SCM_TESTS): Adjust to file renames. * daemon.am (nodist_pkglibexec_SCRIPTS): Likewise. * config-daemon.ac: Likewise. * guix/tests.scm (call-with-derivation-narinfo): Adjust comments and docstring. Ludovic Courtès