[pacman-dev] [PATCHv2] pacman -Si/-Qi: Autodetect best fitting file size unit
William Giokas
1007380 at gmail.com
Fri Oct 18 15:34:29 EDT 2013
On Fri, Oct 18, 2013 at 05:09:08PM +0200, Florian Pritz wrote:
> I've tracked this back to e223366 and it looks like this just forces KiB
> because back then humanize_size didn't exist, but the size was just
> divided by 1024 to keep it somewhat readable. When humanize_size got
> introduced in 3c8a448 this was just carried over.
>
> The unit detected for "Download Size" is reused for "Installed Size" to
> make it easier to read.
>
> Signed-off-by: Florian Pritz <bluewind at xinu.at>
> ---
Just a thought, but maybe have this customizable. Possibly a conf file
option to use a certain unit or not use human_size at all.
>
> v2: use same unit for both sizes
>
> src/pacman/package.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/pacman/package.c b/src/pacman/package.c
> index eab2873..decb435 100644
> --- a/src/pacman/package.c
> +++ b/src/pacman/package.c
> @@ -165,7 +165,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
> deplist_display(_("Conflicts With :"), alpm_pkg_get_conflicts(pkg), cols);
> deplist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg), cols);
>
> - size = humanize_size(alpm_pkg_get_size(pkg), 'K', 2, &label);
> + size = humanize_size(alpm_pkg_get_size(pkg), '\0', 2, &label);
> if(from == ALPM_PKG_FROM_SYNCDB) {
> printf("%s%s%s %6.2f %s\n", config->colstr.title, _("Download Size :"),
> config->colstr.nocolor, size, label);
> @@ -174,7 +174,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
> config->colstr.nocolor, size, label);
> }
>
> - size = humanize_size(alpm_pkg_get_isize(pkg), 'K', 2, &label);
> + size = humanize_size(alpm_pkg_get_isize(pkg), label[0], 2, &label);
> printf("%s%s%s %6.2f %s\n", config->colstr.title, _("Installed Size :"),
> config->colstr.nocolor, size, label);
>
> --
> 1.8.4
>
--
William Giokas | KaiSforza | http://kaictl.net/
GnuPG Key: 0x73CD09CF
Fingerprint: F73F 50EF BBE2 9846 8306 E6B8 6902 06D8 73CD 09CF
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20131018/3e91d4e1/attachment-0001.asc>
More information about the pacman-dev
mailing list