summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-08-21 01:16:57 +0200
committerLudovic Courtès <ludo@gnu.org>2013-08-21 02:19:36 +0200
commitdb90b40dfd9eeff10d4ba88c28d8eef85d72dd04 (patch)
tree6ae18e6e11c2b4d84b496dd7a12e1203a780df79
parent6facbc7590bf5c32c02394a060e890c8a666b487 (diff)
downloadguix-db90b40dfd9eeff10d4ba88c28d8eef85d72dd04.tar.gz
substitute-binary: Don't pretend to report download progress on Guile 2.0.5.
* guix/scripts/substitute-binary.scm (progress-report-port): On Guile
  2.0.5, return PORT directly and emit a warning.
-rwxr-xr-xguix/scripts/substitute-binary.scm14
1 files changed, 11 insertions, 3 deletions
diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm
index 7398d59957..0fdec456f6 100755
--- a/guix/scripts/substitute-binary.scm
+++ b/guix/scripts/substitute-binary.scm
@@ -416,9 +416,17 @@ PORT.  REPORT-PROGRESS is a two-argument procedure such as that returned by
       ;; XXX: We're not in control, so we always return anyway.
       n))
 
-  (make-custom-binary-input-port "progress-port-proc"
-                                 read! #f #f
-                                 (cut close-port port)))
+  ;; 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 (version>? (version) "2.0.5")
+      (make-custom-binary-input-port "progress-port-proc"
+                                     read! #f #f
+                                     (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 %cache-url
   (or (getenv "GUIX_BINARY_SUBSTITUTE_URL")