xbps: merge patch from master to fix a regresion in xbps-remove(1).

See https://github.com/void-linux/xbps/issues/140
This commit is contained in:
Juan RP 2019-06-25 11:13:20 +02:00
parent 67cd850ebf
commit a0a48bd510
No known key found for this signature in database
GPG key ID: AF19F6CB482F9368
2 changed files with 57 additions and 1 deletions

View file

@ -0,0 +1,56 @@
commit 83aa486f6ba049399e457c34be23a7a435f83ceb
Author: Juan RP <xtraeme@gmail.com>
Date: Tue Jun 25 10:32:02 2019 +0200
xbps-remove: skip trans if all pkgs were not found.
Restores behaviour with xbps<0.54.
diff --git a/bin/xbps-remove/main.c b/bin/xbps-remove/main.c
index 61057029..1ef328a8 100644
--- bin/xbps-remove/main.c
+++ bin/xbps-remove/main.c
@@ -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);
}

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.56
revision=1
revision=2
bootstrap=yes
build_style=configure
short_desc="XBPS package system utilities"