diff options
author | Christopher Baines <mail@cbaines.net> | 2023-03-02 10:37:28 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-03-02 10:55:08 +0000 |
commit | 7df09ee0ab3e7962ef27859ce87e06a323059284 (patch) | |
tree | d81334f742ddcb9a1ee63961ca6410922980af1c /guix/git.scm | |
parent | 2ac51ec99b58b50c08ba719a8c7e9dba0330b065 (diff) | |
parent | af95f2d8f98eb2c8c64954bb2fd0b70838899174 (diff) |
Merge remote-tracking branch 'savannah/master' into core-updates
Conflicts:
gnu/local.mk
gnu/packages/autotools.scm
gnu/packages/cmake.scm
gnu/packages/gnuzilla.scm
gnu/packages/haskell.scm
gnu/packages/pdf.scm
gnu/packages/python-xyz.scm
gnu/packages/samba.scm
gnu/packages/tex.scm
gnu/packages/tls.scm
gnu/packages/wxwidgets.scm
Diffstat (limited to 'guix/git.scm')
-rw-r--r-- | guix/git.scm | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/guix/git.scm b/guix/git.scm index 95630a5e69..4019323327 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2021 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2021 Marius Bakke <marius@gnu.org> ;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be> +;;; Copyright © 2023 Tobias Geerinckx-Rice <me@tobias.gr> ;;; ;;; This file is part of GNU Guix. ;;; @@ -141,11 +142,6 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables." (define total (indexer-progress-total-objects progress)) - (define hundredth - (match (quotient (indexer-progress-total-objects progress) 100) - (0 1) - (x x))) - (define-values (done label) (if (< (indexer-progress-received-objects progress) total) (values (indexer-progress-received-objects progress) @@ -156,14 +152,22 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables." (define % (* 100. (/ done total))) - (when (and (< % 100) (zero? (modulo done hundredth))) + ;; TODO: Both should be handled & exposed by the PROGRESS-BAR API instead. + (define width + (max (- (current-terminal-columns) + (string-length label) 7) + 3)) + + (define grain + (match (quotient total (max 100 (* 8 width))) ; assume 1/8 glyph resolution + (0 1) + (x x))) + + (when (and (< % 100) (zero? (modulo done grain))) (erase-current-line (current-error-port)) - (let ((width (max (- (current-terminal-columns) - (string-length label) 7) - 3))) - (format (current-error-port) "~a ~3,d% ~a" + (format (current-error-port) "~a ~3,d% ~a" label (inexact->exact (round %)) - (progress-bar % width))) + (progress-bar % width)) (force-output (current-error-port))) (when (= % 100.) |