From 26c1e80933df224c01a4f99bb345bb9c0449c2e7 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 6 May 2014 16:25:52 +0200 Subject: [PATCH] xbps-remove(8): -n,--dry-run option does not need pkgdb write perms anymore. --- NEWS | 4 ++++ bin/xbps-remove/main.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index be8b6615..7af5152e 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/bin/xbps-remove/main.c b/bin/xbps-remove/main.c index b1b433d2..723bb3ea 100644 --- a/bin/xbps-remove/main.c +++ b/bin/xbps-remove/main.c @@ -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); }