From b9c7908158ab3673fca8fd5f95f5a9afea1457e2 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Jul 03 2017 16:13:33 +0000 Subject: Adapt to unixsocket API changes --- diff --git a/0001-Adapt-to-API-changes-in-latest-jnr-unixsocket.patch b/0001-Adapt-to-API-changes-in-latest-jnr-unixsocket.patch new file mode 100644 index 0000000..39cb313 --- /dev/null +++ b/0001-Adapt-to-API-changes-in-latest-jnr-unixsocket.patch @@ -0,0 +1,93 @@ +From 2beafcb61b32ebf6fd4af791f4e2d2aefef82763 Mon Sep 17 00:00:00 2001 +From: Mat Booth +Date: Mon, 3 Jul 2017 14:27:51 +0100 +Subject: [PATCH] Adapt to API changes in latest jnr-unixsocket. + +In the latest version of jnr-unixsocket, some getter/setter methods in +the UnixSocketChannel object went away. This change replaces usage of +those getters/setters with calls to getOption/setOption instead. + +Signed-off-by: Mat Booth +--- + pom.xml | 2 +- + .../spotify/docker/client/ApacheUnixSocket.java | 25 ++++++++++++++++++---- + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/pom.xml b/pom.xml +index 0550af5..4399a9d 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -139,7 +139,7 @@ + + com.github.jnr + jnr-unixsocket +- 0.8 ++ 0.18 + + + commons-lang +diff --git a/src/main/java/com/spotify/docker/client/ApacheUnixSocket.java b/src/main/java/com/spotify/docker/client/ApacheUnixSocket.java +index 4d8fb09..a19998f 100644 +--- a/src/main/java/com/spotify/docker/client/ApacheUnixSocket.java ++++ b/src/main/java/com/spotify/docker/client/ApacheUnixSocket.java +@@ -36,6 +36,7 @@ import java.util.Queue; + + import jnr.unixsocket.UnixSocketAddress; + import jnr.unixsocket.UnixSocketChannel; ++import jnr.unixsocket.UnixSocketOptions; + + /** + * Provides a socket that wraps an jnr.unixsocket.UnixSocketChannel and delays setting options until +@@ -196,14 +197,22 @@ public class ApacheUnixSocket extends Socket { + setSocketOption(new SocketOptionSetter() { + @Override + public void run() throws SocketException { +- inner.setSoTimeout(timeout); ++ try { ++ inner.setOption(UnixSocketOptions.SO_RCVTIMEO, Integer.valueOf(timeout)); ++ } catch (IOException e) { ++ throw (SocketException)new SocketException().initCause(e); ++ } + } + }); + } + + @Override + public synchronized int getSoTimeout() throws SocketException { +- return inner.getSoTimeout(); ++ try { ++ return inner.getOption(UnixSocketOptions.SO_RCVTIMEO).intValue(); ++ } catch (IOException e) { ++ throw (SocketException)new SocketException().initCause(e); ++ } + } + + @Override +@@ -231,14 +240,22 @@ public class ApacheUnixSocket extends Socket { + setSocketOption(new SocketOptionSetter() { + @Override + public void run() throws SocketException { +- inner.setKeepAlive(on); ++ try { ++ inner.setOption(UnixSocketOptions.SO_KEEPALIVE, Boolean.valueOf(on)); ++ } catch (IOException e) { ++ throw (SocketException)new SocketException().initCause(e); ++ } + } + }); + } + + @Override + public boolean getKeepAlive() throws SocketException { +- return inner.getKeepAlive(); ++ try { ++ return inner.getOption(UnixSocketOptions.SO_KEEPALIVE).booleanValue(); ++ } catch (IOException e) { ++ throw (SocketException)new SocketException().initCause(e); ++ } + } + + @Override +-- +2.7.5 + diff --git a/docker-client.spec b/docker-client.spec index aead277..f20bc19 100644 --- a/docker-client.spec +++ b/docker-client.spec @@ -1,17 +1,20 @@ Name: docker-client Version: 6.2.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Docker Client License: ASL 2.0 URL: https://github.com/spotify/docker-client Source0: https://github.com/spotify/docker-client/archive/v%{version}.tar.gz +# Sent upstream: https://github.com/spotify/docker-client/pull/817 +Patch0: 0001-Adapt-to-API-changes-in-latest-jnr-unixsocket.patch + BuildRequires: maven-local BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind) BuildRequires: mvn(com.fasterxml.jackson.datatype:jackson-datatype-guava) BuildRequires: mvn(com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider) -BuildRequires: mvn(com.github.jnr:jnr-unixsocket) +BuildRequires: mvn(com.github.jnr:jnr-unixsocket) >= 0.18 BuildRequires: mvn(com.google.guava:guava) BuildRequires: mvn(commons-lang:commons-lang) BuildRequires: mvn(org.apache.commons:commons-compress) @@ -37,6 +40,7 @@ The Docker Client is a Java API library for accessing a Docker daemon. %prep %setup -q -n docker-client-%{version} +%patch0 -p1 # The parent pom doen't add anything we can't live without %pom_remove_parent @@ -75,10 +79,13 @@ sed -i -e '//acom.spotify' pom.xml %mvn_install %files -f .mfiles -%license LICENSE -%doc NOTICE README.md +%license LICENSE NOTICE +%doc README.md %changelog +* Mon Jul 03 2017 Mat Booth - 6.2.5-2 +- Adapt to unixsocket API changes + * Fri Jun 16 2017 Mat Booth - 6.2.5-1 - Update to docker-client 6.2.5 - Remove SCL macros forbidden in Fedora