From c949b882c52bb7cdcb64656b43417abe854d9e8b Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Mon, 24 Jun 2019 11:33:56 +0200
Subject: [PATCH] xbps{,-static}: update to 0.56.

---
 srcpkgs/xbps-static/template                  |  6 +-
 srcpkgs/xbps/patches/11e5190a.patch           | 34 ----------
 srcpkgs/xbps/patches/2f1fd70a4e.patch         | 22 -------
 srcpkgs/xbps/patches/58509996aabea5.patch     | 62 -------------------
 ...2cc3573df496752c3698ce9949300e61d9c6.patch | 21 -------
 srcpkgs/xbps/template                         |  8 +--
 6 files changed, 7 insertions(+), 146 deletions(-)
 delete mode 100644 srcpkgs/xbps/patches/11e5190a.patch
 delete mode 100644 srcpkgs/xbps/patches/2f1fd70a4e.patch
 delete mode 100644 srcpkgs/xbps/patches/58509996aabea5.patch
 delete mode 100644 srcpkgs/xbps/patches/7e762cc3573df496752c3698ce9949300e61d9c6.patch

diff --git a/srcpkgs/xbps-static/template b/srcpkgs/xbps-static/template
index 6290d4ec010..9f0fbec07bc 100644
--- a/srcpkgs/xbps-static/template
+++ b/srcpkgs/xbps-static/template
@@ -1,8 +1,8 @@
 # Template file for 'xbps-static'
 # NOTE: keep this package synchronized with "srcpkgs/xbps"
 pkgname=xbps-static
-version=0.55
-revision=5
+version=0.56
+revision=1
 # only musl
 archs="*-musl"
 wrksrc="xbps-${version}"
