xbps{,-static}: backport patch from master.

The patch makes xbps-install(1) only return EEXIST if
there are file conflicts in transaction.

Previously xbps-install(1) could return EEXIST if
pkg is already installed or up-to-date.
This commit is contained in:
Juan RP 2019-06-21 11:44:04 +02:00
parent 7689737106
commit 0e46d29f44
No known key found for this signature in database
GPG Key ID: AF19F6CB482F9368
3 changed files with 64 additions and 2 deletions

View File

@ -2,7 +2,7 @@
# NOTE: keep this package synchronized with "srcpkgs/xbps".
pkgname=xbps-static
version=0.54
revision=2
revision=3
# only musl
archs="*-musl"
wrksrc="xbps-${version}"
@ -14,6 +14,7 @@ short_desc="XBPS package system utilities - static binaries"
maintainer="Juan RP <xtraeme@voidlinux.org>"
license="BSD-2-Clause"
homepage="https://www.voidlinux.org/xbps"
changelog="https://github.com/void-linux/xbps/blob/master/NEWS"
distfiles="https://github.com/void-linux/xbps/archive/${version}.tar.gz"
checksum=f7e97a342d9eb3f38274bef3136f91398692f50d84fd23bc7990da2000936a98

View File

@ -0,0 +1,61 @@
commit 288cff37f8da02d29f054c736896432a4addfc5c
Author: Juan RP <xtraeme@gmail.com>
Date: Fri Jun 21 11:06:45 2019 +0200
xbps-install: return 0 if pkg is already installed or uptodate.
Before this change xbps-install could return EEXIST
when the package is already installed, or already up-to-date.
Return 0 if such condition happens, and only return EEXIST
if there's a file conflict.
Close #51
diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c
index 30033218..bba6337d 100644
--- bin/xbps-install/main.c
+++ bin/xbps-install/main.c
@@ -239,11 +239,11 @@ main(int argc, char **argv)
rv = dist_upgrade(&xh, maxcols, yes, drun);
} else if (update) {
/* Update target packages */
- int npkgs = argc - optind;
for (i = optind; i < argc; i++) {
rv = update_pkg(&xh, argv[i]);
- if (npkgs >= 2 && rv == EEXIST) {
- ;
+ if (rv == EEXIST) {
+ /* pkg already updated, ignore */
+ rv = 0;
} else if (rv != 0) {
xbps_end(&xh);
exit(rv);
@@ -252,11 +252,11 @@ main(int argc, char **argv)
rv = exec_transaction(&xh, maxcols, yes, drun);
} else if (!update) {
/* Install target packages */
- int npkgs = argc - optind;
for (i = optind; i < argc; i++) {
rv = install_new_pkg(&xh, argv[i], reinstall);
- if (npkgs >= 2 && rv == EEXIST) {
- ;
+ if (rv == EEXIST) {
+ /* pkg already installed, ignore */
+ rv = 0;
} else if (rv != 0) {
xbps_end(&xh);
exit(rv);
diff --git a/bin/xbps-install/transaction.c b/bin/xbps-install/transaction.c
index 2601b845..a397f59d 100644
--- bin/xbps-install/transaction.c
+++ bin/xbps-install/transaction.c
@@ -389,6 +389,8 @@ exec_transaction(struct xbps_handle *xhp, int maxcols, bool yes, bool drun)
trans->dl_pkgcnt, trans->inst_pkgcnt,
trans->up_pkgcnt, trans->cf_pkgcnt + trans->inst_pkgcnt,
trans->rm_pkgcnt);
+ } else {
+ fprintf(stderr, "Transaction failed! see above for errors.\n");
}
out:
if (trans->iter)

View File

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