[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/06: status: Print a progress bar for on-going builds when possible.
From: |
guix-commits |
Subject: |
04/06: status: Print a progress bar for on-going builds when possible. |
Date: |
Tue, 29 Jan 2019 06:10:01 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 3854c6429c648df5b5ab23f871de9ec3c466f61b
Author: Ludovic Courtès <address@hidden>
Date: Sun Jan 27 22:44:34 2019 +0100
status: Print a progress bar for on-going builds when possible.
* guix/status.scm (print-build-event)[report-build-progress]: New
procedure.
[print-log-line]: Add ID parameter. Call 'report-build-progress' when
appropriate.
Adjust callers.
---
guix/status.scm | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/guix/status.scm b/guix/status.scm
index 0435d14..e337581 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -441,14 +441,29 @@ addition to build events."
(cut colorize-string <> 'RED 'BOLD)
identity))
+ (define (report-build-progress %)
+ (let ((% (min (max % 0) 100))) ;sanitize
+ (erase-current-line port)
+ (format port "~3d% " (inexact->exact (round %)))
+ (display (progress-bar % (- (current-terminal-columns) 5))
+ port)
+ (force-output port)))
+
(define print-log-line
(if print-log?
(if colorize?
- (lambda (line)
+ (lambda (id line)
(display (colorize-log-line line) port))
- (cut display <> port))
- (lambda (line)
- (spin! port))))
+ (lambda (id line)
+ (display line port)))
+ (lambda (id line)
+ (match (build-status-building status)
+ ((build) ;single job
+ (match (build-completion build)
+ ((? number? %) (report-build-progress %))
+ (_ (spin! port))))
+ (_
+ (spin! port))))))
(unless print-log?
(display "\r" port)) ;erase the spinner
@@ -552,7 +567,7 @@ addition to build events."
;; through.
(display line port)
(force-output port))
- (print-log-line line))
+ (print-log-line pid line))
(cond ((string-prefix? "substitute: " line)
;; The daemon prefixes early messages coming with 'guix
;; substitute' with "substitute:". These are useful ("updating
@@ -565,7 +580,7 @@ addition to build events."
(display (info (string-trim-right line)) port)
(newline))
(else
- (print-log-line line)))))
+ (print-log-line pid line)))))
(_
event)))
- branch master updated (9e532ae -> 2790b66), guix-commits, 2019/01/29
- 01/06: channels: Do not offload package cache derivation., guix-commits, 2019/01/29
- 05/06: self: Produce progress reports compatible with (guix status)., guix-commits, 2019/01/29
- 06/06: pull: Default to verbosity level 1., guix-commits, 2019/01/29
- 02/06: status: Record more information about builds., guix-commits, 2019/01/29
- 04/06: status: Print a progress bar for on-going builds when possible.,
guix-commits <=
- 03/06: status: Keep track of build completion as reported by build tools., guix-commits, 2019/01/29