[med-svn] [Git][med-team/pplacer][master] 2 commits: add patch to replace Pervasives by Stdlib

Shayan Doust gitlab at salsa.debian.org
Sat Jun 13 18:23:13 BST 2020



Shayan Doust pushed to branch master at Debian Med / pplacer


Commits:
770e5cae by Ralf Treinen at 2020-06-13T17:05:50+02:00
add patch to replace Pervasives by Stdlib

- - - - -
b35a9595 by Ralf Treinen at 2020-06-13T18:52:38+02:00
patch for read-only strings in recent ocaml

- - - - -


4 changed files:

- + debian/patches/ocaml_bytes
- + debian/patches/ocaml_stdlib
- debian/patches/ocamlbuild
- debian/patches/series


Changes:

=====================================
debian/patches/ocaml_bytes
=====================================
@@ -0,0 +1,149 @@
+Author: Ralf Treinen <treinen at debian.org>
+Description: ocaml strings are immutable in recent ocaml versions,
+  replace them by Bytes.t where necessary
+
+Index: pplacer/common_src/ppatteries.ml
+===================================================================
+--- pplacer.orig/common_src/ppatteries.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/common_src/ppatteries.ml	2020-06-13 18:46:39.670407109 +0200
+@@ -60,7 +60,7 @@
+ let maybe_cons o l = maybe_map_cons identity o l
+ 
+ let to_csv_out ch =
+-  (ch :> <close_out: unit -> unit; output: string -> int -> int -> int>)
++  (ch :> <close_out: unit -> unit; output: Bytes.t -> int -> int -> int>)
+ let csv_out_channel ch = new IO.out_channel ch |> to_csv_out
+ 
+ let to_csv_in ch = object
+@@ -243,8 +243,8 @@
+         ~write:(Gzip.output_char out_chan)
+         ~output:(fun s p l ->
+           let buf = Buffer.create l in
+-          Buffer.add_substring buf s p l;
+-          Gzip.output out_chan (Buffer.contents buf) 0 (Buffer.length buf);
++          Buffer.add_subbytes buf s p l;
++          Gzip.output out_chan (Bytes.of_string (Buffer.contents buf)) 0 (Buffer.length buf);
+           Buffer.length buf)
+         ~close:(fun () -> Gzip.close_out out_chan)
+         (* Gzip.flush disposes of the Gzip stream and prevents further writes -
+@@ -714,8 +714,8 @@
+   let left_pad pad_width c s =
+     assert(pad_width >= 0);
+     let len = String.length s in
+-    let new_s = String.make (len+pad_width) c in
+-    String.blit s 0 new_s pad_width len;
++    let new_s = Bytes.make (len+pad_width) c in
++    Bytes.blit_string s 0 new_s pad_width len;
+     new_s
+ 
+ end
+Index: pplacer/json_src/json.ml
+===================================================================
+--- pplacer.orig/json_src/json.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/json_src/json.ml	2020-06-13 18:46:39.670407109 +0200
+@@ -72,7 +72,7 @@
+ let to_file name o =
+   let file = MaybeZipped.open_out name in
+   let formatter= Format.make_formatter
+-    (fun s p l -> let _ = IO.output file s p l in ())
++    (fun s p l -> let _ = IO.output file (Bytes.of_string s) p l in ())
+     (fun () -> IO.flush file)
+   in
+   to_formatter formatter o;
+Index: pplacer/common_src/alignment.ml
+===================================================================
+--- pplacer.orig/common_src/alignment.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/common_src/alignment.ml	2020-06-13 18:46:39.670407109 +0200
+@@ -102,7 +102,7 @@
+   Printf.fprintf ch "%d %d\n" (n_seqs align) (length align);
+   Array.iter (
+     fun (name, seq) ->
+-      Printf.fprintf ch "%s %s\n" (StringFuns.left_pad 14 ' ' name) seq;
++      Printf.fprintf ch "%s %s\n" (Bytes.to_string (StringFuns.left_pad 14 ' ' name)) seq;
+   ) align;
+   close_out ch
+ 
+Index: pplacer/pplacer_src/string_matrix.ml
+===================================================================
+--- pplacer.orig/pplacer_src/string_matrix.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/pplacer_src/string_matrix.ml	2020-06-13 18:46:39.670407109 +0200
+@@ -50,7 +50,7 @@
+ let m = add_names [|"a";"b"|] [|[|"0";"1"|];[|"2";"3"|]|]
+ 
+ let row_to_str delim row =
+-  String.concat delim (Array.to_list row)
++  Bytes.to_string (Bytes.concat (Bytes.of_string delim) (Array.to_list row))
+ 
+ let write_row ch row =
+   Printf.fprintf ch "%s\n" (row_to_str "  " row)
+Index: pplacer/pplacer_src/pplacer_run.ml
+===================================================================
+--- pplacer.orig/pplacer_src/pplacer_run.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/pplacer_src/pplacer_run.ml	2020-06-13 18:46:39.670407109 +0200
+@@ -118,7 +118,7 @@
+           (seq'.[!pos] <- seq.[e];
+            incr pos))
+       mask;
+-    name, seq'
++    name, (Bytes.to_string seq')
+   in
+   dprintf "sequence length cut from %d to %d.\n" n_sites masklen;
+   let effective_length = match seq_type with
+@@ -372,7 +372,7 @@
+     |> Array.append
+         [|[|"node"; "tree_likelihood"; "slow_tree_like"; "supernode_like"|]|]
+     |> String_matrix.pad
+-    |> Array.iter (Array.iter (dprintf "%s  ") %> tap (fun () -> dprint "\n"))
++    |> Array.iter (Array.iter (function b -> (dprintf "%s  ") (Bytes.to_string b)) %> tap (fun () -> dprint "\n"))
+ 
+   end;
+ 
+Index: pplacer/json_src/jsonparse.mly
+===================================================================
+--- pplacer.orig/json_src/jsonparse.mly	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/json_src/jsonparse.mly	2020-06-13 18:46:39.670407109 +0200
+@@ -42,7 +42,7 @@
+         | "t" -> "\t"
+         | _ ->
+           let escape = Str.replace_matched "\\2" s in
+-          utf8_encode (int_of_string ("0x" ^ escape))
++          (Bytes.to_string (utf8_encode (int_of_string ("0x" ^ escape))))
+     ) s
+ 
+   let add_to_hash h (s, v) = Hashtbl.add h s v; h
+Index: pplacer/pplacer_src/multiprocessing.ml
+===================================================================
+--- pplacer.orig/pplacer_src/multiprocessing.ml	2020-06-13 18:46:39.674407130 +0200
++++ pplacer/pplacer_src/multiprocessing.ml	2020-06-13 18:48:07.406882567 +0200
+@@ -71,11 +71,11 @@
+   in aux pipe_map
+ 
+ type buffer = {
+-  buf: string;
++  buf: Bytes.t;
+   mutable pos: int;
+   length: int;
+ }
+-let buffer n = {buf = String.create n; pos = 0; length = n}
++let buffer n = {buf = Bytes.create n; pos = 0; length = n}
+ type buffer_state =
+   | Needs_more
+   | Done of string
+@@ -87,7 +87,7 @@
+     | n ->
+       let n_read = b.pos + n in
+       if n_read = b.length then
+-        Done b.buf
++        Done (Bytes.to_string b.buf)
+       else begin
+         b.pos <- n_read;
+         Needs_more
+@@ -184,7 +184,7 @@
+     in match fill_buffer b h.ch, marshal_state with
+       | Needs_more, _ -> ()
+       | Done header, Needs_header _ ->
+-        marshal_state <- Needs_data (header, buffer (Marshal.data_size header 0))
++        marshal_state <- Needs_data (header, buffer (Marshal.data_size (Bytes.of_string header) 0))
+       | Done body, Needs_data (header, _) ->
+         let obj = Marshal.from_string (header ^ body) 0 in
+         self#obj_received obj;


