xbps-remove: skip trans if all pkgs were not found.

Restores behaviour with xbps<0.54.
This commit is contained in:
Juan RP 2019-06-25 10:32:02 +02:00
parent a1a0407548
commit 83aa486f6b
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368

View File

@ -145,7 +145,7 @@ remove_pkg(struct xbps_handle *xhp, const char *pkgname, bool recursive)
return rv;
} else if (rv == ENOENT) {
printf("Package `%s' is not currently installed.\n", pkgname);
return 0;
return rv;
} else if (rv != 0) {
xbps_error_printf("Failed to queue `%s' for removing: %s\n",
pkgname, strerror(rv));
@ -180,7 +180,7 @@ main(int argc, char **argv)
const char *rootdir, *cachedir, *confdir;
int c, flags, rv;
bool yes, drun, recursive, clean_cache, orphans;
int maxcols;
int maxcols, missing;
rootdir = cachedir = confdir = NULL;
flags = rv = 0;
@ -284,16 +284,24 @@ main(int argc, char **argv)
}
}
missing = optind;
for (int i = optind; i < argc; i++) {
rv = remove_pkg(&xh, argv[i], recursive);
if (rv != 0) {
if (rv == ENOENT) {
missing++;
continue;
} else if (rv != 0) {
xbps_end(&xh);
exit(rv);
}
}
if (missing == argc) {
goto out;
}
if (orphans || (argc > optind)) {
rv = exec_transaction(&xh, maxcols, yes, drun);
}
out:
xbps_end(&xh);
exit(rv);
}