diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-02-15 16:13:36 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-02-26 18:19:34 +0100 |
| commit | 1d84d7bf6052c0c80bd212d4524876576e9817d4 (patch) | |
| tree | 469a7694b9ebacf8949758d79febebc7c399233d | |
| parent | cb723be5b98a57ae4f909022d1ce2b5d3bcdaabf (diff) | |
build: Require Guile >= 2.0.13.
* 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.
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | config-daemon.ac | 5 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | doc/guix.texi | 2 | ||||
| -rw-r--r-- | guix/build/download.scm | 10 | ||||
| -rw-r--r-- | guix/build/syscalls.scm | 48 | ||||
| -rw-r--r-- | guix/hash.scm | 3 | ||||
| -rw-r--r-- | guix/http-client.scm | 154 | ||||
| -rwxr-xr-x | guix/scripts/substitute.scm | 18 | ||||
| -rw-r--r-- | m4/guix.m4 | 17 | ||||
| -rw-r--r-- | tests/hash.scm | 11 |
11 files changed, 14 insertions, 258 deletions
| @@ -20,7 +20,7 @@ Guix is based on the [[https://nixos.org/nix/][Nix]] package manager. | |||
| 20 | 20 | ||
| 21 | GNU Guix currently depends on the following packages: | 21 | GNU Guix currently depends on the following packages: |
| 22 | 22 | ||
| 23 | - [[https://gnu.org/software/guile/][GNU Guile 2.2.x or 2.0.x]], version 2.0.9 or later | 23 | - [[https://gnu.org/software/guile/][GNU Guile 2.2.x or 2.0.x]], version 2.0.13 or later |
| 24 | - [[https://gnupg.org/][GNU libgcrypt]] | 24 | - [[https://gnupg.org/][GNU libgcrypt]] |
| 25 | - [[https://www.gnu.org/software/make/][GNU Make]] | 25 | - [[https://www.gnu.org/software/make/][GNU Make]] |
| 26 | - [[https://www.gnutls.org][GnuTLS]] compiled with guile support enabled. | 26 | - [[https://www.gnutls.org][GnuTLS]] compiled with guile support enabled. |
diff --git a/config-daemon.ac b/config-daemon.ac index 80d84cbdbcc..524b10b303f 100644 --- a/config-daemon.ac +++ b/config-daemon.ac | |||
| @@ -132,11 +132,6 @@ if test "x$guix_build_daemon" = "xyes"; then | |||
| 132 | AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"], | 132 | AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"], |
| 133 | [Default list of substitute URLs used by 'guix-daemon'.]) | 133 | [Default list of substitute URLs used by 'guix-daemon'.]) |
| 134 | 134 | ||
| 135 | dnl Check whether the 'offload' build hook can be built (uses | ||
| 136 | dnl 'restore-file-set', which requires unbuffered custom binary input | ||
| 137 | dnl ports from Guile >= 2.0.10.) | ||
| 138 | GUIX_CHECK_UNBUFFERED_CBIP | ||
| 139 | |||
| 140 | dnl Check for Guile-SSH, which is required by 'guix offload'. | 135 | dnl Check for Guile-SSH, which is required by 'guix offload'. |
| 141 | GUIX_CHECK_GUILE_SSH | 136 | GUIX_CHECK_GUILE_SSH |
| 142 | 137 | ||
diff --git a/configure.ac b/configure.ac index 398846f64b0..5872a848239 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -98,7 +98,7 @@ if test "x$GUILD" = "x"; then | |||
| 98 | fi | 98 | fi |
| 99 | 99 | ||
| 100 | if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then | 100 | if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then |
| 101 | PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.9]) | 101 | PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.13]) |
| 102 | fi | 102 | fi |
| 103 | 103 | ||
| 104 | dnl Installation directories for .scm and .go files. | 104 | dnl Installation directories for .scm and .go files. |
diff --git a/doc/guix.texi b/doc/guix.texi index 691164502b3..f9d7e13e213 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -601,7 +601,7 @@ in the Guix source tree for additional details. | |||
| 601 | GNU Guix depends on the following packages: | 601 | GNU Guix depends on the following packages: |
| 602 | 602 | ||
| 603 | @itemize | 603 | @itemize |
| 604 | @item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.0.9 or | 604 | @item @url{http://gnu.org/software/guile/, GNU Guile}, version 2.0.13 or |
| 605 | later, including 2.2.x; | 605 | later, including 2.2.x; |
| 606 | @item @url{http://gnupg.org/, GNU libgcrypt}; | 606 | @item @url{http://gnupg.org/, GNU libgcrypt}; |
| 607 | @item | 607 | @item |
diff --git a/guix/build/download.scm b/guix/build/download.scm index 1b630a9d6df..315a3554ecd 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> | 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> | 4 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> |
| 5 | ;;; | 5 | ;;; |
| @@ -321,14 +321,6 @@ host name without trailing dot." | |||
| 321 | ((uri? uri-or-string) uri-or-string) | 321 | ((uri? uri-or-string) uri-or-string) |
| 322 | (else (error "Invalid URI" uri-or-string)))) | 322 | (else (error "Invalid URI" uri-or-string)))) |
| 323 | 323 | ||
| 324 | (define current-http-proxy | ||
| 325 | ;; XXX: Add a dummy definition for Guile < 2.0.10; this is used in | ||
| 326 | ;; 'open-socket-for-uri'. | ||
| 327 | (or (and=> (module-variable (resolve-interface '(web client)) | ||
| 328 | 'current-http-proxy) | ||
| 329 | variable-ref) | ||
| 330 | (const #f))) | ||
| 331 | |||
| 332 | (define* (open-socket-for-uri uri-or-string #:key timeout) | 324 | (define* (open-socket-for-uri uri-or-string #:key timeout) |
| 333 | "Return an open input/output port for a connection to URI. When TIMEOUT is | 325 | "Return an open input/output port for a connection to URI. When TIMEOUT is |
| 334 | not #f, it must be a (possibly inexact) number denoting the maximum duration | 326 | not #f, it must be a (possibly inexact) number denoting the maximum duration |
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 0cb630cfb3d..25726b885e9 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> | 3 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> |
| 4 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> | 4 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 5 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> | 5 | ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> |
| @@ -350,39 +350,6 @@ expansion-time error is raised if FIELD does not exist in TYPE." | |||
| 350 | ;;; FFI. | 350 | ;;; FFI. |
| 351 | ;;; | 351 | ;;; |
| 352 | 352 | ||
| 353 | (define %libc-errno-pointer | ||
| 354 | ;; Glibc's 'errno' pointer, for use with Guile < 2.0.12. | ||
| 355 | (let ((errno-loc (false-if-exception | ||
| 356 | (dynamic-func "__errno_location" (dynamic-link))))) | ||
| 357 | (and errno-loc | ||
| 358 | (let ((proc (pointer->procedure '* errno-loc '()))) | ||
| 359 | (proc))))) | ||
| 360 | |||
| 361 | (define errno ;for Guile < 2.0.12 | ||
| 362 | (if %libc-errno-pointer | ||
| 363 | (let ((bv (pointer->bytevector %libc-errno-pointer (sizeof int)))) | ||
| 364 | (lambda () | ||
| 365 | "Return the current errno." | ||
| 366 | ;; XXX: We assume that nothing changes 'errno' while we're doing all this. | ||
| 367 | ;; In particular, that means that no async must be running here. | ||
| 368 | |||
| 369 | ;; Use one of the fixed-size native-ref procedures because they are | ||
| 370 | ;; optimized down to a single VM instruction, which reduces the risk | ||
| 371 | ;; that we fiddle with 'errno' (needed on Guile 2.0.5, libc 2.11.) | ||
| 372 | (let-syntax ((ref (lambda (s) | ||
| 373 | (syntax-case s () | ||
| 374 | ((_ bv) | ||
| 375 | (case (sizeof int) | ||
| 376 | ((4) | ||
| 377 | #'(bytevector-s32-native-ref bv 0)) | ||
| 378 | ((8) | ||
| 379 | #'(bytevector-s64-native-ref bv 0)) | ||
| 380 | (else | ||
| 381 | (error "unsupported 'int' size" | ||
| 382 | (sizeof int))))))))) | ||
| 383 | (ref bv)))) | ||
| 384 | (lambda () 0))) | ||
| 385 | |||
| 386 | (define (call-with-restart-on-EINTR thunk) | 353 | (define (call-with-restart-on-EINTR thunk) |
| 387 | (let loop () | 354 | (let loop () |
| 388 | (catch 'system-error | 355 | (catch 'system-error |
| @@ -406,17 +373,8 @@ the returned procedure is called." | |||
| 406 | (lambda () | 373 | (lambda () |
| 407 | (let ((ptr (dynamic-func name (dynamic-link)))) | 374 | (let ((ptr (dynamic-func name (dynamic-link)))) |
| 408 | ;; The #:return-errno? facility was introduced in Guile 2.0.12. | 375 | ;; The #:return-errno? facility was introduced in Guile 2.0.12. |
| 409 | ;; Support older versions of Guile by catching 'wrong-number-of-args'. | 376 | (pointer->procedure return-type ptr argument-types |
| 410 | (catch 'wrong-number-of-args | 377 | #:return-errno? #t))) |
| 411 | (lambda () | ||
| 412 | (pointer->procedure return-type ptr argument-types | ||
| 413 | #:return-errno? #t)) | ||
| 414 | (lambda (key . rest) | ||
| 415 | (let ((proc (pointer->procedure return-type ptr argument-types))) | ||
| 416 | (lambda args | ||
| 417 | (let ((result (apply proc args)) | ||
| 418 | (err (errno))) | ||
| 419 | (values result err)))))))) | ||
| 420 | (lambda args | 378 | (lambda args |
| 421 | (lambda _ | 379 | (lambda _ |
| 422 | (error (format #f "~a: syscall->procedure failed: ~s" | 380 | (error (format #f "~a: syscall->procedure failed: ~s" |
diff --git a/guix/hash.scm b/guix/hash.scm index 44e44725807..773b9d47772 100644 --- a/guix/hash.scm +++ b/guix/hash.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -159,7 +159,6 @@ data read from PORT. The thunk always returns the same value." | |||
| 159 | 159 | ||
| 160 | (define (unbuffered port) | 160 | (define (unbuffered port) |
| 161 | ;; Guile <= 2.0.9 does not support 'setvbuf' on custom binary input ports. | 161 | ;; Guile <= 2.0.9 does not support 'setvbuf' on custom binary input ports. |
| 162 | ;; If you get a wrong-type-arg error here, the fix is to upgrade Guile. :-) | ||
| 163 | (setvbuf port _IONBF) | 162 | (setvbuf port _IONBF) |
| 164 | port) | 163 | port) |
| 165 | 164 | ||
diff --git a/guix/http-client.scm b/guix/http-client.scm index bab31875d1a..e8a2a23fc50 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> | 3 | ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> |
| 4 | ;;; Copyright © 2012, 2015 Free Software Foundation, Inc. | 4 | ;;; Copyright © 2012, 2015 Free Software Foundation, Inc. |
| 5 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> | 5 | ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> |
| @@ -69,158 +69,6 @@ | |||
| 69 | (reason http-get-error-reason)) ; string | 69 | (reason http-get-error-reason)) ; string |
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | (define-syntax when-guile<=2.0.5-or-otherwise-broken | ||
| 73 | (lambda (s) | ||
| 74 | (syntax-case s () | ||
| 75 | ((_ body ...) | ||
| 76 | ;; Always emit BODY, regardless of VERSION, because sometimes this code | ||
| 77 | ;; might be compiled with a recent Guile and run with 2.0.5---e.g., | ||
| 78 | ;; when using "guix pull". | ||
| 79 | #'(begin body ...))))) | ||
| 80 | |||
| 81 | (when-guile<=2.0.5-or-otherwise-broken | ||
| 82 | ;; Backport of Guile commits 312e79f8 ("Add HTTP Chunked Encoding support to | ||
| 83 | ;; web modules."), 00d3ecf2 ("http: Do not buffer HTTP chunks."), and 53b8d5f | ||
| 84 | ;; ("web: Gracefully handle premature EOF when reading chunk header.") | ||
| 85 | |||
| 86 | (use-modules (ice-9 rdelim)) | ||
| 87 | |||
| 88 | (define %web-http | ||
| 89 | (resolve-module '(web http))) | ||
| 90 | |||
| 91 | ;; Chunked Responses | ||
| 92 | (define (read-chunk-header port) | ||
| 93 | "Read a chunk header from PORT and return the size in bytes of the | ||
| 94 | upcoming chunk." | ||
| 95 | (match (read-line port) | ||
| 96 | ((? eof-object?) | ||
| 97 | ;; Connection closed prematurely: there's nothing left to read. | ||
| 98 | 0) | ||
| 99 | (str | ||
| 100 | (let ((extension-start (string-index str | ||
| 101 | (lambda (c) | ||
| 102 | (or (char=? c #\;) | ||
| 103 | (char=? c #\return)))))) | ||
| 104 | (string->number (if extension-start ; unnecessary? | ||
| 105 | (substring str 0 extension-start) | ||
| 106 | str) | ||
| 107 | 16))))) | ||
| 108 | |||
| 109 | (define* (make-chunked-input-port port #:key (keep-alive? #f)) | ||
| 110 | "Returns a new port which translates HTTP chunked transfer encoded | ||
| 111 | data from PORT into a non-encoded format. Returns eof when it has | ||
| 112 | read the final chunk from PORT. This does not necessarily mean | ||
| 113 | that there is no more data on PORT. When the returned port is | ||
| 114 | closed it will also close PORT, unless the KEEP-ALIVE? is true." | ||
| 115 | (define (close) | ||
| 116 | (unless keep-alive? | ||
| 117 | (close-port port))) | ||
| 118 | |||
| 119 | (define chunk-size 0) ;size of the current chunk | ||
| 120 | (define remaining 0) ;number of bytes left from the current chunk | ||
| 121 | (define finished? #f) ;did we get all the chunks? | ||
| 122 | |||
| 123 | (define (read! bv idx to-read) | ||
| 124 | (define (loop to-read num-read) | ||
| 125 | (cond ((or finished? (zero? to-read)) | ||
| 126 | num-read) | ||
| 127 | ((zero? remaining) ;get a new chunk | ||
| 128 | (let ((size (read-chunk-header port))) | ||
| 129 | (set! chunk-size size) | ||
| 130 | (set! remaining size) | ||
| 131 | (if (zero? size) | ||
| 132 | (begin | ||
| 133 | (set! finished? #t) | ||
| 134 | num-read) | ||
| 135 | (loop to-read num-read)))) | ||
| 136 | (else ;read from the current chunk | ||
| 137 | (let* ((ask-for (min to-read remaining)) | ||
| 138 | (read (get-bytevector-n! port bv (+ idx num-read) | ||
| 139 | ask-for))) | ||
| 140 | (if (eof-object? read) | ||
| 141 | (begin ;premature termination | ||
| 142 | (set! finished? #t) | ||
| 143 | num-read) | ||
| 144 | (let ((left (- remaining read))) | ||
| 145 | (set! remaining left) | ||
| 146 | (when (zero? left) | ||
| 147 | ;; We're done with this chunk; read CR and LF. | ||
| 148 | (get-u8 port) (get-u8 port)) | ||
| 149 | (loop (- to-read read) | ||
| 150 | (+ num-read read)))))))) | ||
| 151 | (loop to-read 0)) | ||
| 152 | |||
| 153 | (make-custom-binary-input-port "chunked input port" read! #f #f close)) | ||
| 154 | |||
| 155 | ;; Chunked encoding support in Guile <= 2.0.11 would load whole chunks in | ||
| 156 | ;; memory---see <http://bugs.gnu.org/19939>. | ||
| 157 | (when (module-variable %web-http 'read-chunk-body) | ||
| 158 | (module-set! %web-http 'make-chunked-input-port make-chunked-input-port)) | ||
| 159 | |||
| 160 | (define (make-delimited-input-port port len keep-alive?) | ||
| 161 | "Return an input port that reads from PORT, and makes sure that | ||
| 162 | exactly LEN bytes are available from PORT. Closing the returned port | ||
| 163 | closes PORT, unless KEEP-ALIVE? is true." | ||
| 164 | (define bytes-read 0) | ||
| 165 | |||
| 166 | (define (fail) | ||
| 167 | ((@@ (web response) bad-response) | ||
| 168 | "EOF while reading response body: ~a bytes of ~a" | ||
| 169 | bytes-read len)) | ||
| 170 | |||
| 171 | (define (read! bv start count) | ||
| 172 | ;; Read at most LEN bytes in total. HTTP/1.1 doesn't say what to do | ||
| 173 | ;; when a server provides more than the Content-Length, but it seems | ||
| 174 | ;; wise to just stop reading at LEN. | ||
| 175 | (let ((count (min count (- len bytes-read)))) | ||
| 176 | (let loop ((ret (get-bytevector-n! port bv start count))) | ||
| 177 | (cond ((eof-object? ret) | ||
| 178 | (if (= bytes-read len) | ||
| 179 | 0 ; EOF | ||
| 180 | (fail))) | ||
| 181 | ((and (zero? ret) (> count 0)) | ||
| 182 | ;; Do not return zero since zero means EOF, so try again. | ||
| 183 | (loop (get-bytevector-n! port bv start count))) | ||
| 184 | (else | ||
| 185 | (set! bytes-read (+ bytes-read ret)) | ||
| 186 | ret))))) | ||
| 187 | |||
| 188 | (define close | ||
| 189 | (and (not keep-alive?) | ||
| 190 | (lambda () | ||
| 191 | (close-port port)))) | ||
| 192 | |||
| 193 | (make-custom-binary-input-port "delimited input port" read! #f #f close)) | ||
| 194 | |||
| 195 | (define (read-header-line port) | ||
| 196 | "Read an HTTP header line and return it without its final CRLF or LF. | ||
| 197 | Raise a 'bad-header' exception if the line does not end in CRLF or LF, | ||
| 198 | or if EOF is reached." | ||
| 199 | (match (%read-line port) | ||
| 200 | (((? string? line) . #\newline) | ||
| 201 | ;; '%read-line' does not consider #\return a delimiter; so if it's | ||
| 202 | ;; there, remove it. We are more tolerant than the RFC in that we | ||
| 203 | ;; tolerate LF-only endings. | ||
| 204 | (if (string-suffix? "\r" line) | ||
| 205 | (string-drop-right line 1) | ||
| 206 | line)) | ||
| 207 | ((line . _) ;EOF or missing delimiter | ||
| 208 | ((@@ (web http) bad-header) 'read-header-line line)))) | ||
| 209 | |||
| 210 | (unless (guile-version>? "2.0.11") | ||
| 211 | ;; Guile <= 2.0.9 had a bug whereby 'response-body-port' would read more | ||
| 212 | ;; than what 'content-length' says. See Guile commit 802a25b. | ||
| 213 | ;; Guile <= 2.0.11 had a bug whereby the 'close' method of the response | ||
| 214 | ;; body port would fail with wrong-arg-num. See Guile commit 5a10e41. | ||
| 215 | (module-set! (resolve-module '(web response)) | ||
| 216 | 'make-delimited-input-port make-delimited-input-port) | ||
| 217 | |||
| 218 | ;; Guile <= 2.0.11 was affected by <http://bugs.gnu.org/22273>. See Guile | ||
| 219 | ;; commit 4c7732c. | ||
| 220 | (when (module-variable %web-http 'read-line*) | ||
| 221 | (module-set! %web-http 'read-line* read-header-line)))) | ||
| 222 | |||
| 223 | |||
| 224 | (define* (http-fetch uri #:key port (text? #f) (buffered? #t) | 72 | (define* (http-fetch uri #:key port (text? #f) (buffered? #t) |
| 225 | keep-alive? (verify-certificate? #t) | 73 | keep-alive? (verify-certificate? #t) |
| 226 | (headers '((user-agent . "GNU Guile")))) | 74 | (headers '((user-agent . "GNU Guile")))) |
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 2fd2bf8104c..8e1119fb498 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> | 3 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| @@ -212,15 +212,7 @@ provide." | |||
| 212 | (begin | 212 | (begin |
| 213 | (warning (G_ "while fetching ~a: server is somewhat slow~%") | 213 | (warning (G_ "while fetching ~a: server is somewhat slow~%") |
| 214 | (uri->string uri)) | 214 | (uri->string uri)) |
| 215 | (warning (G_ "try `--no-substitutes' if the problem persists~%")) | 215 | (warning (G_ "try `--no-substitutes' if the problem persists~%"))) |
| 216 | |||
| 217 | ;; Before Guile v2.0.9-39-gfe51c7b, EINTR was reported to the user, | ||
| 218 | ;; and thus PORT had to be closed and re-opened. This is not the | ||
| 219 | ;; case afterward. | ||
| 220 | (unless (or (guile-version>? "2.0.9") | ||
| 221 | (version>? (version) "2.0.9.39")) | ||
| 222 | (when port | ||
| 223 | (close-connection port)))) | ||
| 224 | (begin | 216 | (begin |
| 225 | (when (or (not port) (port-closed? port)) | 217 | (when (or (not port) (port-closed? port)) |
| 226 | (set! port (guix:open-connection-for-uri | 218 | (set! port (guix:open-connection-for-uri |
| @@ -571,10 +563,8 @@ initial connection on which HTTP requests are sent." | |||
| 571 | ;; XXX: Do our own caching to work around inefficiencies when | 563 | ;; XXX: Do our own caching to work around inefficiencies when |
| 572 | ;; communicating over TLS: <http://bugs.gnu.org/22966>. | 564 | ;; communicating over TLS: <http://bugs.gnu.org/22966>. |
| 573 | (let-values (((buffer get) (open-bytevector-output-port))) | 565 | (let-values (((buffer get) (open-bytevector-output-port))) |
| 574 | ;; On Guile > 2.0.9, inherit the HTTP proxying property from P. | 566 | ;; Inherit the HTTP proxying property from P. |
| 575 | (when (module-variable (resolve-interface '(web http)) | 567 | (set-http-proxy-port?! buffer (http-proxy-port? p)) |
| 576 | 'http-proxy-port?) | ||
| 577 | (set-http-proxy-port?! buffer (http-proxy-port? p))) | ||
| 578 | 568 | ||
| 579 | (for-each (cut write-request <> buffer) | 569 | (for-each (cut write-request <> buffer) |
| 580 | (at-most 1000 requests)) | 570 | (at-most 1000 requests)) |
diff --git a/m4/guix.m4 b/m4/guix.m4 index 721285b0149..8e174e92e5d 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 | |||
| @@ -136,23 +136,6 @@ AC_DEFUN([GUIX_ASSERT_GUILE_FEATURES], [ | |||
| 136 | done | 136 | done |
| 137 | ]) | 137 | ]) |
| 138 | 138 | ||
| 139 | dnl GUIX_CHECK_UNBUFFERED_CBIP | ||
| 140 | dnl | ||
| 141 | dnl Check whether 'setbvuf' works on custom binary input ports (CBIPs), as is | ||
| 142 | dnl the case starting with Guile 2.0.10. | ||
| 143 | AC_DEFUN([GUIX_CHECK_UNBUFFERED_CBIP], [ | ||
| 144 | AC_CACHE_CHECK([whether Guile's custom binary input ports support 'setvbuf'], | ||
| 145 | [ac_cv_guix_cbips_support_setvbuf], | ||
| 146 | [if "$GUILE" -c "(use-modules (rnrs io ports)) \ | ||
| 147 | (let ((p (make-custom-binary-input-port \"cbip\" pk #f #f #f))) \ | ||
| 148 | (setvbuf p _IONBF))" >&5 2>&1 | ||
| 149 | then | ||
| 150 | ac_cv_guix_cbips_support_setvbuf=yes | ||
| 151 | else | ||
| 152 | ac_cv_guix_cbips_support_setvbuf=no | ||
| 153 | fi]) | ||
| 154 | ]) | ||
| 155 | |||
| 156 | dnl GUIX_ASSERT_SYNTAX_OBJECT_EQUAL | 139 | dnl GUIX_ASSERT_SYNTAX_OBJECT_EQUAL |
| 157 | dnl | 140 | dnl |
| 158 | dnl Guile 2.2.1 was a brown-paper-bag release where 'equal?' wouldn't work | 141 | dnl Guile 2.2.1 was a brown-paper-bag release where 'equal?' wouldn't work |
diff --git a/tests/hash.scm b/tests/hash.scm index b189e435c8f..b4cf2b61d6b 100644 --- a/tests/hash.scm +++ b/tests/hash.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2013, 2014, 2017, 2018 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -37,13 +37,6 @@ | |||
| 37 | (base16-string->bytevector | 37 | (base16-string->bytevector |
| 38 | "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")) | 38 | "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9")) |
| 39 | 39 | ||
| 40 | (define (supports-unbuffered-cbip?) | ||
| 41 | "Return #t if unbuffered custom binary input ports (CBIPs) are supported. | ||
| 42 | In Guile <= 2.0.9, CBIPs were always fully buffered, so the | ||
| 43 | 'open-sha256-input-port' does not work there." | ||
| 44 | (false-if-exception | ||
| 45 | (setvbuf (make-custom-binary-input-port "foo" pk #f #f #f) _IONBF))) | ||
| 46 | |||
| 47 | 40 | ||
| 48 | (test-begin "hash") | 41 | (test-begin "hash") |
| 49 | 42 | ||
| @@ -77,8 +70,6 @@ In Guile <= 2.0.9, CBIPs were always fully buffered, so the | |||
| 77 | (equal? (sha256 contents) | 70 | (equal? (sha256 contents) |
| 78 | (call-with-input-file file port-sha256)))) | 71 | (call-with-input-file file port-sha256)))) |
| 79 | 72 | ||
| 80 | (test-skip (if (supports-unbuffered-cbip?) 0 4)) | ||
| 81 | |||
| 82 | (test-equal "open-sha256-input-port, empty" | 73 | (test-equal "open-sha256-input-port, empty" |
| 83 | `("" ,%empty-sha256) | 74 | `("" ,%empty-sha256) |
| 84 | (let-values (((port get) | 75 | (let-values (((port get) |