=====================================
debian/patches/ocaml_stdlib
=====================================
@@ -0,0 +1,120 @@
+Author: Ralf Treinen <treinen at debian.org>
+Description: Pervasives has become Stdlib in ocaml 4.07
+
+Index: pplacer/common_src/mapsSets.ml
+===================================================================
+--- pplacer.orig/common_src/mapsSets.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/common_src/mapsSets.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -3,7 +3,7 @@
+ 
+ module OrderedFloat = struct
+   type t = float
+-  let compare = Pervasives.compare
++  let compare = Stdlib.compare
+ end
+ 
+ module OrderedInt = struct
+Index: pplacer/common_src/number.ml
+===================================================================
+--- pplacer.orig/common_src/number.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/common_src/number.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -44,7 +44,7 @@
+   let max = ( || )
+   let pow x y = if y then x else true
+   let indic = ( = )
+-  let compare = Pervasives.compare
++  let compare = Stdlib.compare
+   let succ = not
+   let abs x = x
+   let inv _ = false
+@@ -80,7 +80,7 @@
+       aux y
+   let indic x y =
+     if x = y then 1 else 0
+-  let compare = Pervasives.compare
++  let compare = Stdlib.compare
+   let succ = (+) 1
+   let abs = abs
+   let conv_float_fun f =
+@@ -118,7 +118,7 @@
+   let max = bcheck max
+   let pow = bcheck ( ** )
+   let indic = bcheck (fun x y -> if x = y then 1. else 0.)
+-  let compare = Pervasives.compare
++  let compare = Stdlib.compare
+   let succ = (+.) 1.
+   let abs = abs_float
+   let inv = ucheck (fun x -> 1. /. x)
+Index: pplacer/pplacer_src/guppy_squash.ml
+===================================================================
+--- pplacer.orig/pplacer_src/guppy_squash.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/pplacer_src/guppy_squash.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -17,7 +17,7 @@
+ module NPreBlob =
+   struct
+     type t = int list * Mass_map.Pre.t
+-    let compare = Pervasives.compare
++    let compare = Stdlib.compare
+     let merge (l1, p1) (l2, p2) = (l1 @ l2, p1 @ p2)
+   end
+ 
+Index: pplacer/pplacer_src/newick_bark.ml
+===================================================================
+--- pplacer.orig/pplacer_src/newick_bark.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/pplacer_src/newick_bark.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -119,7 +119,7 @@
+ let floato_approx_compare epsilon a b =
+   match (a, b) with
+   | (Some x, Some y) -> float_approx_compare epsilon x y
+-  | (a, b) -> Pervasives.compare a b
++  | (a, b) -> Stdlib.compare a b
+ 
+ let compare ?epsilon:(epsilon=0.) ?cmp_edge_label:(cmp_edge_label=true) b1 b2 =
+   let fc = floato_approx_compare epsilon in
+Index: pplacer/pplacer_src/squashfunc.ml
+===================================================================
+--- pplacer.orig/pplacer_src/squashfunc.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/pplacer_src/squashfunc.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -54,7 +54,7 @@
+     let compare_cble a b =
+       let cdist = compare a.dist b.dist in
+       if cdist <> 0 then cdist
+-      else Pervasives.compare a b
++      else Stdlib.compare a b
+ 
+     let replace_blob distf oldb newb c =
+       if c.small = oldb then cble_of_blobs distf c.big newb
+Index: pplacer/pplacer_src/tax_id.ml
+===================================================================
+--- pplacer.orig/pplacer_src/tax_id.ml	2020-06-13 17:04:45.732114513 +0200
++++ pplacer/pplacer_src/tax_id.ml	2020-06-13 17:04:45.728116096 +0200
+@@ -1,6 +1,6 @@
+ (* The taxonomic id type
+  *
+- * note use of Pervasives.compare should be redone if speed needed.
++ * note use of Stdlib.compare should be redone if speed needed.
+ *)
+ 
+ open Ppatteries
+@@ -67,7 +67,7 @@
+ (* *** Maps and Sets *** *)
+ module OrderedTaxId = struct
+   type t = tax_id
+-  let compare = Pervasives.compare
++  let compare = Stdlib.compare
+ end
+ 
+ module PprTaxId = struct
+Index: pplacer/pplacer_src/guppy_round.ml
+===================================================================
+--- pplacer.orig/pplacer_src/guppy_round.ml	2020-06-13 17:04:23.481803484 +0200
++++ pplacer/pplacer_src/guppy_round.ml	2020-06-13 17:05:31.011799071 +0200
+@@ -48,7 +48,7 @@
+   Map.Make
+     (struct
+       type t = rounded_pquery
+-      let compare = Pervasives.compare
++      let compare = Stdlib.compare
+     end)
+ 
+ let add_listly k v m =


