xbps-install/transaction: fix for all_pkgs_on_hold.

If all pkgs are on hold in transaction skip stats
and return early.
This commit is contained in:
Juan RP 2020-02-22 10:51:27 +01:00
parent 33f26c4332
commit 5a6709b560
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368

View File

@ -251,12 +251,10 @@ static bool
all_pkgs_on_hold(struct transaction *trans) all_pkgs_on_hold(struct transaction *trans)
{ {
xbps_object_t obj; xbps_object_t obj;
xbps_trans_type_t ttype;
bool all_on_hold = true; bool all_on_hold = true;
while ((obj = xbps_object_iterator_next(trans->iter)) != NULL) { while ((obj = xbps_object_iterator_next(trans->iter)) != NULL) {
ttype = xbps_transaction_pkg_type(obj); if (xbps_transaction_pkg_type(obj) != XBPS_TRANS_HOLD) {
if (ttype != XBPS_TRANS_HOLD) {
all_on_hold = false; all_on_hold = false;
break; break;
} }
@ -419,18 +417,17 @@ exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun)
show_actions(trans->iter); show_actions(trans->iter);
goto out; goto out;
} }
/*
* No need to do anything if all packages are on hold.
*/
if (all_pkgs_on_hold(trans)) {
goto out;
}
/* /*
* Show download/installed size for the transaction. * Show download/installed size for the transaction.
*/ */
if ((rv = show_transaction_sizes(trans, maxcols)) != 0) if ((rv = show_transaction_sizes(trans, maxcols)) != 0)
goto out; goto out;
/*
* No need to do anything if all packages are on hold.
*/
if (all_pkgs_on_hold(trans)) {
printf("All packages on hold.\n");
goto out;
}
/* /*
* Ask interactively (if -y not set). * Ask interactively (if -y not set).
*/ */