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
This commit is contained in:
Juan RP
2015-01-29 09:58:32 +01:00
parent e95300e952
commit 20276fc068
2 changed files with 13 additions and 6 deletions

View File

@@ -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);