summaryrefslogtreecommitdiff
path: root/guix/scripts/substitute.scm
AgeCommit message (Collapse)Author
2020-04-26substitute: Close port at the end of http-multiple-get.Christopher Baines
* guix/scripts/substitute.scm (http-multiple-get): Add close-port call.
2020-04-26substitute: Make http-multiple-get batch size configurable.Christopher Baines
* guix/scripts/substitute.scm (http-multiple-get): Add batch-size parameter.
2020-04-26substitute: Use the same port for multiple request batches.Christopher Baines
In http-multiple-get. * guix/scripts/substitute.scm (http-multiple-get): Switch port to p in one occurrence.
2020-03-22Remove workaround for 'time-monotonic' in Guile 2.2.2.Ludovic Courtès
This is a followup to e688c2df3924423b67892cc9939ca099c729d1cb. * build-aux/hydra/evaluate.scm <top level>: Remove 'time-monotonic' definition. * guix/cache.scm: Likewise. * guix/progress.scm: Likewise. * guix/scripts/substitute.scm: Likewise. * guix/scripts/weather.scm: Likewise. * tests/cache.scm: Likewise.
2020-01-15substitute: 'http-multiple-get' processes each request only once.Ludovic Courtès
Fixes <https://bugs.gnu.org/39090>. Reported by Gábor Boskovits <boskovits@gmail.com>. Fixes a regression introduced in 9e3f9ac3c00906f5bc647ea8398e4ed5a370614e. * guix/scripts/substitute.scm (http-multiple-get): In the "Connection: close" case, pass (drop requests (+ 1 processed)) to 'loop' as the remaining REQUESTS value. Previously, we would pass a list containing duplicates, and thus the final result would also contain duplicates. When sent to the daemon, that list would lead to a daemon error: got unexpected path `/gnu/store/…' from substituter
2020-01-03download: Do not leak file descriptors on TLS ports.Ludovic Courtès
Fixes <https://bugs.gnu.org/20145>. * guix/build/download.scm (%tls-ports, register-tls-record-port): Remove. (tls-wrap): Remove call to 'register-tls-record-port'. Return a custom binary input/output port instead. This is a backport of what Guile 2.2's (web client) module has been doing. (close-connection): Define as an alias for 'close-port'. * guix/http-client.scm (http-fetch): Remove #:keep-alive? parameter, which was ignored and unused. Pass #:keep-alive? #f to 'http-get'. * guix/lint.scm (probe-uri): Use 'close-port' instead of 'close-connection'. * guix/scripts/substitute.scm (http-multiple-get): Likewise.
2019-12-12progress: Add 'progress-report-port'.Ludovic Courtès
* guix/scripts/substitute.scm (progress-report-port): Move to... * guix/progress.scm (progress-report-port): ... here. New procedure.
2019-12-12challenge: Report the best narinfo URI.Ludovic Courtès
* guix/scripts/substitute.scm (select-uri): Rename to... (narinfo-best-uri): ... this, and make public. Update callers. * guix/scripts/challenge.scm (summarize-report): Use 'narinfo-best-uri' instead of (first (narinfo-uris ...)).
2019-12-04substitute: Remove unused procedure.Ludovic Courtès
This became unused with commit a9468b422b6df2349a3f4d1451c9302c3d77011b. * guix/scripts/substitute.scm (assert-valid-signature): Remove.
2019-11-28substitute: 'http-multiple-get' no longer drops requests above 1,000.Ludovic Courtès
Previously, in the unlikely case 'http-multiple-get' was passed more than 1,000 requests, it could have dropped all those above 1,000. * guix/scripts/substitute.scm (http-multiple-get): Define 'batch'. Use that for the 'write-request' loop. Add 'processed' parameter to 'loop' and use that to compute the remaining requests and call 'connect' in the recursion base case.
2019-11-27substitute: Make '%allow-unauthenticated-substitutes?' public.Ludovic Courtès
* guix/scripts/substitute.scm (warn-about-missing-authentication): New procedure. (%allow-unauthenticated-substitutes?): Turn into a public parameter and use 'warn-about-missing-authentication'. (valid-narinfo?): Adjust accordingly. * tests/substitute.scm (call-with-narinfo): Likewise.
2019-11-22substitute: Don't fetch /nix-cache-info.Ludovic Courtès
This avoids one GET request every time 'fetch-narinfos' is called. The file itself was essentially useless. * guix/scripts/substitute.scm (<cache-info>, download-cache-info): Remove. (%unreachable-hosts): New variable. (open-connection-for-uri/maybe): New procedure. (fetch-narinfos)[handle-narinfo-response]: Check whether NARINFO has its 'path' under (%store-prefix) and ignore it otherwise. Move 'update-progress!' call before 'if'. [do-fetch]: Remove 'port' parameter. Use 'open-connection-for-uri/maybe'. Remove call to 'download-cache-info'.
2019-06-02substitute: Select the best compression methods.Ludovic Courtès
When a server publishes several URLs with different compression methods, 'guix substitute' can now choose the best one among the compression methods that it supports. * guix/scripts/substitute.scm (<narinfo>)[uri]: Replace with... [uris]: ... this. [compression]: Replace with... [compressions]: ... this. [file-size]: Replace with... [file-sizes]: ... this. [file-hash]: Replace with... [file-hashes]: ... this. (narinfo-maker): Adjust accordingly. Ensure 'file-sizes' and 'file-hashes' have the right length. (assert-valid-signature, valid-narinfo?): Use the first element of 'narinfo-uris' in error messages. (read-narinfo): Expect "URL", "Compression", "FileSize", and "FileHash" to occur multiple times. (display-narinfo-data): Call 'select-uri' to determine the file size. (%compression-methods): New variable. (supported-compression?, compresses-better?, select-uri): New procedures. (process-substitution): Call 'select-uri' to select the URI and compression. * guix/scripts/weather.scm (report-server-coverage): Account for all the values returned by 'narinfo-file-sizes'. * tests/substitute.scm ("substitute, narinfo with several URLs"): New test.
2019-05-01build: Change default substitute server to "ci.guix.gnu.org".Ludovic Courtès
* config-daemon.ac: Replace "ci.guix.info" with "ci.guix.gnu.org". * doc/guix.texi (SUBSTITUTE-SERVER): Likewise. * etc/substitutes/ci.guix.gnu.org.pub: New file. * Makefile.am (dist_pkgdata_DATA): Add it. * guix/scripts/build.scm (%default-log-urls): Update. * guix/scripts/substitute.scm (%default-substitute-urls): Likewise. * guix/store.scm (%default-substitute-urls): Likewise. * guix/self.scm (miscellaneous-files): Add "ci.guix.gnu.org".
2019-01-09Remove most uses of the _IO*F constants.Ludovic Courtès
These constants, for use with 'setvbuf', were deprecated in Guile 2.2 and disappeared in Guile 3.0. Here we keep these constants in build-side code where removing them is not feasible. * guix/build/download-nar.scm (download-nar): Adjust 'setvbuf' calls to the Guile 2.2+ API. * guix/build/download.scm (open-socket-for-uri): Likewise. (open-connection-for-uri, url-fetch): Likewise. * guix/build/make-bootstrap.scm (make-stripped-libc): Likewise. * guix/build/union.scm (setvbuf) [guile-2.0]: New conditional wrapper. (union-build): Adjust to new API. * guix/ftp-client.scm (ftp-open, ftp-list, ftp-retr): Likewise. * guix/http-client.scm (http-fetch): Likewise. * guix/inferior.scm (proxy): Likewise. * guix/scripts/substitute.scm (fetch, http-multiple-get): Likewise. * guix/self.scm (compiled-modules): Likewise. * guix/ssh.scm (remote-daemon-channel, store-import-channel) (store-export-channel): Likewise. * guix/ui.scm (initialize-guix): Likewise. * tests/publish.scm (http-get-port): Likewise. * guix/store.scm (%newlines): Adjust comment.
2018-12-14substitute: Ignore irrelevant narinfo signatures.Ludovic Courtès
Fixes <https://bugs.gnu.org/33733>. Fixes a bug whereby 'guix substitute' would accept narinfos whose signature does not cover the StorePath/NarHash/References tuple. * guix/scripts/substitute.scm (narinfo-sha256)[%mandatory-fields]: New variable. Compute SIGNED-FIELDS; return #f unless each of the %MANDATORY-FIELDS is among SIGNED-FIELDS. * tests/substitute.scm ("query narinfo with signature over nothing") ("query narinfo with signature over irrelevant bits"): New tests.
2018-12-04build: Default to https://ci.guix.info for substitutes.Ludovic Courtès
* config-daemon.ac (guix_substitute_urls): Always default to "https://ci.guix.info". * doc/guix.texi (SUBSTITUTE-SERVER): Switch to ci.guix.info. * guix/scripts/build.scm (%default-log-urls): Likewise. * guix/scripts/substitute.scm (%default-substitute-urls): Likewise. * guix/store.scm (%default-substitute-urls): Likewise.
2018-09-27Add (guix status) and use it for pretty colored output.Ludovic Courtès
* guix/progress.scm (progress-reporter/trace): New procedure. (%progress-interval): New variable. (progress-reporter/file): Use it. * guix/scripts/build.scm (set-build-options-from-command-line): Pass #:print-extended-build-trace?. (%default-options): Add 'print-extended-build-trace?'. (guix-build): Parameterize CURRENT-TERMINAL-COLUMNS. Use 'build-status-updater'. * guix/scripts/environment.scm (%default-options): Add 'print-extended-build-trace?'. (guix-environment): Wrap body in 'with-status-report'. * guix/scripts/pack.scm (%default-options): Add 'print-build-trace?' and 'print-extended-build-trace?'. (guix-pack): Wrap body in 'with-status-report'. * guix/scripts/package.scm (%default-options, guix-package): Likewise. * guix/scripts/system.scm (%default-options, guix-system): Likewise. * guix/scripts/pull.scm (%default-options, guix-pull): Likewise. * guix/scripts/substitute.scm (progress-report-port): Don't call STOP when TOTAL is zero. (process-substitution): Add #:print-build-trace? and honor it. (guix-substitute)[print-build-trace?]: New variable. Pass #:print-build-trace? to 'process-substitution'. * guix/status.scm: New file. * guix/store.scm (set-build-options): Add #:print-extended-build-trace?; pass it into PAIRS. (%protocol-version): Bump. (protocol-version, nix-server-version): New procedures. (current-store-protocol-version): New variable. (with-store, build-things): Parameterize it. * guix/ui.scm (build-output-port): Remove. (colorize-string): Export. * po/guix/POTFILES.in: Add guix/status.scm. * tests/status.scm: New file. * Makefile.am (SCM_TESTS): Add it. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x162. * nix/libstore/build.cc (DerivationGoal::registerOutputs) (SubstitutionGoal::finished): Print a "@ hash-mismatch" trace before throwing.
2018-09-25substitute: Progress port really closes underlying port.Ludovic Courtès
* guix/scripts/substitute.scm (progress-report-port): Use 'close-port' instead of 'close-connection'. Move 'stop' call first.
2018-09-10substitute: Ignore exceptions thrown by 'set-thread-name'.Ludovic Courtès
Fixes <https://bugs.gnu.org/32669>. Reported by Ricardo Wurmus <rekado@elephly.net>. * guix/scripts/substitute.scm (guix-substitute): Swallow 'system-error' exceptions around 'set-thread-name' call.
2018-09-04Switch to Guile-Gcrypt.Ludovic Courtès
This removes (guix hash) and (guix pk-crypto), which now live as part of Guile-Gcrypt (version 0.1.0.) * guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm, tests/hash.scm, tests/pk-crypto.scm: Remove. * configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and LIBGCRYPT_LIBDIR assignments. * m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove. * README: Add Guile-Gcrypt to the dependencies; move libgcrypt as "required unless --disable-daemon". * doc/guix.texi (Requirements): Likewise. * gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm, guix/git.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm, guix/import/gnu.scm, guix/import/hackage.scm, guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm, guix/pki.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/download.scm, guix/scripts/hash.scm, guix/scripts/pack.scm, guix/scripts/publish.scm, guix/scripts/refresh.scm, guix/scripts/substitute.scm, guix/store.scm, guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm, tests/builders.scm, tests/challenge.scm, tests/cpan.scm, tests/crate.scm, tests/derivations.scm, tests/gem.scm, tests/nar.scm, tests/opam.scm, tests/pki.scm, tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm, tests/store.scm, tests/substitute.scm: Adjust imports. * gnu/system/vm.scm: Likewise. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (expression->derivation-in-linux-vm)[config]: Remove. (iso9660-image)[config]: Remove. (qemu-image)[config]: Remove. (system-docker-image)[config]: Remove. * guix/scripts/pack.scm: Adjust imports. (guile-sqlite3&co): Rename to... (gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT. (self-contained-tarball)[build]: Call 'make-config.scm' without #:libgcrypt argument. (squashfs-image)[libgcrypt]: Remove. [build]: Call 'make-config.scm' without #:libgcrypt. (docker-image)[config, json]: Remove. [build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from the imported modules. * guix/self.scm (specification->package): Remove "libgcrypt", add "guile-gcrypt". (compiled-guix): Remove #:libgcrypt. [guile-gcrypt]: New variable. [dependencies]: Add it. [*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call. Add #:extensions. [*config*]: Remove #:libgcrypt from 'make-config.scm' call. (%dependency-variables): Remove %libgcrypt. (make-config.scm): Remove #:libgcrypt. * build-aux/build-self.scm (guile-gcrypt): New variable. (make-config.scm): Remove #:libgcrypt. (build-program)[fake-gcrypt-hash]: New variable. Add (gcrypt hash) to the imported modules. Adjust load path assignments. * gnu/packages/package-management.scm (guix)[propagated-inputs]: Add GUILE-GCRYPT. [arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search path.
2018-07-07scripts: Add missing -V option to commands that document it.Kyle Meyer
* guix/scripts/container.scm (guix-container): * guix/scripts/import.scm (guix-import): * guix/scripts/substitute.scm (guix-substitute): Add -V as the short option for --version to match show-help's description. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-06-12substitute: Make progress message shorter.Ludovic Courtès
* guix/scripts/substitute.scm (fetch-narinfos)[update-progress!]: Shorten progress message so it fits on 80 columns.
2018-06-12substitute: Erase the current line when reporting progress.Ludovic Courtès
* guix/scripts/substitute.scm (fetch-narinfos)[update-progress!]: Use the ANSI erase-current-line sequence next to \r.
2018-02-26build: Require Guile >= 2.0.13.Ludovic Courtès
* README, configure.ac, doc/guix.texi (Requirements): Increase minimum Guile version from 2.0.9 to 2.0.13. * config-daemon.ac: Remove use of 'GUIX_CHECK_UNBUFFERED_CBIP'. * m4/guix.m4 (GUIX_CHECK_UNBUFFERED_CBIP): Remove. * guix/build/download.scm (current-http-proxy): Remove. * guix/build/syscalls.scm (%libc-errno-pointer, errno): Remove. (syscall->procedure): Use #:return-errno unconditionally. * guix/hash.scm (open-sha256-input-port)[unbuffered]: Remove outdated comment. * guix/http-client.scm (when-guile<=2.0.5-or-otherwise-broken): Remove. <top level>: Remove 'when-guile<=2.0.5-or-otherwise-broken' block. * guix/scripts/substitute.scm (fetch): Remove 'guile-version>?' conditional. * tests/hash.scm (supports-unbuffered-cbip?): Remove. <top level>: Remove 'test-skip' call.
2017-10-25substitute: Don't send more than 1000 requests in a row.Ludovic Courtès
Fixes <https://bugs.gnu.org/28731>. Reported by Jan Nieuwenhuizen <janneke@gnu.org>. * guix/scripts/substitute.scm (at-most): New procedure. (http-multiple-get): Use it to send at most 1000 requests at once.
2017-10-19Add (guix progress).Ludovic Courtès
Among other things, this removes (guix utils), (guix ui), (guix config), etc. from the closure of (guix build download), as was the case since 798648515b77507c242752457b4dc17c155bad6e. * guix/utils.scm (<progress-reporter>, call-with-progress-reporter): Move to... * guix/progress.scm: ... here. New file. * Makefile.am (MODULES): Add it. * guix/build/download.scm (current-terminal-columns) (nearest-exact-integer, duration->seconds, seconds->string) (byte-count->string, progress-bar, string-pad-middle) (rate-limited, progress-reporter/file, dump-port*) (time-monotonic): Move to progress.scm. * guix/scripts/download.scm: Adjust accordingly. * guix/scripts/substitute.scm: Likewise.
2017-10-17guix: substitute: Report the last progress in the child process.宋文武
Fixes <https://bugs.gnu.org/28756>. * guix/utils.scm (filtered-port): Close the 'input' port for the current process, and close it upon exit in the child process. * guix/scripts/substitute.scm (progress-substitution): Display "\n\n" after the reporter has finished.
2017-10-12substitute: Close the progress port after substitute finished.宋文武
Fixes <https://bugs.gnu.org/28756>. * guix/scripts/substitute.scm (progress-substitution): Call '(close-port progress)'.
2017-09-20download: Don't report the progress too fast.宋文武
* guix/utils.scm (<progress-reporter>): New record type. (call-with-progress-reporter): New procedure. * guix/build/download.scm (dump-port*, rate-limited, progress-reporter/file): New procedures. (ftp-fetch, http-fetch): Use 'dump-port*'. (progress-proc): Remove procedure. * guix/scripts/substitute.scm (progress-report-port): Rewrite in terms of <progress-reporter>. (process-substitution): Adjust accordingly.
2017-09-18substitute: Close the download port after substitution finished.宋文武
* guix/scripts/substitute.scm (progress-substitution): Call 'close-port' after 'restore-file'.
2017-09-11substitute: Download from unauthorized sources that provide the right content.Ludovic Courtès
This allows substitutes to be downloaded from unauthorized servers, as long as they advertise the same hash and references as one of the authorized servers. * guix/scripts/substitute.scm (assert-valid-narinfo): Remove. (valid-narinfo?): Add #:verbose?. Handle each case of 'signature-case'. (equivalent-narinfo?): New procedure. (lookup-narinfos/diverse): Add 'authorized?' parameter and honor it. [select-hit]: New procedure. (lookup-narinfo): Add 'authorized?' parameter and pass it. (process-query): Adjust callers accordingly. (process-substitution): Remove call to 'assert-valid-narinfo'. Check whether 'lookup-narinfo' returns true and call 'leave' if not. * tests/substitute.scm (%main-substitute-directory) (%alternate-substitute-directory): New variables. (call-with-narinfo): Make 'narinfo-directory' a parameter. Call 'mkdir-p' to create it. Change unwind handler to check whether CACHE-DIRECTORY exists before deleting it. (with-narinfo*): New macro. ("substitute, no signature") ("substitute, invalid hash") ("substitute, unauthorized key"): Change expected error message to "no valid substitute". ("substitute, unauthorized narinfo comes first") ("substitute, unsigned narinfo comes first") ("substitute, first narinfo is unsigned and has wrong hash") ("substitute, first narinfo is unsigned and has wrong refs") ("substitute, unsigned narinfo comes first") ("substitute, two invalid narinfos"): New tests. * doc/guix.texi (Substitutes): Explain the new behavior.
2017-09-11substitute: Make substitute URLs a SRFI-39 parameter.Ludovic Courtès
* guix/scripts/substitute.scm (%cache-urls): Rename to... (%default-substitute-urls): ... this. (substitute-urls): New variable. (guix-substitute): Use it instead of %CACHE-URLS. * tests/substitute.scm: Likewise.
2017-07-28utils: Factorize XDG directory handling.Ludovic Courtès
* guix/ui.scm (config-directory): Remove. * guix/utils.scm (xdg-directory, config-directory): New procedures. (cache-directory): Rewrite in terms of 'xdg-directory'. * guix/scripts/substitute.scm (%narinfo-cache-directory): Pass #:ensure? #f to 'cache-directory'.
2017-07-21substitute: Avoid repeated calls to 'length'.Ludovic Courtès
* guix/scripts/substitute.scm (fetch-narinfos)[update-progress!]: Move 'length' call outside of lambda.
2017-07-21substitute: Optimize hash-part-to-path conversion on non-200 responses.Ludovic Courtès
Previously this operation was linear in the number of requests and involved costly calls to 'string-contains'. * guix/scripts/substitute.scm (fetch-narinfos)[hash-part->path]: New procedure. [handle-narinfo-response]: Use it for caching when CODE is not 200.
2017-07-12substitute: Work around Guile 2.2 'time-monotonic' bug.Ludovic Courtès
Prior to this change, half of the cached narinfos would expire immediately since they contained the number of nanoseconds instead of the number of seconds as their date. * guix/scripts/substitute.scm (time-monotonic) <guile-2.2>: Define, as a workaround.
2017-06-02substitute: Do not display the installed size.Ludovic Courtès
* guix/scripts/substitute.scm (process-substitution): Do not show the installed size in the "Downloading" message.
2017-05-28scripts: Set thread names.Ludovic Courtès
This allows 'guix publish' threads as well as 'guix substitute' and 'guix offload' processes to be properly labeled in 'top', 'pstree', etc. * guix/workers.scm (worker-thunk): Add #:thread-name parameter and honor it. (make-pool): Likewise. * guix/scripts/publish.scm (http-write): Add calls to 'set-thread-name' in bodies of 'call-with-new-thread'. (guix-publish): Call 'set-thread-name'. Pass #:thread-name to 'make-pool'. * guix/scripts/offload.scm (guix-offload): Call 'set-thread-name'. * guix/scripts/substitute.scm (guix-substitute): Likewise.
2017-05-11substitute: Honor 'Cache-Control' on 404 responses.Ludovic Courtès
* guix/scripts/substitute.scm (cached-narinfo): When VALUE is #f, use the TTL that is read instead of %NARINFO-NEGATIVE-TTL. (cached-narinfo-expiration-time): Likewise.
2017-05-03ui: Rename '_' to 'G_'.Ludovic Courtès
This avoids collisions with '_' when the latter is used as a 'match' pattern for instance. See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>. * guix/ui.scm: Rename '_' to 'G_'. * po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly. * build-aux/compile-all.scm (warnings): Remove 'format'. * gnu/packages.scm, gnu/services.scm, gnu/services/shepherd.scm, gnu/system.scm, gnu/system/shadow.scm, guix/gnupg.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/elpa.scm, guix/import/pypi.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/container.scm, guix/scripts/container/exec.scm, guix/scripts/copy.scm, guix/scripts/download.scm, guix/scripts/edit.scm, guix/scripts/environment.scm, guix/scripts/gc.scm, guix/scripts/graph.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/import/cpan.scm, guix/scripts/import/cran.scm, guix/scripts/import/crate.scm, guix/scripts/import/elpa.scm, guix/scripts/import/gem.scm, guix/scripts/import/gnu.scm, guix/scripts/import/hackage.scm, guix/scripts/import/nix.scm, guix/scripts/import/pypi.scm, guix/scripts/import/stackage.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/perform-download.scm, guix/scripts/publish.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/scripts/system.scm, guix/ssh.scm, guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-02substitute: Validate substitute URLs.Ludovic Courtès
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com> at <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00548.html>. * guix/scripts/substitute.scm (validate-uri): New procedure. (guix-substitute): Use it.
2017-04-18Add (guix cache) and use it in (guix scripts substitute).Ludovic Courtès
* guix/cache.scm, tests/cache.scm: New files. * Makefile.am (MODULES, SCM_TESTS): Add them. * guix/scripts/substitute.scm (obsolete?): Remove. (remove-expired-cached-narinfos): Rename to... (cached-narinfo-expiration-time): ... this. Remove the removal part and only keep the expiration time part. (narinfo-cache-directories): Add optional 'directory' parameter and honor it. (maybe-remove-expired-cached-narinfo): Remove. (cached-narinfo-files): New procedure. (guix-substitute): Use 'maybe-remove-expired-cache-entries' instead of 'maybe-remove-expired-cached-narinfo'.
2017-03-31substitute: Send ‘User-Agent’ header.Tobias Geerinckx-Rice
* guix/scripts/substitute.scm (narinfo-request): Pass ‘User-Agent’ #:headers to ‘build-request’.
2017-03-18http-client: Avoid name clash with 'open-connection-for-uri' in 2.2.0.Ludovic Courtès
* guix/build/download.scm (open-connection-for-uri): Add note about same-named binding in Guile 2.2.0. * guix/http-client.scm: Use 'guix:open-connection-for-uri' for the procedure coming from (guix build download). * guix/scripts/lint.scm: Likewise. * guix/scripts/substitute.scm: Likewise.
2016-11-12substitute: Disable HTTPS certificate verification.Ludovic Courtès
Fixes a regression introduced in 9e4e431e049fae3f1121c3be22cf13b174404ba8 as a consequence of bc3c41ce36349ed4ec758c70b48a7059e363043a. Reported by Marius Bakke <mbakke@fastmail.com>. * guix/scripts/substitute.scm (fetch): Pass #:verify-certificate? #f to 'open-connection-for-uri' and 'http-fetch'. (download-cache-info): Likewise. (http-multiple-get): Add #:verify-certificate? and honor it. (fetch-narinfos): Pass #:verify-certificate? #f.
2016-10-19Use (ice-9 binary-ports) instead of (rnrs io ports).Ludovic Courtès
This reduces the closure of (guix ui) from 123 to 106 modules. * guix/derivations.scm: Use (ice-9 binary-ports) instead of (rnrs io ports). (map-derivation)[substitute-file]: Use 'read-string' instead of 'get-string-all'. * guix/ftp-client.scm: Likewise. * guix/hash.scm: Likewise. * guix/http-client.scm: Likewise. * guix/pki.scm (ensure-acl, current-acl): Likewise. * guix/scripts/archive.scm (authorize-key)[read-key]: Likewise. * guix/scripts/authenticate.scm (read-canonical-sexp) (read-hash-data): Likewise. * guix/scripts/download.scm: Likewise. * guix/scripts/offload.scm (register-gc-root, remove-gc-roots) (send-files): Likewise. * guix/scripts/publish.scm (lazy-read-file-sexp): Likewise. * guix/scripts/refresh.scm: Likewise. * guix/scripts/substitute.scm (check-acl-initialized): Likewise. * guix/serialization.scm (read-maybe-utf8-string): Likewise. * guix/scripts/hash.scm (guix-hash): Use 'force-output' instead of 'flush-output-port'. * guix/store.scm (process-stderr): Likewise. * guix/tests.scm: Likewise. * guix/utils.scm: Use (ice-9 binary-ports) and autoload (rnrs io ports) for 'make-custom-binary-input-port'.
2016-10-10substitute: Make download messages more concise.Ludovic Courtès
'guix substitute' now displays 2 lines per download instead of 4. Suggested by Ricardo Wurmus. * guix/scripts/substitute.scm (assert-valid-narinfo): Have #:verbose? default to #f. Remove leading newline in message. (process-substitution): Display the URI rather than the store file name. Display two newlines after the substitution.
2016-09-20ui: Do not shadow '_' where it's used as a literal syntax match.Ludovic Courtès
Fixes compilation with Guile 2.1. Reported by Mu Lei. * guix/ui.scm (report-load-error) (warn-about-load-error, read/eval-package-expression): Use 'rest' instead of '_' as the pattern variable name. * gnu/packages.scm (%find-package): Likewise. * guix/scripts/build.scm (transform-package-inputs): Likewise. * guix/scripts/hash.scm (guix-hash): Likewise. * guix/scripts/import/gnu.scm (%options, guix-import-gnu): Likewise. * guix/scripts/import/nix.scm (guix-import-nix): Likewise. * guix/scripts/offload.scm (build-machines): Likewise. * guix/scripts/refresh.scm (%options): Likewise. * guix/scripts/substitute.scm (narinfo-signature->canonical-sexp): Likewise.
2016-07-14substitute: Gracefully handle trailing slashes in URLs.Ludovic Courtès
Previously, using something like "--substitute-urls=http://example.org///" would lead to a 'cache-narinfo!' call with #f as its second argument. It would also do the wrong thing for URLs with a non-empty initial path component, such as "http://example.org/foo/bar". * guix/scripts/substitute.scm (fetch-narinfos)[handle-narinfo-response]: Add call to 'basename' for PATH.