Skip to content

Commit 43ac61f

Browse files
committed
xbps-install: support XBPS_TRANS_REPLACED
1 parent 943bf4d commit 43ac61f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

bin/xbps-install/defs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct transaction {
4444
uint32_t rm_pkgcnt;
4545
uint32_t dl_pkgcnt;
4646
uint32_t hold_pkgcnt;
47+
uint32_t repl_pkgcnt;
4748
};
4849

4950
/* from transaction.c */

bin/xbps-install/transaction.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ show_transaction_sizes(struct transaction *trans, int cols)
201201
&trans->rm_pkgcnt);
202202
xbps_dictionary_get_uint32(trans->d, "total-hold-pkgs",
203203
&trans->hold_pkgcnt);
204+
xbps_dictionary_get_uint32(trans->d, "total-replaced-pkgs",
205+
&trans->repl_pkgcnt);
204206

205207
if (!print_trans_colmode(trans, cols)) {
206208
/*
@@ -242,6 +244,12 @@ show_transaction_sizes(struct transaction *trans, int cols)
242244
show_package_list(trans, XBPS_TRANS_HOLD, cols);
243245
printf("\n");
244246
}
247+
if (trans->repl_pkgcnt) {
248+
printf("%u package%s will be replaced:\n",
249+
trans->repl_pkgcnt, trans->repl_pkgcnt == 1 ? "" : "s");
250+
show_package_list(trans, XBPS_TRANS_REPLACED, cols);
251+
printf("\n");
252+
}
245253
}
246254
/*
247255
* Show total download/installed/removed size for all required packages.
@@ -493,12 +501,13 @@ exec_transaction(struct xbps_handle *xhp, unsigned int maxcols, bool yes, bool d
493501
*/
494502
if ((rv = xbps_transaction_commit(xhp)) == 0) {
495503
printf("\n%u downloaded, %u installed, %u updated, "
496-
"%u configured, %u removed, %u on hold.\n",
504+
"%u configured, %u removed, %u on hold, %u replaced.\n",
497505
trans->dl_pkgcnt, trans->inst_pkgcnt,
498506
trans->up_pkgcnt,
499507
trans->cf_pkgcnt + trans->inst_pkgcnt + trans->up_pkgcnt,
500508
trans->rm_pkgcnt,
501-
trans->hold_pkgcnt);
509+
trans->hold_pkgcnt,
510+
trans->repl_pkgcnt);
502511
} else {
503512
xbps_error_printf("Transaction failed! see above for errors.\n");
504513
}

bin/xbps-install/util.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ ttype2str(xbps_dictionary_t pkgd)
122122
return "hold";
123123
case XBPS_TRANS_DOWNLOAD:
124124
return "download";
125+
case XBPS_TRANS_REPLACED:
126+
return "replaced";
125127
default:
126128
return "unknown";
127129
}

0 commit comments

Comments
 (0)