summaryrefslogtreecommitdiff
path: root/guix/build/download.scm
Commit message (Collapse)AuthorAge
* download: Print URL of the Disarchive spec being read.Ludovic Courtès2021-10-14
| | | | | * guix/build/download.scm (disarchive-fetch/any): Show URI of the Disarchive spec.
* download: Add missing autoload.Ludovic Courtès2021-10-14
| | | | | | | This is a followup to 6d02a994f911a75e3a223a22c05c2939cdfed2b5, which left '%verify-swh-certificate?' unbound. * guix/build/download.scm: Autoload for '%verify-swh-certificate'.
* download: Honor #:verify-certificate? for SWH downloads.Ludovic Courtès2021-10-07
| | | | | | | | | | | | | | | | | | | Previously, the SWH + Disarchive fallback could fail with: Trying to use Disarchive to assemble /gnu/store/…-ucsim-0.6-pre68.tar.gz... Assembling the directory ucsim-0.6-pre68 Downloading /gnu/store/…-ucsim-0.6-pre68.tar.gz from Software Heritage... X.509 certificate of 'archive.softwareheritage.org' could not be verified: signer-not-found invalid Could not resolve directory reference This will no longer be the case since 'guix perform-download' passes #:verify-certificate? #f. * guix/build/download.scm (disarchive-fetch/any): Parameterize '%verify-swh-certificate?'.
* download: Fall back to web.archive.org as a very last resort.Ludovic Courtès2021-09-22
| | | | | | | | Suggested by Florian Pelz <pelzflorian@pelzflorian.de>. * guix/build/download.scm (internet-archive-uri): New procedure. (url-fetch): Append it to the list of URIs after CONTENT-ADDRESSED-URIS.
* download: Disarchive mirrors can be URL-returning procedures.Ludovic Courtès2021-09-14
| | | | | | | | | | As discussed at <https://issues.guix.gnu.org/47336#16>. * guix/build/download.scm (url-fetch)[disarchive-uris]: Accept MIRROR as a procedure. * guix/download.scm (%disarchive-mirrors): Add comment. This change can only be made once a 'guix perform-download' that understands procedures is widely deployed.
* download: 'tls-wrap' retries handshake upon non-fatal errors.Ludovic Courtès2021-06-25
| | | | | | | | Fixes <https://bugs.gnu.org/49223>. Reported by Domagoj Stolfa <ds815@gmx.com>. * guix/build/download.scm (tls-wrap): Retry up to 5 times when 'handshake' throws a non-fatal error.
* download: Restore error reporting.Timothy Sample2021-05-05
| | | | | | | | | | | Normal error reporting was disrupted by the introduction of Disarchive in commit fbc2a52a32ddc664db8ebab420c2e17b1432c744. In particular, running 'guix download' would succeed with a partially downloaded file. * guix/build/download.scm (disarchive-fetch/any): Return '#f' when Disarchive cannot be found, the specification cannot be found, or Disarchive fails due to an error.
* download: Use Disarchive as a last resort.Timothy Sample2021-04-29
| | | | | | | | | | | | | | | | | | | | | | This is a fixed version of 66b14dccdd0d83c875ce3a8d50ceab8b6f0a3ce2, which was reverted in e74250c3c535b75dd2225a26df51febb7ed94654. * guix/download.scm (%disarchive-mirrors): New variable. (%disarchive-mirror-file): New variable. (built-in-download): Add 'disarchive-mirrors' keyword argument and pass its value along to the 'builtin:download' derivation. (url-fetch): Pass '%disarchive-mirror-file' to 'built-in-download'. * guix/scripts/perform-download.scm (perform-download): Read Disarchive mirrors from the environment and pass them to 'url-fetch'. * guix/build/download.scm (disarchive-fetch/any): New procedure. (url-fetch): Add 'disarchive-mirrors' keyword argument, use it to make a list of URIs, and use the new procedure to fetch the file if all other methods fail. * build-aux/build-self.scm (build-program)[select?]: Exclude '(guix build download)'. * guix/self.scm (compiled-guix)[*core-modules*]: Add 'guile-json' to the list of extensions.
* Revert "download: Use Disarchive as a last resort."Timothy Sample2021-04-28
| | | | | This reverts commit 66b14dccdd0d83c875ce3a8d50ceab8b6f0a3ce2, which broke 'guix pull'.
* download: Use Disarchive as a last resort.Timothy Sample2021-04-27
| | | | | | | | | | | | | | | * guix/download.scm (%disarchive-mirrors): New variable. (%disarchive-mirror-file): New variable. (built-in-download): Add 'disarchive-mirrors' keyword argument and pass its value along to the 'builtin:download' derivation. (url-fetch): Pass '%disarchive-mirror-file' to 'built-in-download'. * guix/scripts/perform-download.scm (perform-download): Read Disarchive mirrors from the environment and pass them to 'url-fetch'. * guix/build/download.scm (disarchive-fetch/any): New procedure. (url-fetch): Add 'disarchive-mirrors' keyword argument, use it to make a list of URIs, and use the new procedure to fetch the file if all other methods fail.
* download: 'tls-wrap' treats premature TLS termination as EOF.Ludovic Courtès2021-03-19
| | | | | | | | This is a backport of Guile commit 076276c4f580368b4106316a77752d69c8f1494a. * guix/build/download.scm (tls-wrap)[read!]: Wrap 'get-bytevector-n!' call in 'catch' and handle 'error/premature-termination' GnuTLS errors.
* download: 'tls-wrap' returns an unbuffered custom port.Ludovic Courtès2021-03-11
| | | | | | | | Partly fixes <https://bugs.gnu.org/46967>. * guix/build/download.scm (tls-wrap)[unbuffered]: New procedure. Pass the result of 'make-custom-binary-input/output-port' to 'unbuffered'.
* download: 'tls-wrap' avoids intermediate buffer.Ludovic Courtès2021-03-11
| | | | | * guix/build/download.scm (tls-wrap)[read!]: Read straight into BV instead of calling 'get-bytevector-some' and 'unget-bytevector'.
* download: Delete the output file upon failure.Ludovic Courtès2020-03-22
| | | | | | | | | | This allows ENOSPC conditions to be properly reported as such rather than as a hash mismatch due to the availability of a truncated file. Fixes <https://bugs.gnu.org/39993>. Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>. * guix/build/download.scm (url-fetch): In the failure case, delete FILE.
* download: Remove (web http) workarounds no longer relevant.Ludovic Courtès2020-03-11
| | | | | | * guix/build/download.scm <top level>: Remove workarounds for <https://bugs.gnu.org/23421> and for <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00070.html>.
* download, git: Refer to the right module in 'module-use!' call.Ludovic Courtès2020-01-07
| | | | | | | | | This fixes a regression introduced in 6a7c4636d4dec47eefa03c95da5a1315bd0e0413. * guix/build/download.scm (load-gnutls): Call 'resolve-module' instead of 'current-module'. * guix/git.scm (load-git-submodules): Likewise.
* Adjust module autoloads.Ludovic Courtès2020-01-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Guile < 2.9.7, autoloading a module would give you access to all its bindings. In future versions, autoloading a module gives access only to the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>). This commit adjusts autoloads to the new semantics, allowing Guix to be built with Guile 2.9.7/2.9.8. * guix/build/download.scm <top level>: Remove call to 'module-autoload!'. (load-gnutls): New procedure. (tls-wrap): Call it. * guix/git.scm <top level>: Remove call to 'module-autoload!'. (load-git-submodules): New procedure. (update-submodules): Call it instead of 'resolve-interface'. * gnu/bootloader/grub.scm: Replace #:autoload with #:use-module. * gnu/packages.scm: Likewise. * gnu/packages/ssh.scm: Likewise. * gnu/packages/tex.scm: Likewise. * gnu/services/cuirass.scm: Likewise. * gnu/services/mcron.scm: Likewise. * guix/lint.scm: Augment list of bindings in #:autoload. * guix/scripts/build.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/pack.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/utils.scm: Remove unnecessary #:autoload clauses; replace one of them with #:use-module.
* download: Do not leak file descriptors on TLS ports.Ludovic Courtès2020-01-03
| | | | | | | | | | | | | | | 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.
* download: Enable TLS 1.3.Marius Bakke2019-12-26
| | | | | | This reverts commit e4ee84202633636b4c8cef4a332f0c74912a3b23. * guix/build/download.scm (tls-wrap): Dot not disable TLS 1.3.
* download: Load *.crt certificate bundles when *.pem files are missing.Ludovic Courtès2019-11-18
| | | | | | | Fixes <https://bugs.gnu.org/38254>. * guix/build/download.scm (make-credendials-with-ca-trust-files): Look for *.crt files under DIRECTORY when *.pem files cannot be found.
* download: Honor /etc/ssl/certs when 'SSL_CERT_DIR' is not set.Ludovic Courtès2019-10-21
| | | | | | | * guix/build/download.scm (%x509-certificate-directory): Use "/etc/ssl/certs" as a last resort. This ensures, for instance, that 'guix download' honors system-wide certificates when SSL_CERT_DIR is unset.
* download: Support 'https_proxy'.宋文武2019-05-13
| | | | | * guix/build/download.scm (setup-http-tunnel): New procedure. (open-connection-for-uri): Honor the 'https_proxy' environment variable.
* download: Ask not to use TLS 1.3.Ludovic Courtès2019-01-26
| | | | | | | | Works around <https://bugs.gnu.org/34102>. Reported by Marius Bakke <mbakke@fastmail.com>. * guix/build/download.scm (tls-wrap): Add "-VERS-TLS1.3" to the priority string when (gnutls-version) is not prefixed by "3.5".
* Remove most uses of the _IO*F constants.Ludovic Courtès2019-01-09
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* download: Remove Guile 2.0 workaround.Ludovic Courtès2019-01-09
| | | | * guix/build/download.scm: Remove Guile 2.0 workaround.
* maint: Remove 'cond-expand' forms for Guile 2.0.Ludovic Courtès2019-01-09
| | | | | | | | | | | | | | | | | | | | | | Note: Leave 'cond-expand' forms used in the build-side modules that can run on %BOOTSTRAP-GUILE, which is currently Guile 2.0. * guix/build/compile.scm: Move 'use-modules' clause from 'cond-expand' to 'define-module' form. (%default-optimizations): Remove 'cond-expand'. * guix/build/download.scm (tls-wrap): Remove 'cond-expand'. * guix/build/syscalls.scm: Remove 'cond-expand' form around '%set-automatic-finalization-enabled?!' and 'without-automatic-finalization'. * guix/inferior.scm (port->inferior): Remove 'cond-expand'. * guix/scripts/pack.scm (wrapped-package)[build]: Remove 'cond-expand'. * guix/status.scm (build-event-output-port): Remove 'cond-expand'. * guix/store.scm (open-inet-socket): Remove 'cond-expand'. * guix/ui.scm (install-locale): Remove 'cond-expand'. * tests/status.scm ("current-build-output-port, UTF-8 + garbage"): Remove 'cond-expand'. * tests/store.scm ("current-build-output-port, UTF-8 + garbage"): Remove 'cond-expand'.
* perform-download: Optionally report a "download-progress" trace.Ludovic Courtès2018-09-27
| | | | | | | | | | | | * guix/scripts/perform-download.scm (perform-download): Add #:print-build-trace? and pass it to 'url-fetch'. (guix-perform-download): Define 'print-build-trace?' and pass it to 'perform-download'. * guix/build/download.scm (ftp-fetch): Add #:print-build-trace? and honor it. (url-fetch): Likewise. * nix/libstore/builtins.cc (builtinDownload): Set _NIX_OPTIONS environment variable.
* build: Require Guile >= 2.0.13.Ludovic Courtès2018-02-26
| | | | | | | | | | | | | | | | | | * 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.
* download: Fix return value of the url-fetch procedure.Maxim Cournoyer2018-01-28
| | | | | | | | | Fixes <https://bugs.gnu.org/30270>. Regression was introduced by commit 347fa4aebf. * guix/build/download.scm (url-fetch): Return `file' instead of #t upon success. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* utils: Fix cond-expand for Guile 2.0.Eric Bavier2017-12-10
| | | | * guix/build/download.scm (tls-wrap): Use 'guile-2.2' feature instead.
* download: Improve efficiency of 'write-request' over TLS.Ludovic Courtès2017-11-16
| | | | | | | | This is another instance of <https://bugs.gnu.org/22966>. The Microsoft-IIS/7.5 server at static.nvd.nist.gov would sometimes hang when receiving our requests byte by byte. * guix/build/download.scm (tls-wrap) [!guile-2.0]: Add 'setvbuf' call.
* download: Pass the timeout to 'ftp-retr'.Ludovic Courtès2017-11-14
| | | | | | | | | | This ensures the timeout applies when connecting to the port returned by PASV. * guix/ftp-client.scm (ftp-list): Add #:timeout parameter. Use 'connect*' instead of 'connect' and pass TIMEOUT. (ftp-retr): Likewise. * guix/build/download.scm (ftp-fetch): Pass TIMEOUT to 'ftp-retr'.
* download: Work around more bogus HTTP handling in Guile 2.2 <= 2.2.2.Ludovic Courtès2017-11-11
| | | | | | | | Reported by Mark H Weaver <mhw@netris.org> at <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00190.html>. * guix/build/download.scm (guile-2.2) [write-request-line]: Backport Guile commit 6ad28ae3bc6a6d9e95ab7d70510d12c97673a143.
* download: Work around bogus HTTP handling in Guile 2.2 <= 2.2.2.Ludovic Courtès2017-11-10
| | | | | | | | Reported by Konrad Hinsen <konrad.hinsen@fastmail.net> at <https://lists.gnu.org/archive/html/guix-devel/2017-11/msg00070.html>. * guix/build/download.scm (write-request-line) [guile-2.2]: New procedure.
* Add (guix progress).Ludovic Courtès2017-10-19
| | | | | | | | | | | | | | | | | | 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.
* download: Make 'http-fetch' public.Ludovic Courtès2017-10-19
| | | | | | * guix/build/download.scm (http-fetch): Remove 'file' parameter. Change to return an input port and the content-length. Make public. (url-fetch): Adjust accordingly.
* download: Remove old-Guile leftovers.Ludovic Courtès2017-10-19
| | | | | | | This is a followup to 36626c556ed75219bce196ac93d148f6b9af984c. * guix/build/download.scm (http-fetch): Rename 'port-or-bv' to 'port'. Assume (port? port) is always true, and remove other branch.
* download: Don't report the progress too fast.宋文武2017-09-20
| | | | | | | | | | | | * 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.
* Handle the same HTTP redirects everywhere.Tobias Geerinckx-Rice2017-09-05
| | | | | | | * guix/build/download.scm (http-fetch): Complete the hard-coded list of HTTP redirection status codes. * guix/http-client.scm (http-fetch): Likewise. * guix/scripts/lint.scm (probe-uri): Likewise.
* download: Work around GnuTLS bug with UTF-8 certificate file names.Ludovic Courtès2017-05-30
| | | | | | | | | | Reported by Mark H Weaver <mhw@netris.org> at <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26948#17>. * guix/build/download.scm (set-certificate-credentials-x509-trust-file!*): New procedure. (make-credendials-with-ca-trust-files): Use it instead of 'set-certificate-credentials-x509-trust-file!'.
* download: Continue handshake upon TLS warning alerts.Ludovic Courtès2017-05-02
| | | | | | | | | | This allows us to download from site such as <https://fusionforge.int-evry.fr> where the server does not recognize the server name passed via the 'server_name' extension. * guix/build/download.scm (tls-wrap): Catch 'gnutls-error' around 'handshake'. Upon ERROR/WARNING-ALERT-RECEIVED, print a message and call 'handshake'.
* cache: Work around 'time-monotonic' bug in Guile 2.2.2.Ludovic Courtès2017-04-22
| | | | | | | * guix/cache.scm (time-monotonic) [guile-2.2]: New variable. * tests/cache.scm (time-monotonic) [guile-2.2]: Likewise. * guix/build/download.scm (time-monotonic) [guile-2.2]: Adjust comment: it's a 2.2.2 bug.
* download: Work around Guile 2.2 bug with 'time-monotonic' objects.Ludovic Courtès2017-04-22
| | | | * guix/build/download.scm (time-monotonic) [guile-2.2]: New variable.
* download: Properly parse ftp:// URLs that lack user info.Ludovic Courtès2017-03-28
| | | | | | | | | | | Fixes a regression introduced in a4f542341511f33ece18d16b68118214da8143ec. Reported by Hartmut Goebel. * guix/build/download.scm (ftp-fetch): Account for the case where 'uri-userinfo' returns #f. Remove the case where it returns "" since that cannot happen.
* download: Handle username and password properties for FTP URIs.Roel Janssen2017-03-21
| | | | * guix/build/download.scm (ftp-fetch): Process username and password from a URI.
* http-client: Avoid name clash with 'open-connection-for-uri' in 2.2.0.Ludovic Courtès2017-03-18
| | | | | | | | | * 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.
* build: Require Guile >= 2.0.9.Ludovic Courtès2017-03-18
| | | | | | | | | | | | | | | | * configure.ac: Bump requirement to 2.0.9. * doc/guix.texi (Requirements): Adjust accordingly. * README (Requirements): Likewise. * build-aux/download.scm: Remove workaround for <http://bugs.gnu.org/13095>. * guix/build/download.scm: Likewise. (http-fetch)[post-2.0.7?]: Remove. Remove conditional code for not POST-2.0.7?. * guix/http-client.scm: Remove workaround for <http://bugs.gnu.org/13095>. (http-fetch)[post-2.0.7?]: Remove. Remove conditional code for not POST-2.0.7?. * guix/serialization.scm (read-latin1-string): Remove mention of 2.0.9. * tests/nar.scm: Use (ice-9 control). (let/ec): Remove.
* download: Export '%x509-certificate-directory'.Ludovic Courtès2017-03-13
| | | | | | * guix/build/download.scm (%x509-certificate-directory): Export, as expected by (guix scripts pull) since commit 7e81d699de7a2c924a048175516fe1ac3820d8e6.
* download: Protect against dangling symlinks in $SSL_CERT_DIR.Ludovic Courtès2016-12-16
| | | | | | | | | Reported by Christopher Baines <mail@cbaines.net> in <https://bugs.gnu.org/25213>. * guix/build/download.scm (make-credendials-with-ca-trust-files): Check whether FILE exists before calling 'set-certificate-credentials-x509-trust-file!'.
* download: Verify TLS certificates unless asked not to.Ludovic Courtès2016-11-07
| | | | | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/24466>. Reported by Leo Famulari <leo@famulari.name>. * guix/build/download.scm (%x509-certificate-directory): New variable. (make-credendials-with-ca-trust-files, peer-certificate) (assert-valid-server-certificate, print-tls-certificate-error): New procedures. Add 'print-tls-certificate-error' as an exception printer for 'tls-certificate-error'. (tls-wrap): Add #:verify-certificate? parameter and honor it. (open-connection-for-uri): Likewise. (http-fetch): Likewise. (url-fetch): Likewise. * guix/download.scm (url-fetch)[builder]: Pass #:verify-certificate? #f. * guix/scripts/lint.scm (probe-uri): Add case for 'tls-certificate-error'. (validate-uri): Likewise. * doc/guix.texi (Invoking guix download): Mention 'SSL_CERT_DIR'.