void-packages/srcpkgs/xbps/patches/83aa486f6ba049399.patch

57 lines
1.4 KiB
Diff

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);
}