From 20276fc06852d4b4fa96fd48d2f6277639b1f5a0 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 29 Jan 2015 09:58:32 +0100 Subject: [PATCH] xbps-install: add additional actions to the column output. - downgrade if new version in repos is less than installed one. - reinstall if both versions are equal. and additionally always print installed pkg version, irrespectively of the transaction mode. Close #72 --- NEWS | 4 ++++ bin/xbps-install/util.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index e1ea7664..8d9df697 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ xbps-0.44 (???): + * xbps-install(8): add additional actions to the column output: "downgrade" + and "reinstall", as well as current installed version and new version. + Implement https://github.com/voidlinux/xbps/issues/72 + * libxbps: add packages on hold mode to the transaction, but just ignore them. This way those are shown in the xbps-install(8) output and the user really knows that there's a pending update that is not being applied. diff --git a/bin/xbps-install/util.c b/bin/xbps-install/util.c index c9e4179b..153eadc6 100644 --- a/bin/xbps-install/util.c +++ b/bin/xbps-install/util.c @@ -144,16 +144,19 @@ print_trans_colmode(struct transaction *trans, int cols) if (dload) { trans->dl_pkgcnt++; } - if ((strcmp(tract, "update") == 0) || - (strcmp(tract, "hold") == 0) || - (strcmp(tract, "remove") == 0)) { - ipkgd = xbps_pkgdb_get_pkg(trans->xhp, pkgname); - assert(ipkgd); + ipkgd = xbps_pkgdb_get_pkg(trans->xhp, pkgname); + if (ipkgd) { xbps_dictionary_get_cstring_nocopy(ipkgd, "pkgver", &ipkgver); iver = xbps_pkg_version(ipkgver); } ver = xbps_pkg_version(pkgver); - + if (iver) { + int rv = xbps_cmpver(iver, ver); + if (rv == 1) + tract = "downgrade"; + else if (rv == 0) + tract = "reinstall"; + } /* print pkgname and some blanks */ blen = pnamelen - strlen(pkgname); printf("%s", pkgname);