The rpminfo web page shows the file size as a simple integer (with comma decimal separators):
<th>Size</th><td>$util.formatThousands($rpm.size)</td>
It's difficult for new users to tell if that means bytes or what.
The humanize library has a method called naturalsize that is great for giving human-readable sizes. For example, with a recent Ceph SRPM:
naturalsize
>>> from humanize import naturalsize >>> naturalsize(142888690) '142.9 MB'
humanize is a small dependency
python-humanize-0.5.1-8.el7 is in EPEL 7 python3-humanize-0.5.1-13.el8 is in CentOS Stream 8
This would be really useful in two other areas:
Some of the files in Ceph's RPMs are very large, like https://koji.fedoraproject.org/koji/rpminfo?rpmID=26130363 , so it would be nice to see human-readable filesizes at a glance.
Isn't adding "Bytes" unit solving it?
I would to leave full value accessible somehow as this number is often first quick check that e.g. downloaded file is not corrupted.
Maybe "Size 67.6 MB (67,645,246 Bytes)" and hover with full size in "Files" table?
Metadata Update from @tkopecek: - Custom field Size adjusted to None
This seems to work:
diff --git a/www/kojiweb/fileinfo.chtml b/www/kojiweb/fileinfo.chtml index 07dbe320..f1eef2c1 100644 --- a/www/kojiweb/fileinfo.chtml +++ b/www/kojiweb/fileinfo.chtml @@ -1,6 +1,7 @@ #import datetime #from kojiweb import util #from urllib.parse import quote +#from humanize import naturalsize #include "includes/header.chtml" #if $rpm @@ -19,7 +20,7 @@ </tr> #end if <tr> - <th>Size</th><td>$file.size</td> + <th>Size</th><td><span title="$file.size bytes">$naturalsize($file.size)</span</td> </tr> #if 'mtime' in $file and $file.mtime <tr>
Metadata Update from @tkopecek: - Issue set to the milestone: 1.28
PR 3137
Metadata Update from @jcupova: - Issue tagged with: testing-ready
Metadata Update from @jobrauer: - Issue tagged with: testing-done
Commit f2f4a3dc fixes this issue
Commit d370e42c fixes this issue
This issue has been migrated to Fedora Forge: https://forge.fedoraproject.org/koji/koji/issues/2943
Please continue any further discussion there.