Remove 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.
This commit is contained in:
Ludovic Courtès 2015-05-07 21:51:30 +02:00
parent 47c66da00b
commit 09d809db6a
4 changed files with 11 additions and 37 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -82,12 +82,6 @@ to stdout upon success."
(leave (_ "error: corrupt signature data: ~a~%") (leave (_ "error: corrupt signature data: ~a~%")
(canonical-sexp->string signature))))) (canonical-sexp->string signature)))))
(define %default-port-conversion-strategy
;; This fluid is in Guile > 2.0.5.
(if (defined? '%default-port-conversion-strategy)
(@ (guile) %default-port-conversion-strategy)
(make-fluid #f)))
;;; ;;;
;;; Entry point with 'openssl'-compatible interface. We support this ;;; Entry point with 'openssl'-compatible interface. We support this

View File

@ -157,15 +157,12 @@ to the caller without emitting an error message."
(leave (_ "download from '~a' failed: ~a, ~s~%") (leave (_ "download from '~a' failed: ~a, ~s~%")
(uri->string (http-get-error-uri c)) (uri->string (http-get-error-uri c))
code (http-get-error-reason c)))))) code (http-get-error-reason c))))))
;; On Guile 2.0.5, `http-fetch' fetches the whole thing at once. So
;; honor TIMEOUT? to disable the timeout when fetching a nar.
;;
;; Test this with: ;; Test this with:
;; sudo tc qdisc add dev eth0 root netem delay 1500ms ;; sudo tc qdisc add dev eth0 root netem delay 1500ms
;; and then cancel with: ;; and then cancel with:
;; sudo tc qdisc del dev eth0 root ;; sudo tc qdisc del dev eth0 root
(let ((port #f)) (let ((port #f))
(with-timeout (if (or timeout? (guile-version>? "2.0.5")) (with-timeout (if timeout?
%fetch-timeout %fetch-timeout
0) 0)
(begin (begin
@ -649,17 +646,9 @@ PORT. REPORT-PROGRESS is a two-argument procedure such as that returned by
;; XXX: We're not in control, so we always return anyway. ;; XXX: We're not in control, so we always return anyway.
n)) n))
;; Since `http-fetch' in Guile 2.0.5 returns all the data once it's done,
;; don't pretend to report any progress in that case.
(if (guile-version>? "2.0.5")
(make-custom-binary-input-port "progress-port-proc" (make-custom-binary-input-port "progress-port-proc"
read! #f #f read! #f #f
(cut close-port port)) (cut close-port port)))
(begin
(format (current-error-port) (_ "Downloading, please wait...~%"))
(format (current-error-port)
(_ "(Please consider upgrading Guile to get proper progress report.)~%"))
port)))
(define-syntax with-networking (define-syntax with-networking
(syntax-rules () (syntax-rules ()

View File

@ -279,17 +279,11 @@ sub-directories of FILE as needed."
(write-string "type" p) (write-string "type" p)
(write-string "directory" p) (write-string "directory" p)
(let ((entries (let ((entries
;; NOTE: Guile 2.0.5's 'scandir' returns all subdirectories ;; 'scandir' defaults to 'string-locale<?' to sort files, but
;; unconditionally, including "." and "..", regardless of the ;; this happens to be case-insensitive (at least in 'en_US'
;; 'select?' predicate passed to it, so we have to filter ;; locale on libc 2.18.) Conversely, we want files to be
;; those out externally. ;; sorted in a case-sensitive fashion.
(filter (negate (cut member <> '("." ".."))) (scandir f (negate (cut member <> '("." ".."))) string<?)))
;; 'scandir' defaults to 'string-locale<?' to sort
;; files, but this happens to be case-insensitive (at
;; least in 'en_US' locale on libc 2.18.) Conversely,
;; we want files to be sorted in a case-sensitive
;; fashion.
(scandir f (const #t) string<?))))
(for-each (lambda (e) (for-each (lambda (e)
(let ((f (string-append f "/" e))) (let ((f (string-append f "/" e)))
(write-string "entry" p) (write-string "entry" p)

View File

@ -852,11 +852,8 @@ parameter of 'args-fold'."
(define dot-scm? (define dot-scm?
(cut string-suffix? ".scm" <>)) (cut string-suffix? ".scm" <>))
;; In Guile 2.0.5 `scandir' would return "." and ".." regardless even though
;; they don't match `dot-scm?'. Work around it by doing additional
;; filtering.
(if directory (if directory
(filter dot-scm? (scandir directory dot-scm?)) (scandir directory dot-scm?)
'())) '()))
(define (commands) (define (commands)