Multiple changes to pkgs on hold mode.

- Added transaction stats for pkgs on hold.

- Always add packages on hold to the transaction dictionary,
  its type will be set to XBPS_TRANS_HOLD.

- Changed xbps_transaction_update_pkg() to have a new "force"
  bool argument to force an update with a pkg on hold.

- As discussed in #274 with @Duncaen the only way to update a
  pkg on hold is by using `-f`, i.e `xbps-install -f foo`.

Closes #265
Closes #274
This commit is contained in:
Juan RP
2020-04-23 06:03:56 +02:00
parent 6b6b394686
commit 7d8247ae56
9 changed files with 127 additions and 108 deletions

View File

@@ -62,8 +62,10 @@ compute_transaction_stats(struct xbps_handle *xhp)
struct statvfs svfs;
uint64_t rootdir_free_size, tsize, dlsize, instsize, rmsize;
uint32_t inst_pkgcnt, up_pkgcnt, cf_pkgcnt, rm_pkgcnt, dl_pkgcnt;
uint32_t hold_pkgcnt;
inst_pkgcnt = up_pkgcnt = cf_pkgcnt = rm_pkgcnt = dl_pkgcnt = 0;
inst_pkgcnt = up_pkgcnt = cf_pkgcnt = rm_pkgcnt = 0;
hold_pkgcnt = dl_pkgcnt = 0;
tsize = dlsize = instsize = rmsize = 0;
iter = xbps_array_iter_from_dict(xhp->transd, "packages");
@@ -92,6 +94,8 @@ compute_transaction_stats(struct xbps_handle *xhp)
inst_pkgcnt++;
} else if (ttype == XBPS_TRANS_UPDATE) {
up_pkgcnt++;
} else if (ttype == XBPS_TRANS_HOLD) {
hold_pkgcnt++;
}
if ((ttype != XBPS_TRANS_CONFIGURE) && (ttype != XBPS_TRANS_REMOVE) &&
@@ -152,6 +156,9 @@ compute_transaction_stats(struct xbps_handle *xhp)
if (!xbps_dictionary_set_uint32(xhp->transd,
"total-download-pkgs", dl_pkgcnt))
return EINVAL;
if (!xbps_dictionary_set_uint32(xhp->transd,
"total-hold-pkgs", hold_pkgcnt))
return EINVAL;
if (!xbps_dictionary_set_uint64(xhp->transd,
"total-installed-size", instsize))
return EINVAL;