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

@@ -124,12 +124,12 @@ main(int argc, char **argv)
struct xferstat xfer;
const char *rootdir, *cachedir, *confdir;
int i, c, flags, rv, fflag = 0;
bool syncf, yes, reinstall, drun, update;
bool syncf, yes, force, drun, update;
int maxcols, eexist = 0;
rootdir = cachedir = confdir = NULL;
flags = rv = 0;
syncf = yes = reinstall = drun = update = false;
syncf = yes = force = drun = update = false;
memset(&xh, 0, sizeof(xh));
@@ -157,7 +157,7 @@ main(int argc, char **argv)
fflag++;
if (fflag > 1)
flags |= XBPS_FLAG_FORCE_UNPACK;
reinstall = true;
force = true;
break;
case 'h':
usage(false);
@@ -258,7 +258,7 @@ main(int argc, char **argv)
} else if (update) {
/* Update target packages */
for (i = optind; i < argc; i++) {
rv = update_pkg(&xh, argv[i]);
rv = update_pkg(&xh, argv[i], force);
if (rv == EEXIST) {
/* pkg already updated, ignore */
rv = 0;
@@ -275,7 +275,7 @@ main(int argc, char **argv)
} else if (!update) {
/* Install target packages */
for (i = optind; i < argc; i++) {
rv = install_new_pkg(&xh, argv[i], reinstall);
rv = install_new_pkg(&xh, argv[i], force);
if (rv == EEXIST) {
/* pkg already installed, ignore */
rv = 0;