Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-ml/onanomsg/files/, dev-ml/onanomsg/
Date: Tue, 09 May 2017 07:14:50
Message-Id: 1494314061.92931e35533b6568378bbc0a5828068e25b72851.aballier@gentoo
1 commit: 92931e35533b6568378bbc0a5828068e25b72851
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 9 06:52:56 2017 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Tue May 9 07:14:21 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92931e35
7
8 dev-ml/onanomsg: Backport upstream patch to use ocaml-bigstring, fixes build with latest ocaml-containers
9
10 Package-Manager: Portage-2.3.5, Repoman-2.3.2
11
12 dev-ml/onanomsg/files/bigstring.patch | 218 +++++++++++++++++++++
13 ...{onanomsg-1.0.ebuild => onanomsg-1.0-r1.ebuild} | 10 +-
14 2 files changed, 226 insertions(+), 2 deletions(-)
15
16 diff --git a/dev-ml/onanomsg/files/bigstring.patch b/dev-ml/onanomsg/files/bigstring.patch
17 new file mode 100644
18 index 00000000000..311fa2ee749
19 --- /dev/null
20 +++ b/dev-ml/onanomsg/files/bigstring.patch
21 @@ -0,0 +1,218 @@
22 +Index: onanomsg-1.0/lib/nanomsg.ml
23 +===================================================================
24 +--- onanomsg-1.0.orig/lib/nanomsg.ml
25 ++++ onanomsg-1.0/lib/nanomsg.ml
26 +@@ -209,7 +209,7 @@ let recv_fd sock =
27 + (Obj.magic fd : Unix.file_descr)
28 +
29 + let send_bigstring_buf ?(block=true) sock buf pos len =
30 +- if pos < 0 || len < 0 || pos + len > CCBigstring.size buf
31 ++ if pos < 0 || len < 0 || pos + len > Bigstring.size buf
32 + then invalid_arg "bounds";
33 + let nn_buf = nn_allocmsg (size_of_int len) 0 in
34 + match nn_buf with
35 +@@ -218,12 +218,12 @@ let send_bigstring_buf ?(block=true) soc
36 + let nn_buf_p = Ctypes.(allocate (ptr void) nn_buf) in
37 + let ba = Ctypes.(bigarray_of_ptr array1 len
38 + Bigarray.char @@ from_voidp char nn_buf) in
39 +- CCBigstring.blit buf pos ba 0 len;
40 ++ Bigstring.blit buf pos ba 0 len;
41 + ignore @@ raise_notequal len
42 + (fun () -> nn_send sock nn_buf_p nn_msg (int_of_bool block))
43 +
44 + let send_bigstring ?(block=true) sock buf =
45 +- send_bigstring_buf ~block sock buf 0 @@ CCBigstring.size buf
46 ++ send_bigstring_buf ~block sock buf 0 @@ Bigstring.size buf
47 +
48 + let send_bytes_buf ?(block=true) sock buf pos len =
49 + if pos < 0 || len < 0 || pos + len > Bytes.length buf
50 +@@ -235,7 +235,7 @@ let send_bytes_buf ?(block=true) sock bu
51 + let nn_buf_p = Ctypes.(allocate (ptr void) nn_buf) in
52 + let ba = Ctypes.(bigarray_of_ptr array1 len
53 + Bigarray.char @@ from_voidp char nn_buf) in
54 +- CCBigstring.blit_of_bytes buf pos ba 0 len;
55 ++ Bigstring.blit_of_bytes buf pos ba 0 len;
56 + ignore @@ raise_notequal len
57 + (fun () -> nn_send sock nn_buf_p nn_msg (int_of_bool block))
58 +
59 +@@ -266,16 +266,16 @@ let recv ?(block=true) sock f =
60 + let recv_bytes_buf ?(block=true) sock buf pos =
61 + recv ~block sock
62 + (fun ba ->
63 +- let len = CCBigstring.size ba in
64 +- CCBigstring.(blit_to_bytes ba 0 buf pos len);
65 ++ let len = Bigstring.size ba in
66 ++ Bigstring.(blit_to_bytes ba 0 buf pos len);
67 + len
68 + )
69 +
70 + let recv_bytes ?(block=true) sock =
71 + recv ~block sock (fun ba ->
72 +- let len = CCBigstring.size ba in
73 ++ let len = Bigstring.size ba in
74 + let buf = Bytes.create len in
75 +- CCBigstring.blit_to_bytes ba 0 buf 0 len;
76 ++ Bigstring.blit_to_bytes ba 0 buf 0 len;
77 + buf)
78 +
79 + let recv_string ?(block=true) sock =
80 +Index: onanomsg-1.0/lib/nanomsg.mli
81 +===================================================================
82 +--- onanomsg-1.0.orig/lib/nanomsg.mli
83 ++++ onanomsg-1.0/lib/nanomsg.mli
84 +@@ -45,8 +45,8 @@ val close : socket -> unit
85 +
86 + (** {2 Zero-copy I/O} *)
87 +
88 +-val send_bigstring : ?block:bool -> socket -> CCBigstring.t -> unit
89 +-val send_bigstring_buf : ?block:bool -> socket -> CCBigstring.t -> int -> int -> unit
90 ++val send_bigstring : ?block:bool -> socket -> Bigstring.t -> unit
91 ++val send_bigstring_buf : ?block:bool -> socket -> Bigstring.t -> int -> int -> unit
92 +
93 + val send_string : ?block:bool -> socket -> string -> unit
94 + val send_string_buf : ?block:bool -> socket -> string -> int -> int -> unit
95 +@@ -54,7 +54,7 @@ val send_string_buf : ?block:bool -> soc
96 + val send_bytes : ?block:bool -> socket -> Bytes.t -> unit
97 + val send_bytes_buf : ?block:bool -> socket -> Bytes.t -> int -> int -> unit
98 +
99 +-val recv : ?block:bool -> socket -> (CCBigstring.t -> 'a) -> 'a
100 ++val recv : ?block:bool -> socket -> (Bigstring.t -> 'a) -> 'a
101 + (** [recv ?block sock f] applies [f] to the received message. The
102 + argument of [f] gets unallocated after [f] returns, so make sure
103 + [f] {b never} let a reference to its argument escape. *)
104 +Index: onanomsg-1.0/lib/nanomsg_lwt.ml
105 +===================================================================
106 +--- onanomsg-1.0.orig/lib/nanomsg_lwt.ml
107 ++++ onanomsg-1.0/lib/nanomsg_lwt.ml
108 +@@ -25,7 +25,7 @@ let raise_negative sock io_event f = rai
109 + let raise_notequal sock io_event v f = raise_if sock io_event (fun x -> x <> v) f
110 +
111 + let send_bigstring_buf sock buf pos len =
112 +- if pos < 0 || len < 0 || pos + len > CCBigstring.size buf
113 ++ if pos < 0 || len < 0 || pos + len > Bigstring.size buf
114 + then invalid_arg "bounds";
115 + let nn_buf = nn_allocmsg (size_of_int len) 0 in
116 + match nn_buf with
117 +@@ -34,14 +34,14 @@ let send_bigstring_buf sock buf pos len
118 + let nn_buf_p = Ctypes.(allocate (ptr void) nn_buf) in
119 + let ba = Ctypes.(bigarray_of_ptr array1 len
120 + Bigarray.char @@ from_voidp char nn_buf) in
121 +- CCBigstring.blit buf pos ba 0 len;
122 ++ Bigstring.blit buf pos ba 0 len;
123 + raise_notequal sock Lwt_unix.Write len
124 + (fun () -> nn_send (Obj.magic sock : int) nn_buf_p nn_msg
125 + Symbol.(value_of_name_exn "NN_DONTWAIT")) >|= fun nb_written ->
126 + ignore nb_written
127 +
128 + let send_bigstring sock buf =
129 +- send_bigstring_buf sock buf 0 @@ CCBigstring.size buf
130 ++ send_bigstring_buf sock buf 0 @@ Bigstring.size buf
131 +
132 + let send_bytes_buf sock buf pos len =
133 + if pos < 0 || len < 0 || pos + len > Bytes.length buf
134 +@@ -53,7 +53,7 @@ let send_bytes_buf sock buf pos len =
135 + let nn_buf_p = Ctypes.(allocate (ptr void) nn_buf) in
136 + let ba = Ctypes.(bigarray_of_ptr array1 len
137 + Bigarray.char @@ from_voidp char nn_buf) in
138 +- CCBigstring.blit_of_bytes buf pos ba 0 len;
139 ++ Bigstring.blit_of_bytes buf pos ba 0 len;
140 + raise_notequal sock Lwt_unix.Write len
141 + (fun () -> nn_send (Obj.magic sock : int) nn_buf_p nn_msg
142 + Symbol.(value_of_name_exn "NN_DONTWAIT")) >|= fun nb_written ->
143 +@@ -84,16 +84,16 @@ let recv sock f =
144 +
145 + let recv_bytes_buf sock buf pos =
146 + recv sock (fun ba ->
147 +- let len = CCBigstring.size ba in
148 +- CCBigstring.blit_to_bytes ba 0 buf pos len;
149 ++ let len = Bigstring.size ba in
150 ++ Bigstring.blit_to_bytes ba 0 buf pos len;
151 + Lwt.return len
152 + )
153 +
154 + let recv_bytes sock =
155 + recv sock (fun ba ->
156 +- let len = CCBigstring.size ba in
157 ++ let len = Bigstring.size ba in
158 + let buf = Bytes.create len in
159 +- CCBigstring.blit_to_bytes ba 0 buf 0 len;
160 ++ Bigstring.blit_to_bytes ba 0 buf 0 len;
161 + Lwt.return buf
162 + )
163 +
164 +Index: onanomsg-1.0/lib/nanomsg_lwt.mli
165 +===================================================================
166 +--- onanomsg-1.0.orig/lib/nanomsg_lwt.mli
167 ++++ onanomsg-1.0/lib/nanomsg_lwt.mli
168 +@@ -4,8 +4,8 @@ open Nanomsg
169 +
170 + (** {2 Zero-copy I/O} *)
171 +
172 +-val send_bigstring : socket -> CCBigstring.t -> unit Lwt.t
173 +-val send_bigstring_buf : socket -> CCBigstring.t -> int -> int -> unit Lwt.t
174 ++val send_bigstring : socket -> Bigstring.t -> unit Lwt.t
175 ++val send_bigstring_buf : socket -> Bigstring.t -> int -> int -> unit Lwt.t
176 +
177 + val send_string : socket -> string -> unit Lwt.t
178 + val send_string_buf : socket -> string -> int -> int -> unit Lwt.t
179 +@@ -13,7 +13,7 @@ val send_string_buf : socket -> string -
180 + val send_bytes : socket -> Bytes.t -> unit Lwt.t
181 + val send_bytes_buf : socket -> Bytes.t -> int -> int -> unit Lwt.t
182 +
183 +-val recv : socket -> (CCBigstring.t -> 'a Lwt.t) -> 'a Lwt.t
184 ++val recv : socket -> (Bigstring.t -> 'a Lwt.t) -> 'a Lwt.t
185 + (** [recv sock f] applies [f] to the received message. The
186 + argument of [f] gets unallocated after [f] returns, so make sure
187 + [f] {b never} let a reference to its argument escape. *)
188 +Index: onanomsg-1.0/_tags
189 +===================================================================
190 +--- onanomsg-1.0.orig/_tags
191 ++++ onanomsg-1.0/_tags
192 +@@ -4,7 +4,7 @@ true: debug, bin_annot, safe_string
193 + <lwt>: include
194 + <lib_test>: include
195 +
196 +-<lib/nanomsg*>: package(containers.bigarray), \
197 ++<lib/nanomsg*>: package(bigstring), \
198 + package(ctypes), \
199 + package(ipaddr), \
200 + package(ppx_deriving.std), \
201 +@@ -13,7 +13,7 @@ true: debug, bin_annot, safe_string
202 +
203 + <lib/nanomsg_lwt.*>: package(lwt.unix), package(lwt.ppx)
204 +
205 +-<lib_test/*>: package(containers.bigarray), \
206 ++<lib_test/*>: package(bigstring), \
207 + package(ctypes.foreign), \
208 + package(ipaddr), \
209 + package(lwt.unix), \
210 +@@ -21,7 +21,7 @@ true: debug, bin_annot, safe_string
211 + package(oUnit), \
212 + package(containers)
213 +
214 +-<examples/*>: package(containers.bigarray), \
215 ++<examples/*>: package(bigstring), \
216 + package(ctypes.foreign), \
217 + package(ipaddr), \
218 +- package(containers)
219 +\ No newline at end of file
220 ++ package(containers)
221 +Index: onanomsg-1.0/pkg/META
222 +===================================================================
223 +--- onanomsg-1.0.orig/pkg/META
224 ++++ onanomsg-1.0/pkg/META
225 +@@ -1,6 +1,6 @@
226 + version = "1.0"
227 + description = "Bindings to nanomsg"
228 +-requires = "ctypes.foreign ipaddr ppx_deriving.std containers containers.bigarray"
229 ++requires = "ctypes.foreign ipaddr ppx_deriving.std containers bigstring"
230 + archive(byte) = "nanomsg.cma"
231 + archive(byte, plugin) = "nanomsg.cma"
232 + archive(native) = "nanomsg.cmxa"
233 +@@ -15,4 +15,4 @@ package "lwt" (
234 + archive(native) = "nanomsg_lwt.cmxa"
235 + archive(native, plugin) = "nanomsg_lwt.cmxs"
236 + exists_if = "nanomsg_lwt.cma"
237 +-)
238 +\ No newline at end of file
239 ++)
240
241 diff --git a/dev-ml/onanomsg/onanomsg-1.0.ebuild b/dev-ml/onanomsg/onanomsg-1.0-r1.ebuild
242 similarity index 87%
243 rename from dev-ml/onanomsg/onanomsg-1.0.ebuild
244 rename to dev-ml/onanomsg/onanomsg-1.0-r1.ebuild
245 index 902a0e6f6c3..38e22c1fbe0 100644
246 --- a/dev-ml/onanomsg/onanomsg-1.0.ebuild
247 +++ b/dev-ml/onanomsg/onanomsg-1.0-r1.ebuild
248 @@ -3,14 +3,14 @@
249
250 EAPI=5
251
252 -inherit findlib
253 +inherit findlib eutils
254
255 DESCRIPTION="nanomsg bindings for OCaml"
256 HOMEPAGE="https://github.com/rgrinberg/onanomsg"
257 SRC_URI="https://github.com/rgrinberg/onanomsg/archive/${PV}.tar.gz -> ${P}.tar.gz"
258
259 LICENSE="WTFPL-2"
260 -SLOT="0/${PV}"
261 +SLOT="0/${PV}-bigstring"
262 KEYWORDS="~amd64"
263 IUSE="+lwt +ocamlopt test"
264
265 @@ -21,12 +21,18 @@ RDEPEND="
266 dev-ml/ocaml-ipaddr:=[ocamlopt?]
267 dev-ml/ppx_deriving:=[ocamlopt?]
268 dev-ml/ocaml-containers:=[ocamlopt?]
269 + dev-ml/ocaml-bigstring:=
270 lwt? ( dev-ml/lwt:=[ocamlopt?] )
271 "
272 DEPEND="${RDEPEND}
273 test? ( dev-ml/ounit )
274 "
275
276 +src_prepare() {
277 + epatch "${FILESDIR}/bigstring.patch"
278 + default
279 +}
280 +
281 src_compile() {
282 ocaml pkg/build.ml \
283 native=$(usex ocamlopt true false) \