xbps{,-static}: fix columnt output mode: cnt stats and alignment for long versions.

This commit is contained in:
Juan RP 2014-11-05 10:22:55 +01:00
parent 46001d1d7c
commit 3f5b27006a
3 changed files with 84 additions and 2 deletions

View file

@ -3,7 +3,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.41
revision=5
revision=7
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities - static binaries"

View file

@ -0,0 +1,82 @@
From 42bbc601547b5342ddd5512e7b5e088284fe81c3 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 5 Nov 2014 10:16:57 +0100
Subject: [PATCH] xbps-install: fix cnt stats and align issues in the column
output mode.
- The counter stats were not taken into account.
- Align version/new version with pkgs that have long versions (chromium).
---
bin/xbps-install/util.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/bin/xbps-install/util.c b/bin/xbps-install/util.c
index 3fb68a7..e10bba1 100644
--- bin/xbps-install/util.c
+++ bin/xbps-install/util.c
@@ -103,14 +103,14 @@ print_trans_colmode(struct transaction *trans, int cols)
pnamelen = find_longest_pkgname(trans);
/* header length */
- hdrlen = 4 + pnamelen + 48;
+ hdrlen = 4 + pnamelen + 60;
if (cols <= hdrlen)
return false;
printf("Name");
for (x = 4; x < pnamelen; x++)
printf(" ");
- printf("Action Version New version Download size\n");
+ printf("Action Version New version Download size\n");
while ((obj = xbps_object_iterator_next(trans->iter)) != NULL) {
xbps_dictionary_t ipkgd;
@@ -128,6 +128,18 @@ print_trans_colmode(struct transaction *trans, int cols)
pkgname = xbps_pkg_name(pkgver);
assert(pkgname);
+ if (strcmp(tract, "install") == 0) {
+ trans->inst_pkgcnt++;
+ } else if (strcmp(tract, "update") == 0) {
+ trans->up_pkgcnt++;
+ } else if (strcmp(tract, "remove") == 0) {
+ trans->rm_pkgcnt++;
+ } else if (strcmp(tract, "configure") == 0) {
+ trans->cf_pkgcnt++;
+ }
+ if (dload) {
+ trans->dl_pkgcnt++;
+ }
if ((strcmp(tract, "update") == 0) || strcmp(tract, "remove") == 0) {
ipkgd = xbps_pkgdb_get_pkg(trans->xhp, pkgname);
assert(ipkgd);
@@ -144,7 +156,7 @@ print_trans_colmode(struct transaction *trans, int cols)
/* print action */
printf("%s ", tract);
- for (x = strlen(tract); x < 7; x++)
+ for (x = strlen(tract); x < 9; x++)
printf(" ");
/* print installed version */
@@ -153,7 +165,7 @@ print_trans_colmode(struct transaction *trans, int cols)
/* print new version */
printf("%s ", iver);
- for (x = strlen(iver); x < 14; x++)
+ for (x = strlen(iver); x < 17; x++)
printf(" ");
if (strcmp(tract, "remove") == 0) {
@@ -166,7 +178,7 @@ print_trans_colmode(struct transaction *trans, int cols)
size[1] = '\0';
}
printf("%s ", ver);
- for (x = strlen(ver); x < 18; x++)
+ for (x = strlen(ver); x < 22; x++)
printf(" ");
/* print download size */
printf("%s ", size);
--
2.1.3

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.41
revision=6
revision=7
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities"