commit:     484e623c7cf83d45191e0d22f14cb5e86faf70c9
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 12 19:09:49 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 19:20:26 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=484e623c

dev-ml/ocaml-conduit: Fix build with lwt3.

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 dev-ml/ocaml-conduit/files/lwt3.patch            | 58 ++++++++++++++++++++++++
 dev-ml/ocaml-conduit/ocaml-conduit-0.15.0.ebuild |  8 +++-
 2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/dev-ml/ocaml-conduit/files/lwt3.patch 
b/dev-ml/ocaml-conduit/files/lwt3.patch
new file mode 100644
index 00000000000..de849e60d79
--- /dev/null
+++ b/dev-ml/ocaml-conduit/files/lwt3.patch
@@ -0,0 +1,58 @@
+Index: ocaml-conduit-0.15.0/lib/conduit_lwt_server.ml
+===================================================================
+--- ocaml-conduit-0.15.0.orig/lib/conduit_lwt_server.ml
++++ ocaml-conduit-0.15.0/lib/conduit_lwt_server.ml
+@@ -15,10 +15,10 @@ let close (ic, oc) =
+ let listen ?(backlog=128) sa =
+   let fd = Lwt_unix.socket (Unix.domain_of_sockaddr sa) Unix.SOCK_STREAM 0 in
+   Lwt_unix.(setsockopt fd SO_REUSEADDR true);
+-  Lwt_unix.bind fd sa;
++  Lwt_unix.bind fd sa >>= fun _ ->
+   Lwt_unix.listen fd backlog;
+   Lwt_unix.set_close_on_exec fd;
+-  fd
++  Lwt.return fd
+ 
+ let with_socket sockaddr f =
+   let fd =
+Index: ocaml-conduit-0.15.0/lib/conduit_lwt_server.mli
+===================================================================
+--- ocaml-conduit-0.15.0.orig/lib/conduit_lwt_server.mli
++++ ocaml-conduit-0.15.0/lib/conduit_lwt_server.mli
+@@ -3,7 +3,7 @@ val close : 'a Lwt_io.channel * 'b Lwt_i
+ 
+ val set_max_active : int -> unit
+ 
+-val listen : ?backlog:int -> Unix.sockaddr -> Lwt_unix.file_descr
++val listen : ?backlog:int -> Unix.sockaddr -> Lwt_unix.file_descr Lwt.t
+ 
+ val with_socket
+   : Unix.sockaddr
+Index: ocaml-conduit-0.15.0/lib/conduit_lwt_unix.ml
+===================================================================
+--- ocaml-conduit-0.15.0.orig/lib/conduit_lwt_unix.ml
++++ ocaml-conduit-0.15.0/lib/conduit_lwt_unix.ml
+@@ -167,11 +167,12 @@ let init ?src ?(tls_server_key=`None) ()
+ module Sockaddr_client = struct
+   let connect ?src sa =
+     Conduit_lwt_server.with_socket sa (fun fd ->
+-        let () =
++        let tx () =
+           match src with
+-          | None -> ()
++          | None -> Lwt.return ()
+           | Some src_sa -> Lwt_unix.bind fd src_sa
+-        in
++      in
++      tx () >>= fun () ->
+         Lwt_unix.connect fd sa >>= fun () ->
+         let ic = Lwt_io.of_fd ~mode:Lwt_io.input fd in
+         let oc = Lwt_io.of_fd ~mode:Lwt_io.output fd in
+@@ -199,6 +200,7 @@ module Sockaddr_server = struct
+       match on with
+       | `Socket s -> s
+       | `Sockaddr sockaddr -> Conduit_lwt_server.listen ?backlog sockaddr in
++    s >>= fun s ->
+     Conduit_lwt_server.init ?stop (process_accept ?timeout callback) s
+ end
+ 

diff --git a/dev-ml/ocaml-conduit/ocaml-conduit-0.15.0.ebuild 
b/dev-ml/ocaml-conduit/ocaml-conduit-0.15.0.ebuild
index 8e5f0e39101..cd8c6a3b6cc 100644
--- a/dev-ml/ocaml-conduit/ocaml-conduit-0.15.0.ebuild
+++ b/dev-ml/ocaml-conduit/ocaml-conduit-0.15.0.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=5
 
-inherit findlib
+inherit findlib eutils
 
 DESCRIPTION="Dereference URIs into communication channels for Async or Lwt"
 HOMEPAGE="https://github.com/mirage/ocaml-conduit";
@@ -23,7 +23,7 @@ DEPEND="
        dev-ml/ocaml-cstruct:=
        dev-ml/ocaml-ipaddr:=
 
-       dev-ml/lwt:=
+       >=dev-ml/lwt-3:=
        dev-ml/async:=
        dev-ml/ocaml-dns:=
        dev-ml/ocaml-ssl:=
@@ -39,6 +39,10 @@ DEPEND="${DEPEND}
 
 DOCS=( TODO.md README.md CHANGES )
 
+src_prepare() {
+       epatch "${FILESDIR}/lwt3.patch"
+}
+
 src_install() {
        findlib_src_preinst
        default

Reply via email to