xbps-remove(8): -n,--dry-run option does not need pkgdb write perms anymore.

This commit is contained in:
Juan RP 2014-05-06 16:25:52 +02:00
parent bbae14f187
commit 26c1e80933
2 changed files with 12 additions and 4 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.37 (???):
* xbps-remove(8): the -n,--dry-run option does not acquire the pkgdb file lock
anymore, so that any user can use this mode even without write permission to
the target pkgdb.
* xbps-remove(8) -O, --clean-cache is now multithreaded. Gives a performance
boost as the number of threads increases.

View File

@ -262,7 +262,7 @@ main(int argc, char **argv)
exit(rv);;
}
if ((rv = xbps_pkgdb_lock(&xh)) != 0) {
if (!drun && (rv = xbps_pkgdb_lock(&xh)) != 0) {
fprintf(stderr, "failed to lock pkgdb: %s\n", strerror(rv));
exit(rv);
}
@ -284,19 +284,23 @@ main(int argc, char **argv)
if (rv == 0)
continue;
else if (rv != EEXIST) {
xbps_pkgdb_unlock(&xh);
if (!drun) {
xbps_pkgdb_unlock(&xh);
}
exit(rv);
} else {
reqby_force = true;
}
}
if (reqby_force && !ignore_revdeps) {
if (reqby_force && !ignore_revdeps && !drun) {
xbps_pkgdb_unlock(&xh);
exit(EXIT_FAILURE);
}
if (orphans || (argc > optind)) {
rv = exec_transaction(&xh, maxcols, yes, drun);
}
xbps_pkgdb_unlock(&xh);
if (!drun) {
xbps_pkgdb_unlock(&xh);
}
exit(rv);
}