Commit Graph

20 Commits

Author SHA1 Message Date
Ludovic Courtès 76832d3420
Remove most uses of the _IO*F constants.
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.
2019-01-09 14:47:53 +01:00
Ludovic Courtès 9f8605958e
download: Pass the timeout to 'ftp-retr'.
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'.
2017-11-14 23:46:53 +01:00
Roel Janssen 193420a803
ftp-client: Allow custom username and password for FTP servers.
* guix/ftp-client.scm (ftp-open): Add username and password arguments.
2017-03-21 12:14:05 +01:00
Ludovic Courtès 2535635f18
Use (ice-9 binary-ports) instead of (rnrs io ports).
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-19 15:54:10 +02:00
Ludovic Courtès 862d2479f6 ftp-client: Default port for 'ftp-open' is now "ftp".
* guix/ftp-client.scm (ftp-open): Change default #:port to "ftp".
* guix/scripts/lint.scm (probe-uri): Remove 'port' parameter to
'ftp-open'.
2015-11-22 14:35:28 +01:00
Ludovic Courtès d6d33984df ftp-client: Fix off-by-one when trying addresses in 'ftp-open'.
* guix/ftp-client.scm (ftp-open): Change to use 'match' instead of
car/cdr, and fix off-by-one (was '(null? addresses)' instead of
'(null? (cdr addresses))'.)
2015-11-22 14:16:36 +01:00
Ludovic Courtès b7f4677999 ftp-client: Restrict to TCP/IP connections.
Fixes <http://bugs.gnu.org/21925>.
Regression introduced in 279ec1d.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* guix/ftp-client.scm (ftp-open): Restrict sockets to
  SOCK_STREAM/IPPROTO_IP.
2015-11-17 09:44:52 +01:00
Ludovic Courtès 1b9aefa394 download: Always use AI_ADDRCONFIG when resolving host names.
* guix/build/download.scm (open-socket-for-uri): Always pass
  AI_ADDRCONFIG to 'getaddrinfo' as recommended in the fine Guile
  manual.
* guix/ftp-client.scm (ftp-open): Ditto.
2015-11-12 23:47:01 +01:00
Ludovic Courtès 4856700698 ftp-client: Add timeout parameter to 'ftp-open'.
* guix/ftp-client.scm (catch-EINPROGRESS): New macro.
(connect*): New procedure.
(ftp-open): Add #:timeout parameter.  Use 'connect*' instead of
'connect' and pass it TIMEOUT.
2015-11-12 23:47:00 +01:00
Ludovic Courtès 279ec1df20 ftp-client: Restrict to TCP connections.
* guix/ftp-client.scm (ftp-open): Force SOCK_STREAM as the socket type
  to avoid calling 'connect' on a datagram socket.
2015-11-12 23:47:00 +01:00
Ludovic Courtès 820a40327d ftp-client: Throw when log-in fails.
* guix/ftp-client.scm (ftp-open): When '%ftp-listen' returns something
  different from 220, throw instead of writing an error message.
2015-05-20 12:13:39 +02:00
Ludovic Courtès 2a31e1dade ftp-client: Switch to binary mode before using the "SIZE" command.
* guix/ftp-client.scm (ftp-size): Add '%ftp-command' call.
2015-03-19 13:00:21 +01:00
Ludovic Courtès 3c986b75f5 ftp-client: Add missing CR in "USER" command.
* guix/ftp-client.scm (%ftp-login): Add #\return before #\newline.
  Fixes access to some FTP servers, such as
  ftp://invisible-island.net ("ProFTPD 1.3.4a Server").
2014-05-03 00:46:51 +02:00
Ludovic Courtès 91fe0e20c7 ftp-client: Let callers handle `ftp-open' exceptions.
* guix/ftp-client.scm (ftp-open): Let exceptions through.
* guix/scripts/package.scm (waiting): Wrap EXP in a `dynamic-wind', so
  the line is always cleared.
2013-05-14 23:51:36 +02:00
Ludovic Courtès 87dfd45594 ftp-client: `ftp-chdir' changes one step at a time.
* guix/ftp-client.scm (%char-set:not-slash): New variable.
  (ftp-chdir): Add docstring.  Change to DIR one step at a time.
  (ftp-retr): Fix indentation.
2013-04-27 16:25:54 +02:00
Ludovic Courtès fb83842efb ftp-client: Add `ftp-size'.
* guix/ftp-client.scm (ftp-size): New procedure.
2013-01-06 18:23:44 +01:00
Ludovic Courtès 233e76769a Update license headers.
Change all license headers, except guix/build/* and ld-wrapper.scm, with
this code:

  (use-modules (guix build utils)
	       (srfi srfi-1))

  (fluid-set! %default-port-encoding "UTF-8")

  (substitute* (remove (lambda (f)
			 (or (string-contains f ".tar.")
			     (string-contains f ".git/")
			     (string-contains f ".so")
			     (string-suffix? ".o" f)
			     (string-suffix? ".a" f)
			     (string-suffix? ".go" f)
			     (string-suffix? ".pdf" f)
			     (string-suffix? ".png" f)
			     (string-suffix? ".info" f)
			     (equal? (basename f) "guix-daemon")
			     (equal? (basename f) "nix-setuid-helper")
			     (string-contains f "nix-upstream/")
			     (string-contains f "distro/packages/bootstrap/")))
		       (find-files "." "\\.[a-z]+$"))
    (("^([[:graph:]]+) This file is part of Guix." _ comment-start)
     (string-append comment-start " This file is part of GNU Guix."))
    (("^([[:graph:]]+) Guix --- Nix package management.*" _ comment-start)
     (string-append comment-start
		    " GNU Guix --- Functional package management for GNU\n"))
    (("^([[:graph:]]+) Guix is " _ comment-start)
     (string-append comment-start " GNU Guix is "))
    (("^([[:graph:]]+) along with Guix." _ comment-start)
     (string-append comment-start " along with GNU Guix."))
    (("^([[:graph:]]+) Copyright \\(C\\)" _ comment-start)
     (string-append comment-start " Copyright ©")))

Change headers using C-style comments manually.
2013-01-06 00:47:50 +01:00
Ludovic Courtès d14ecda913 http/ftp: Tweak to avoid depending on libc's NSS.
* guix/build/http.scm (open-connection-for-uri): New procedure.
  (http-fetch): Use it.  Pass the result as a #:port argument to
  `http-get'.
  Add hack to modify the `set-port-encoding!' binding in (web response).

* guix/ftp-client.scm (ftp-open): Add optional `port' parameter,
  defaulting to 21.  When calling `getaddrinfo', convert PORT to a
  string and pass AI_NUMERICSERV when PORT is a number.
2012-10-18 22:32:23 +02:00
Ludovic Courtès 4004f95379 ftp-client: Try all the addresses returned by `getaddrinfo'.
* guix/ftp-client.scm (ftp-open): Upon connection failure, try the other
  addresses returned by `getaddrinfo'.
2012-10-13 21:18:16 +02:00
Ludovic Courtès 457dd86d66 Add (guix ftp) and companion modules.
* guix/ftp-client.scm, guix/ftp.scm, guix/build/ftp.scm: New files.
* Makefile.am (MODULES): Add them.

* distro/base.scm (libffi): Use `ftp-fetch'.
2012-09-12 23:47:49 +02:00