#992380 dpigs: use numfmt?

#992380#5
Date:
2021-08-18 01:57:39 UTC
From:
To:
Just a suggestion, but numfmt is super awesome and obviates the awk blob.

      fi | if [ $HUMAN -eq 1 ]; then
    -     awk '{ if ($1 > 1024*1024*1024)
    -               printf("% 6.1fT %s\n", $1/(1024*1024*1024), $2);
    -            else if ($1 > 1024*1024)
    -               printf("% 6.1fG %s\n", $1/(1024*1024), $2);
    -            else if ($1 > 1024)
    -               printf("% 6.1fM %s\n", $1/1024, $2);
    -            else
    -               printf("% 6.1ik %s\n", $1, $2); }'
    +     numfmt --from-unit=Ki --to=iec-i --suffix=B --padding=6


Proof of concept:

    bash5$ dpigs -H
     326.4M fonts-noto-extra
     287.6M linux-image-5.10.0-8-amd64
     287.5M linux-image-5.10.0-7-amd64
     209.1M llvm-11-dev
     204.9M fonts-noto-cjk-extra
     204.9M firefox
     195.3M firefox-esr
     194.1M ansible
     188.0M chromium
     178.3M ansible-doc

    bash5$ dpigs | numfmt --from-unit=Ki --to=iec-i --suffix=B --padding=6
    327MiB fonts-noto-extra
    288MiB linux-image-5.10.0-8-amd64
    288MiB linux-image-5.10.0-7-amd64
    210MiB llvm-11-dev
    205MiB fonts-noto-cjk-extra
    205MiB firefox
    196MiB firefox-esr
    195MiB ansible
    189MiB chromium
    179MiB ansible-doc

#992380#12
Date:
2022-06-19 03:35:17 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
debian-goodies, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 992380@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Axel Beckert <abe@debian.org> (supplier of updated debian-goodies package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 19 Jun 2022 05:02:22 +0200
Source: debian-goodies
Architecture: source
Version: 0.88
Distribution: unstable
Urgency: low
Maintainer: Javier Fernández-Sanguino Peña <jfs@debian.org>
Changed-By: Axel Beckert <abe@debian.org>
Closes: 911720 992380 1005199 1012759
Changes:
 debian-goodies (0.88) unstable; urgency=low
 .
   [ Axel Beckert ]
   * Fix grammar (copy & paste) issue in previous debian/changelog entry.
   * find-dbgsym-packages.pod: Add debuginfod man pages to SEE ALSO.
   * Declare compliance with Debian Policy 4.6.1. (No changes needed.)
   * Update copyright years in debian/copyright. Thanks Lintian!
   * dhomepage: Fix suboptimal error message for non-existent packages.
     (Closes: #1005199)
   * Mention https://dhomepage.debian.net/ in dhomepage(1) man page.
   * Fix documentation of used pattern type for package names in
     dgrep(1). (Closes: #1012759) Also fine tune dglob(1) wrt. pattern.
   * dman: Fix bad signal handling that could potentially lead to insecure
     use of /tmp. Thanks to Jakub Wilk for the bug report. (Closes: #911720)
 .
   [ Unit 193 ]
   * checkrestart: Handle the possibility of systemd units in
     /usr/lib/systemd/system/.
   * checkrestart: Add dbus-broker to the ignore list.
 .
   [ Marcel Partap ]
   * Add dpkg-info: shows pkg info in a nice, colourful, human-readable
     way. Suggest ccze and debsums.
 .
   [ Trent W. Buck ]
   * dpigs: Obviate awk blob by using numfmt. (Closes: #992380)
Checksums-Sha1:
 21595c22f93ce3532f116deea206b44618d08063 1636 debian-goodies_0.88.dsc
 b351962a9319460446dfa9bffc21b511c5cadf58 70852 debian-goodies_0.88.tar.xz
 d3d6dfb0f544591de41dc54397f7d2b9853e395d 6429 debian-goodies_0.88_source.buildinfo
Checksums-Sha256:
 93e7873a3a795904b17dd993b1d9dc3e70ae7b59ccceb52e3b6dfb9644c7b98d 1636 debian-goodies_0.88.dsc
 2345699d9feca97fbc595267583d2c65bf77ab1d02b1a71b2cf35c473f00d5cd 70852 debian-goodies_0.88.tar.xz
 b4e37fae0a7ba640d15c9fd0e7939aba081c88a91954a4beadfa7342b729825b 6429 debian-goodies_0.88_source.buildinfo
Files:
 4e5729a5b70230a0bf2ffbe6e6321b52 1636 utils optional debian-goodies_0.88.dsc
 5733b1ed764df4585f1e724f036b1308 70852 utils optional debian-goodies_0.88.tar.xz
 bbdac290657638a9ef8b3feae64f0e7a 6429 utils optional debian-goodies_0.88_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEERoyJeTtCmBnp12Ema+Zjx1o1yXUFAmKukrEACgkQa+Zjx1o1
yXVuaBAAyLK3QG9ZU+b9yXfkkHsysObdQV8JWyWv7+c/VrzOmRl13T6d50lMXoX0
o6dfnditHcGUQwlEzVxEvdWxoIoq3LJZoVeFvrn8wJQoEua5+3w/j/eQE72qLw/L
lw8h6EllqphQwX1kymKahStiJKW3jV5z7kCrTy9B+qb4D5CsHUP4VDLL6MMobiGa
D98bYv4lGbVKV2zg1en+im4T0iICY6OZLX9OSpPDCAMs0CzlT1f31Sc0k9mV+Hgo
RFpYUYk1JSF0o1MXxQsAUB0u08kEjUDbPFvb41LXnVKmIBmWiS4droSVJb8e7Azs
17d9VGbh+vXW8W1/xQXfZNXLQSvoShCBkbp0/e6x4Z6y2vkwXIhUgiD04v5rkAHI
L8VCAbz2G2sNSQzw/rAVLK9HLgOLJnxrrrps/bPU2dQaBj3o7yxk0NH1JJd6xsiu
wzU+b+vuFd4qf435d+q2MWQuN/UuICPX7c1u82lHi6Pn03tJ3Al5kxdBkVEqpZ9h
3bJ3pwWnsHJWLLHggCc7sJ2fwHevcbxl/oLfoBP6Rcw2wQPJw9wkRyGk1tBQRc/L
yK4buo4lXpc80yavECg0BFPAn6LyG3YhnbXltiDemigP/tcMmVlGcEzp9DJ/ImcO
Mk7n+xIzl/gsEphdQl5jSLQXlb+8Y5sEIj0gCNLy4E4WZejoIBM=
=SwFx
-----END PGP SIGNATURE-----