=====================================
debian/patches/ocamlbuild
=====================================
@@ -1,7 +1,7 @@
 Index: pplacer/myocamlbuild.ml
 ===================================================================
---- pplacer.orig/myocamlbuild.ml	2020-05-23 19:56:32.503243020 +0200
-+++ pplacer/myocamlbuild.ml	2020-05-23 19:56:52.423364364 +0200
+--- pplacer.orig/myocamlbuild.ml	2020-06-13 17:31:13.250164814 +0200
++++ pplacer/myocamlbuild.ml	2020-06-13 17:31:13.250164814 +0200
 @@ -19,10 +19,7 @@
  module OCamlFind =
  struct


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,4 @@
 ocamlbuild
 fix_makefile.patch
+ocaml_stdlib
+ocaml_bytes



View it on GitLab: https://salsa.debian.org/med-team/pplacer/-/compare/8f6f9aac2953129d004aef65a21c864c88a7a72b...b35a959570d746cf009b164a5d9723e98eddf90c

-- 
View it on GitLab: https://salsa.debian.org/med-team/pplacer/-/compare/8f6f9aac2953129d004aef65a21c864c88a7a72b...b35a959570d746cf009b164a5d9723e98eddf90c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200613/5da0bd5b/attachment-0001.html>


More information about the debian-med-commit mailing list