@@ -16,7 +16,7 @@ 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=982620ec3c207a8b935ebb3b50f81ce553e53a5da291be2719609adf0a5f48d2
+checksum=e46521513b0c0ff486cc190089277381b18db45e770b04f799dc4eec99ffccd4
 
 do_configure() {
 	./configure --prefix=/usr --sysconfdir=/etc --enable-static
diff --git a/srcpkgs/xbps/patches/11e5190a.patch b/srcpkgs/xbps/patches/11e5190a.patch
deleted file mode 100644
index c74001fdf7f..00000000000
--- a/srcpkgs/xbps/patches/11e5190a.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 11e5190a36972ced2c0c79da9d6c00ecdbd75bfa Mon Sep 17 00:00:00 2001
-From: Johannes Brechtmann <johannes@jnbr.me>
-Date: Sat, 22 Jun 2019 16:40:49 +0200
-Subject: [PATCH] lib/fetch: happy_eyeballs_connect check for waiting
- connections before decrementing them, remove dead code
-
----
- lib/fetch/common.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/lib/fetch/common.c b/lib/fetch/common.c
-index df7f33dd..885fc743 100644
---- lib/fetch/common.c
-+++ lib/fetch/common.c
-@@ -609,6 +609,8 @@ happy_eyeballs_connect(struct addrinfo *res0, int verbose)
- 			if (pfd[i].fd != -1)
- 				pfd[i].events = POLLOUT;
- 		}
-+		if (!waiting)
-+			break;
- 		if ((ret = poll(pfd, attempts, timeout ? timeout : -1)) == -1) {
- 			err = errno;
- 			rv = -1;
-@@ -639,10 +641,6 @@ happy_eyeballs_connect(struct addrinfo *res0, int verbose)
- 			rv = -1;
- 			break;
- 		}
--		if (!waiting)
--			break;
--		else if (done)
--			goto wait;
- 	}
- 
- out:
diff --git a/srcpkgs/xbps/patches/2f1fd70a4e.patch b/srcpkgs/xbps/patches/2f1fd70a4e.patch
deleted file mode 100644
index 80b539c8e61..00000000000
--- a/srcpkgs/xbps/patches/2f1fd70a4e.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-commit 2f1fd70a4e9ec65dc83a4d98dba1b3fc2be9c6ce
-Author: Juan RP <xtraeme@gmail.com>
-Date:   Fri Jun 21 17:13:06 2019 +0200
-
-    xbps_transaction_prepare: initialize trans dict!
-    
-    ... otherwise it will always return ENXIO
-
-diff --git a/lib/transaction_prepare.c b/lib/transaction_prepare.c
-index 9921127d..79a68f2a 100644
---- lib/transaction_prepare.c
-+++ lib/transaction_prepare.c
-@@ -279,6 +279,9 @@ xbps_transaction_prepare(struct xbps_handle *xhp)
- 	unsigned int i, cnt;
- 	int rv = 0;
- 
-+	if ((rv = xbps_transaction_init(xhp)) != 0)
-+		return rv;
-+
- 	if (xhp->transd == NULL)
- 		return ENXIO;
- 
diff --git a/srcpkgs/xbps/patches/58509996aabea5.patch b/srcpkgs/xbps/patches/58509996aabea5.patch
deleted file mode 100644
index c1515eb2352..00000000000
--- a/srcpkgs/xbps/patches/58509996aabea5.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-commit 58509996aabea52ffc40e5e01c9eb00730c6cdcc
-Author: Juan RP <xtraeme@gmail.com>
-Date:   Fri Jun 21 19:19:09 2019 +0200
-
-    xbps-install: skip trans if all pkgs are installed or uptodate.
-    
-    Fixes an issue pointed out by @Johnnynator
-
-diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c
-index 8cbba174..371f26c8 100644
---- bin/xbps-install/main.c
-+++ bin/xbps-install/main.c
-@@ -124,7 +124,7 @@ main(int argc, char **argv)
- 	const char *rootdir, *cachedir, *confdir;
- 	int i, c, flags, rv, fflag = 0;
- 	bool syncf, yes, reinstall, drun, update;
--	int maxcols;
-+	int maxcols, eexist = 0;
- 
- 	rootdir = cachedir = confdir = NULL;
- 	flags = rv = 0;
-@@ -244,6 +244,8 @@ main(int argc, char **argv)
- 		exit(rv);
- 	}
- 
-+	eexist = optind;
-+
- 	if (update && (argc == optind)) {
- 		/* Update all installed packages */
- 		rv = dist_upgrade(&xh, maxcols, yes, drun);
-@@ -254,11 +256,15 @@ main(int argc, char **argv)
- 			if (rv == EEXIST) {
- 				/* pkg already updated, ignore */
- 				rv = 0;
-+				eexist++;
- 			} else if (rv != 0) {
- 				xbps_end(&xh);
- 				exit(rv);
- 			}
- 		}
-+		if (eexist == argc)
-+			return 0;
-+
- 		rv = exec_transaction(&xh, maxcols, yes, drun);
- 	} else if (!update) {
- 		/* Install target packages */
-@@ -267,11 +273,15 @@ main(int argc, char **argv)
- 			if (rv == EEXIST) {
- 				/* pkg already installed, ignore */
- 				rv = 0;
-+				eexist++;
- 			} else if (rv != 0) {
- 				xbps_end(&xh);
- 				exit(rv);
- 			}
- 		}
-+		if (eexist == argc)
-+			return 0;
-+
- 		rv = exec_transaction(&xh, maxcols, yes, drun);
- 	}
- 
diff --git a/srcpkgs/xbps/patches/7e762cc3573df496752c3698ce9949300e61d9c6.patch b/srcpkgs/xbps/patches/7e762cc3573df496752c3698ce9949300e61d9c6.patch
deleted file mode 100644
index 72d62f5d13c..00000000000
--- a/srcpkgs/xbps/patches/7e762cc3573df496752c3698ce9949300e61d9c6.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-commit 7e762cc3573df496752c3698ce9949300e61d9c6
-Author: Duncaen <mail@duncano.de>
-Date:   Fri Jun 21 20:23:55 2019 +0200
-
-    lib/fetch.c: ignore EADDRNOTAVAIL and try next ip
-
-diff --git lib/fetch/common.c lib/fetch/common.c
-index 6bd8f510..df7f33dd 100644
---- lib/fetch/common.c
-+++ lib/fetch/common.c
-@@ -580,6 +580,10 @@ happy_eyeballs_connect(struct addrinfo *res0, int verbose)
- 					unreach |= UNREACH_IPV6;
- 				}
- 				continue;
-+			} else if (errno == EADDRNOTAVAIL) {
-+				err = errno;
-+				close(sd);
-+				continue;
- 			} else {
- 				err = errno;
- 				rv = -1;
diff --git a/srcpkgs/xbps/template b/srcpkgs/xbps/template
index 7cb8886d636..0552bf2c309 100644
--- a/srcpkgs/xbps/template
+++ b/srcpkgs/xbps/template
@@ -1,7 +1,7 @@
 # Template file for 'xbps'
 pkgname=xbps
-version=0.55
-revision=5
+version=0.56
+revision=1
 bootstrap=yes
 build_style=configure
 short_desc="XBPS package system utilities"
@@ -10,7 +10,7 @@ license="BSD-2-Clause"
 homepage="https://github.com/void-linux/xbps"
 changelog="https://github.com/void-linux/xbps/blob/master/NEWS"
 distfiles="https://github.com/void-linux/xbps/archive/${version}.tar.gz"
-checksum=982620ec3c207a8b935ebb3b50f81ce553e53a5da291be2719609adf0a5f48d2
+checksum=e46521513b0c0ff486cc190089277381b18db45e770b04f799dc4eec99ffccd4
 
 hostmakedepends="pkg-config"
 checkdepends="kyua"
@@ -60,7 +60,7 @@ libxbps_package() {
 }
 libxbps-devel_package() {
 	short_desc+=" - runtime library (development files)"
-	depends="zlib-devel libarchive-devel libxbps>=${version}_${revision}"
+	depends="${makedepends} libxbps>=${version}_${revision}"
 	pkg_install() {
 		vmove usr/include
 		vmove "usr/lib/*.a"
