[PATCH 0/1] weather: Print 0.0% correctly.

  • Done
  • quality assurance status badge
Details
2 participants
  • Arun Isaac
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Arun Isaac
Severity
normal
A
A
Arun Isaac wrote on 5 Jul 2020 01:05
(address . guix-patches@gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704230504.6763-1-arunisaac@systemreboot.net
This is a bit of a nitpick. When there are no substitues, `guix weather`
reports it as ".0% substitutes available". It should instead report it as
"0.0% substitutes unavailable". I didn't know what the '2' specifying width in
~2,1f was for. Hence, I have removed it. Feel free to correct me if I did
something wrong.

Arun Isaac (1):
weather: Print 0.0% correctly.

guix/scripts/weather.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--
2.26.2
A
A
Arun Isaac wrote on 5 Jul 2020 01:07
[PATCH] weather: Print 0.0% correctly.
(address . 42208@debbugs.gnu.org)(name . Arun Isaac)(address . arunisaac@systemreboot.net)
20200704230747.6870-1-arunisaac@systemreboot.net
* guix/scripts/weather.scm (report-server-coverage): Report 0% coverage as
0.0%, not as .0%.
---
guix/scripts/weather.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (15 lines)
diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 475d989357..3035ff6ca8 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -190,7 +190,7 @@ Return the coverage ratio, an exact number between 0 and 1."
narinfos))
(time (+ (time-second time)
(/ (time-nanosecond time) 1e9))))
- (format #t (G_ " ~2,1f% substitutes available (~h out of ~h)~%")
+ (format #t (G_ " ~,1f% substitutes available (~h out of ~h)~%")
(* 100. (/ obtained requested 1.))
obtained requested)
(let ((total (/ (reduce + 0 sizes) MiB)))
--
2.26.2
M
M
Mathieu Othacehe wrote on 5 Jul 2020 09:54
Re: [bug#42208] [PATCH 0/1] weather: Print 0.0% correctly.
(name . Arun Isaac)(address . arunisaac@systemreboot.net)(address . 42208@debbugs.gnu.org)
87y2nyjt1p.fsf@gnu.org
Hello Arun,

Toggle quote (4 lines)
> "0.0% substitutes unavailable". I didn't know what the '2' specifying width in
> ~2,1f was for. Hence, I have removed it. Feel free to correct me if I did
> something wrong.

This "2" is the width argument of the ~f parameter (see

It's supposed to pad left with spaces if the output is less than "2"
characters. Anyway, the zero case is not handled properly as you
noticed, so this looks good to me.

Thanks,

Mathieu
A
A
Arun Isaac wrote on 5 Jul 2020 12:46
(name . Mathieu Othacehe)(address . othacehe@gnu.org)(address . 42208-done@debbugs.gnu.org)
87v9j2tf2b.fsf@systemreboot.net
Pushed to master, thanks!
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl8Br3wACgkQLiXui2GA
K7MvtAf+Ny9QdzbYCcq+UxdyRkSs/CRc3isbNYGn8IWLs361wm3evXW+MQ+Avsqd
1qH+b2L0ZAmEDs9yi4YAPeeWdDRCVqpUueBwxalU++77QYyWSSSGK20FiHGeTBCw
Ahkuw4ZV5VxNGoNTJUkNvUbQgOSDOnbPIQQ+kBul9xu7cQ9D470coxY2yhdoGVaT
2KqIaoH7eJU6A5cDR1GlIYoN+cRktKAyeKmESA3vvbycZJJGn31tpJ5rxOgr7Sao
3NHYADxD+VvOUtYtki4lkiwwwEvmEnC5DrAHL1z0O0dI6h2VWCu5RdnOrGlLsg9B
KKBHp1ZQiX68F7ASdypFRl667b9HrA==
=TpAa
-----END PGP SIGNATURE-----

Closed
?