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

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.44 (???): 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. * 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 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. knows that there's a pending update that is not being applied.

View File

@ -144,16 +144,19 @@ print_trans_colmode(struct transaction *trans, int cols)
if (dload) { if (dload) {
trans->dl_pkgcnt++; trans->dl_pkgcnt++;
} }
if ((strcmp(tract, "update") == 0) ||
(strcmp(tract, "hold") == 0) ||
(strcmp(tract, "remove") == 0)) {
ipkgd = xbps_pkgdb_get_pkg(trans->xhp, pkgname); ipkgd = xbps_pkgdb_get_pkg(trans->xhp, pkgname);
assert(ipkgd); if (ipkgd) {
xbps_dictionary_get_cstring_nocopy(ipkgd, "pkgver", &ipkgver); xbps_dictionary_get_cstring_nocopy(ipkgd, "pkgver", &ipkgver);
iver = xbps_pkg_version(ipkgver); iver = xbps_pkg_version(ipkgver);
} }
ver = xbps_pkg_version(pkgver); 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 */ /* print pkgname and some blanks */
blen = pnamelen - strlen(pkgname); blen = pnamelen - strlen(pkgname);
printf("%s", pkgname); printf("%s", pkgname);