xbps-install: skip trans if all pkgs are installed or uptodate.

Fixes an issue pointed out by @Johnnynator
This commit is contained in:
Juan RP 2019-06-21 19:19:09 +02:00
parent 2f1fd70a4e
commit 58509996aa
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368

View File

@ -124,7 +124,7 @@ main(int argc, char **argv)
const char *rootdir, *cachedir, *confdir; const char *rootdir, *cachedir, *confdir;
int i, c, flags, rv, fflag = 0; int i, c, flags, rv, fflag = 0;
bool syncf, yes, reinstall, drun, update; bool syncf, yes, reinstall, drun, update;
int maxcols; int maxcols, eexist = 0;
rootdir = cachedir = confdir = NULL; rootdir = cachedir = confdir = NULL;
flags = rv = 0; flags = rv = 0;
@ -244,6 +244,8 @@ main(int argc, char **argv)
exit(rv); exit(rv);
} }
eexist = optind;
if (update && (argc == optind)) { if (update && (argc == optind)) {
/* Update all installed packages */ /* Update all installed packages */
rv = dist_upgrade(&xh, maxcols, yes, drun); rv = dist_upgrade(&xh, maxcols, yes, drun);
@ -254,11 +256,15 @@ main(int argc, char **argv)
if (rv == EEXIST) { if (rv == EEXIST) {
/* pkg already updated, ignore */ /* pkg already updated, ignore */
rv = 0; rv = 0;
eexist++;
} else if (rv != 0) { } else if (rv != 0) {
xbps_end(&xh); xbps_end(&xh);
exit(rv); exit(rv);
} }
} }
if (eexist == argc)
return 0;
rv = exec_transaction(&xh, maxcols, yes, drun); rv = exec_transaction(&xh, maxcols, yes, drun);
} else if (!update) { } else if (!update) {
/* Install target packages */ /* Install target packages */
@ -267,11 +273,15 @@ main(int argc, char **argv)
if (rv == EEXIST) { if (rv == EEXIST) {
/* pkg already installed, ignore */ /* pkg already installed, ignore */
rv = 0; rv = 0;
eexist++;
} else if (rv != 0) { } else if (rv != 0) {
xbps_end(&xh); xbps_end(&xh);
exit(rv); exit(rv);
} }
} }
if (eexist == argc)
return 0;
rv = exec_transaction(&xh, maxcols, yes, drun); rv = exec_transaction(&xh, maxcols, yes, drun);
} }