[pacman-dev] [PATCH] package.c: prettify package size printing

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sun Apr 12 06:31:09 UTC 2015


On further thought, I don't see any universal solution. As this is rather
trivial with no concrete benefit, please close this.

On Sun, Apr 12, 2015 at 12:15 AM, Andrew Gregory <andrew.gregory.8 at gmail.com
> wrote:

> On 04/10/15 at 12:42am, Ganesh Ajjanagadde wrote:
> > Unnecessary whitespace after the colon in the package size field is
> > removed by left-justifying the size value.
> >
> > Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> > ---
>
> Why keep the width specifier if you want to left-justify the field?
> Having the extra space between the value and unit looks even stranger:
>  $ src/pacman/pacman -Si valgrind | grep Size
>  Download Size  : 7.21   MiB
>  Installed Size : 61.34  MiB
>
> This also breaks a test:
>  $ make check
>  1..1
>  # Running 'query006'
>  # ==> Generating test environment
>  # ==> Running test
>  # ==> Checking rules
>      1..6
>      ok 1 - PACMAN_RETCODE=0
>      ok 2 - PACMAN_OUTPUT=^Name.*overflow
>      ok 3 - PACMAN_OUTPUT=^Description.*Overflow size and date values if
> possible
>      not ok 4 - PACMAN_OUTPUT=^Installed Size.*9.31 GiB
>      ok 5 - PACMAN_OUTPUT=^Build Date.* 2065
>      ok 6 - PACMAN_OUTPUT=^Install Date.* 2286
>  not ok 1 - Query info on a package (overflow long values)
>  FAIL: test/pacman/tests/query006.py 1 - Query info on a package (overflow
> long values)
>
> apg
>
> >  src/pacman/package.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/pacman/package.c b/src/pacman/package.c
> > index 33184bd..ba4f877 100644
> > --- a/src/pacman/package.c
> > +++ b/src/pacman/package.c
> > @@ -167,10 +167,10 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
> >
> >       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  :"),
> > +             printf("%s%s%s %-6.2f %s\n", config->colstr.title,
> _("Download Size  :"),
> >                       config->colstr.nocolor, size, label);
> >       } else if(from == ALPM_PKG_FROM_FILE) {
> > -             printf("%s%s%s %6.2f %s\n", config->colstr.title,
> _("Compressed Size:"),
> > +             printf("%s%s%s %-6.2f %s\n", config->colstr.title,
> _("Compressed Size:"),
> >                       config->colstr.nocolor, size, label);
> >       } else {
> >               // autodetect size for "Installed Size"
> > @@ -178,7 +178,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
> >       }
> >
> >       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 :"),
> > +     printf("%s%s%s %-6.2f %s\n", config->colstr.title, _("Installed
> Size :"),
> >                       config->colstr.nocolor, size, label);
> >
> >       string_display(_("Packager       :"), alpm_pkg_get_packager(pkg),
> cols);
> > --
> > 2.3.5
>


More information about the pacman-dev mailing list