aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-12-06 00:40:41 +0100
committerLudovic Courtès <ludo@gnu.org>2019-12-12 17:56:58 +0100
commit22f06a212879369bd1d7f3aa5b19f8f89a8c6693 (patch)
treeb843f8fc7130138746872edc2e0f5d5cd838c3d6
parent1d9a4456a83a197a47bf2bdebc6b60ae78e00cfc (diff)
downloadguix-22f06a212879369bd1d7f3aa5b19f8f89a8c6693.tar.gz
guix-22f06a212879369bd1d7f3aa5b19f8f89a8c6693.zip
progress: Add 'progress-report-port'.
* guix/scripts/substitute.scm (progress-report-port): Move to... * guix/progress.scm (progress-report-port): ... here. New procedure.
-rw-r--r--guix/progress.scm31
-rwxr-xr-xguix/scripts/substitute.scm29
2 files changed, 31 insertions, 29 deletions
diff --git a/guix/progress.scm b/guix/progress.scm
index 349637dbcf..c7567a35fd 100644
--- a/guix/progress.scm
+++ b/guix/progress.scm
@@ -40,6 +40,7 @@
progress-reporter/file
progress-reporter/bar
progress-reporter/trace
+ progress-report-port
display-download-progress
erase-current-line
@@ -342,3 +343,33 @@ should be a <progress-reporter> object."
(put-bytevector out buffer 0 bytes)
(report total)
(loop total (get-bytevector-n! in buffer 0 buffer-size))))))))
+
+(define (progress-report-port reporter port)
+ "Return a port that continuously reports the bytes read from PORT using
+REPORTER, which should be a <progress-reporter> object."
+ (match reporter
+ (($ <progress-reporter> start report stop)
+ (let* ((total 0)
+ (read! (lambda (bv start count)
+ (let ((n (match (get-bytevector-n! port bv start count)
+ ((? eof-object?) 0)
+ (x x))))
+ (set! total (+ total n))
+ (report total)
+ n))))
+ (start)
+ (make-custom-binary-input-port "progress-port-proc"
+ read! #f #f
+ (lambda ()
+ ;; XXX: Kludge! When used through
+ ;; 'decompressed-port', this port ends
+ ;; up being closed twice: once in a
+ ;; child process early on, and at the
+ ;; end in the parent process. Ignore
+ ;; the early close so we don't output
+ ;; a spurious "download-succeeded"
+ ;; trace.
+ (unless (zero? total)
+ (stop))
+ (close-port port)))))))
+
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 4802fbd1fe..7eca2c6874 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -823,35 +823,6 @@ was found."
(= (string-length file) 32)))))
(narinfo-cache-directories directory)))
-(define (progress-report-port reporter port)
- "Return a port that continuously reports the bytes read from PORT using
-REPORTER, which should be a <progress-reporter> object."
- (match reporter
- (($ <progress-reporter> start report stop)
- (let* ((total 0)
- (read! (lambda (bv start count)
- (let ((n (match (get-bytevector-n! port bv start count)
- ((? eof-object?) 0)
- (x x))))
- (set! total (+ total n))
- (report total)
- n))))
- (start)
- (make-custom-binary-input-port "progress-port-proc"
- read! #f #f
- (lambda ()
- ;; XXX: Kludge! When used through
- ;; 'decompressed-port', this port ends
- ;; up being closed twice: once in a
- ;; child process early on, and at the
- ;; end in the parent process. Ignore
- ;; the early close so we don't output
- ;; a spurious "download-succeeded"
- ;; trace.
- (unless (zero? total)
- (stop))
- (close-port port)))))))
-
(define-syntax with-networking
(syntax-rules ()
"Catch DNS lookup errors and TLS errors and gracefully exit."
date to 3.0.3....* gnu/packages/coq.scm (coq-coquelicot): Update to 3.0.3. [source]: Use GIT-FETCH and GIT-FILE-NAME. [native-inputs]: Add autoconf and automake. Brett Gilio 2020-01-06gnu: coq-gappa: Use HTTPS home page URI....* gnu/packages/coq.scm (coq-gappa)[home-page]: Use HTTPS URI. Brett Gilio 2020-01-06gnu: coq-gappa: Update to 1.4.2....* gnu/packages/coq.scm (coq-gappa): Update to 1.4.2. [source]: Use GIT-FETCH and GIT-FILE-NAME. [native-inputs]: Add autoconf and automake for remake, as well as campl5 for parsing. [propagated-inputs]: coq-gabba now depends on coq-flocq. [arguments]: Temporarily disable check chase until error resolution is identified. Brett Gilio 2020-01-06gnu: coq-flocq: Use HTTPS home page URI....* gnu/packages/coq.scm (coq-flocq)[home-page]: Use HTTPS URI. Brett Gilio 2020-01-06gnu: coq-flocq: Update to 3.2.0....* gnu/packages/coq.scm (coq-flocq): Update to 3.2.0. [source]: Use GIT-FETCH and GIT-FILE-NAME. [native-inputs]: Add autoconf and automake for remake. [arguments]: Add remove-failing-examples phase to work around union error. Brett Gilio 2020-01-06gnu: coq: Reword several comments....* gnu/packages/coq.scm (coq): Reword several comments to improve readability. Brett Gilio 2020-01-06gnu: coq: Update to 8.10.2....* gnu/packages/coq.scm (coq): Update to 8.10.2. [inputs]: Replace lablgtk with lablgtk3. [arguments]: Remove remove-lablgtk-references phase, as it no longer appears to be necessary. Brett Gilio 2020-01-05gnu: coq-mathcomp: Update to 1.10.0....* gnu/packages/coq.scm (coq-mathcomp): Update to 1.10.0. [arguments]: Modify comment about tests. Remove redundant setting of COQLIB environment variable. Brett Gilio 2019-12-12gnu: coq: Split coqide....* gnu/packages/coq.scm (coq)[outputs]: Add "ide" output. Julien Lepiller 2019-11-25gnu: coq-bignums: Don't use unstable tarball....* gnu/pacakges/coq.scm (coq-bignums)[source]: Download using git-fetch. Efraim Flashner 2019-10-20gnu: Remove more GCC < 7 workarounds....* gnu/packages/abiword.scm (abiword)[arguments]: Do not pass "-std=c++11" to the GCC command line. * gnu/packages/aidc.scm (zbar)[arguments]: Likewise. * gnu/packages/android.scm (android-libbase, android-libcutils, android-libziparchive, fastboot)[arguments]: Likewise. * gnu/packages/audio.scm (azr3, guitarix, suil)[arguments]: Likewise. * gnu/packages/bioinformatics.scm (bless)[arguments]: Likewise. * gnu/packages/bittorrent.scm (libtorrent-rasterbar)[arguments]: Likewise. * gnu/packages/code.scm (rtags)[arguments]: Likewise. * gnu/packages/coq.scm (coq-gappa)[arguments]: Likewise. * gnu/packages/emulators.scm (dolphin-emu)[arguments]: Likewise. * gnu/packages/engineering.scm (xyce-serial, xyce-parallel)[arguments]: Likewise. * gnu/packages/gnupg.scm (pinentry-qt)[arguments]: Likewise. * gnu/packages/gobby.scm (libnet6, obby)[arguments]: Likewise. * gnu/packages/graph.scm (python-faiss)[arguments]: Likewise. * gnu/packages/graphics.scm (povray)[arguments]: Likewise. * gnu/packages/image-processing.scm (opencv, itk-snap)[arguments]: Likewise. * gnu/packages/image.scm (freeimage)[arguments]: Likewise. * gnu/packages/kodi.scm (crossguid)[arguments]: Likewise. * gnu/packages/music.scm (amsynth, qmidiarp, qmidiroute, seq24)[arguments]: Likewise. * gnu/packages/pdf.scm (python-poppler-qt5)[arguments]: Likewise. * gnu/packages/sagemath.scm (lcalc)[arguments]: Likewise. * gnu/packages/video.scm (vlc, mlt, v4l-utils)[arguments]: Likewise. Marius Bakke