ocamlPackages.janestreet: 0.16 -> 0.17 (#329201)

This commit is contained in:
Dimitrije Radojević 2024-08-08 20:38:40 +01:00 committed by GitHub
parent 363da96864
commit 1287f06155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 3225 additions and 228 deletions

View File

@ -15,6 +15,9 @@ buildDunePackage rec {
buildInputs = [ cmdliner base stdio ];
# core v0.17 compatibility, obtained by `git diff -r 3e37827~2..3e37827`
patches = [ ./merge-fmt.patch ];
meta = with lib; {
description = "Git mergetool leveraging code formatters";
homepage = "https://github.com/hhugo/merge-fmt";

View File

@ -0,0 +1,248 @@
diff --git a/.ocamlformat b/.ocamlformat
index fe6ed57..3532006 100644
--- a/.ocamlformat
+++ b/.ocamlformat
@@ -3,4 +3,4 @@ type-decl=sparse
break-separators=before
if-then-else=keyword-first
dock-collection-brackets=false
-version=0.24.1
\ No newline at end of file
+version=0.26.1
\ No newline at end of file
diff --git a/dune b/dune
index 61ec19c..9446de9 100644
--- a/dune
+++ b/dune
@@ -2,22 +2,34 @@
(targets merge-fmt-help.txt)
(deps ./src/merge_fmt.exe)
(mode promote)
- (action (with-stdout-to %{targets} (run ./src/merge_fmt.exe --help=plain))))
+ (action
+ (with-stdout-to
+ %{targets}
+ (run ./src/merge_fmt.exe --help=plain))))
(rule
(targets merge-fmt-mergetool-help.txt)
(deps ./src/merge_fmt.exe)
(mode promote)
- (action (with-stdout-to %{targets} (run ./src/merge_fmt.exe mergetool --help=plain))))
+ (action
+ (with-stdout-to
+ %{targets}
+ (run ./src/merge_fmt.exe mergetool --help=plain))))
(rule
(targets merge-fmt-setup-mergetool-help.txt)
(deps ./src/merge_fmt.exe)
(mode promote)
- (action (with-stdout-to %{targets} (run ./src/merge_fmt.exe setup-mergetool --help=plain))))
+ (action
+ (with-stdout-to
+ %{targets}
+ (run ./src/merge_fmt.exe setup-mergetool --help=plain))))
(rule
(targets merge-fmt-setup-merge-help.txt)
(deps ./src/merge_fmt.exe)
(mode promote)
- (action (with-stdout-to %{targets} (run ./src/merge_fmt.exe setup-merge --help=plain))))
+ (action
+ (with-stdout-to
+ %{targets}
+ (run ./src/merge_fmt.exe setup-merge --help=plain))))
diff --git a/dune-project b/dune-project
index 4b39e3f..2bc4ec2 100644
--- a/dune-project
+++ b/dune-project
@@ -1,3 +1,2 @@
-(lang dune 1.6)
-(using fmt 1.0)
+(lang dune 3.0)
(name merge-fmt)
diff --git a/merge-fmt.opam b/merge-fmt.opam
index 6827173..579f6a1 100644
--- a/merge-fmt.opam
+++ b/merge-fmt.opam
@@ -11,7 +11,7 @@ build: [["dune" "build" "-p" name "-j" jobs]]
depends: [
"ocaml" {>= "4.06.1"}
- "dune" {>= "1.6"}
+ "dune" {>= "3.0"}
"cmdliner" {>= "1.1.0"}
"base"
"stdio"
diff --git a/src/common.ml b/src/common.ml
index 3ca6809..f88bbd9 100644
--- a/src/common.ml
+++ b/src/common.ml
@@ -18,8 +18,8 @@ let open_process_in_respect_exit ~echo fmt =
let contents = In_channel.input_all ic in
match Unix.close_process_in ic with
| WEXITED 0 -> contents
- | WEXITED n -> Caml.exit n
- | WSIGNALED _ | WSTOPPED _ -> Caml.exit 1)
+ | WEXITED n -> Stdlib.exit n
+ | WSIGNALED _ | WSTOPPED _ -> Stdlib.exit 1)
fmt
let system ~echo fmt =
@@ -35,8 +35,8 @@ let system_respect_exit ~echo fmt =
if echo then eprintf "+ %s\n%!" s;
match Unix.system s with
| WEXITED 0 -> ()
- | WEXITED n -> Caml.exit n
- | WSIGNALED _ | WSTOPPED _ -> Caml.exit 1)
+ | WEXITED n -> Stdlib.exit n
+ | WSIGNALED _ | WSTOPPED _ -> Stdlib.exit 1)
fmt
module Flags = struct
diff --git a/src/dune b/src/dune
index 1ae55ce..1cfd576 100644
--- a/src/dune
+++ b/src/dune
@@ -1,5 +1,4 @@
(executables
- (names merge_fmt)
- (public_names merge-fmt)
- (libraries base stdio unix cmdliner)
-)
\ No newline at end of file
+ (names merge_fmt)
+ (public_names merge-fmt)
+ (libraries base stdio unix cmdliner))
diff --git a/src/fmters.ml b/src/fmters.ml
index e190f4b..43616ab 100644
--- a/src/fmters.ml
+++ b/src/fmters.ml
@@ -36,7 +36,7 @@ let dune ~bin =
let find ~config ~filename ~name =
let filename = Option.value ~default:filename name in
- match (filename, Caml.Filename.extension filename, config) with
+ match (filename, Stdlib.Filename.extension filename, config) with
| _, (".ml" | ".mli"), { ocamlformat_path; _ } ->
Some (ocamlformat ~bin:ocamlformat_path ~name)
| _, (".re" | ".rei"), { refmt_path; _ } -> Some (refmt ~bin:refmt_path)
diff --git a/src/merge_cmd.ml b/src/merge_cmd.ml
index a0fa68f..6cd5377 100644
--- a/src/merge_cmd.ml
+++ b/src/merge_cmd.ml
@@ -2,7 +2,12 @@ open Base
open Stdio
open Common
-let debug_oc = lazy (Out_channel.create ~append:true "/tmp/merge-fmt.log")
+let debug_oc =
+ lazy
+ (Out_channel.create ~append:true
+ (Stdlib.Filename.concat
+ (Stdlib.Filename.get_temp_dir_name ())
+ "merge-fmt.log"))
let debug fmt =
if true
@@ -12,7 +17,7 @@ let debug fmt =
let merge config echo current base other output name =
match (current, base, other) with
| (None | Some ""), _, _ | _, (None | Some ""), _ | _, _, (None | Some "") ->
- Caml.exit 1
+ Stdlib.exit 1
| Some current, Some base, Some other -> (
match Fmters.find ~config ~filename:current ~name with
| None ->
@@ -30,7 +35,7 @@ let merge config echo current base other output name =
|> Result.map_error ~f:(Fn.const "base")
in
match Result.combine_errors [ x; y; z ] with
- | Error _ -> Caml.exit 1
+ | Error _ -> Stdlib.exit 1
| Ok (_ : unit list) ->
debug "process all three revision successfully\n%!";
debug "running git merge-file\n%!";
@@ -41,7 +46,7 @@ let merge config echo current base other output name =
(match output with
| None -> Out_channel.output_string stdout result
| Some o -> Out_channel.write_all o ~data:result);
- Caml.exit 0))
+ Stdlib.exit 0))
open Cmdliner
diff --git a/src/resolve_cmd.ml b/src/resolve_cmd.ml
index bd7f5e3..60a36a4 100644
--- a/src/resolve_cmd.ml
+++ b/src/resolve_cmd.ml
@@ -67,9 +67,9 @@ let show ~echo version versions =
let create_tmp ~echo fn version versions =
let content = show ~echo version versions in
- let ext = Caml.Filename.extension fn in
+ let ext = Stdlib.Filename.extension fn in
let base =
- if String.equal ext "" then fn else Caml.Filename.chop_extension fn
+ if String.equal ext "" then fn else Stdlib.Filename.chop_extension fn
in
let fn' = sprintf "%s.%s%s" base (string_of_version version) ext in
let oc = Out_channel.create fn' in
@@ -114,7 +114,7 @@ let resolve config echo () =
if Map.is_empty all
then (
eprintf "Nothing to resolve\n%!";
- Caml.exit 1);
+ Stdlib.exit 1);
Map.iteri all ~f:(fun ~key:filename ~data:versions ->
match versions with
| Ok versions -> (
@@ -131,7 +131,7 @@ let resolve config echo () =
| None -> eprintf "Ignore %s (no formatter register)\n%!" filename)
| Error reason -> eprintf "Ignore %s (%s)\n%!" filename reason);
let all = ls ~echo () in
- if Map.is_empty all then Caml.exit 0 else Caml.exit 1
+ if Map.is_empty all then Stdlib.exit 0 else Stdlib.exit 1
open Cmdliner
diff --git a/test/dune b/test/dune
index c0e4f3a..2fde0ee 100644
--- a/test/dune
+++ b/test/dune
@@ -1,17 +1,22 @@
(library
- (name merge_fmt_test)
- (libraries base stdio unix core_unix core_unix.filename_unix)
- (inline_tests)
- (preprocessor_deps ../src/merge_fmt.exe)
- (preprocess (pps ppx_expect)))
-
+ (name merge_fmt_test)
+ (libraries base stdio unix core_unix core_unix.filename_unix)
+ (inline_tests)
+ (preprocessor_deps ../src/merge_fmt.exe)
+ (preprocess
+ (pps ppx_expect)))
;; [rebase_a.ml] and [rebase_b.ml] should be the same expect that
;; [rebase_b.ml] does rebase in an intermediate revision.
+
(rule
- (targets rebase.diff.gen)
- (action (with-stdout-to %{targets} (bash "diff %{dep:rebase_a.ml} %{dep:rebase_b.ml} || true"))))
+ (targets rebase.diff.gen)
+ (action
+ (with-stdout-to
+ %{targets}
+ (bash "diff %{dep:rebase_a.ml} %{dep:rebase_b.ml} || true"))))
-(alias
- (name runtest)
- (action (diff rebase.diff rebase.diff.gen)))
\ No newline at end of file
+(rule
+ (alias runtest)
+ (action
+ (diff rebase.diff rebase.diff.gen)))

View File

@ -16,19 +16,15 @@
buildDunePackage rec {
pname = "bistro";
version = "unstable-2022-05-07";
duneVersion = "3";
version = "unstable-2024-05-17";
src = fetchFromGitHub {
owner = "pveber";
repo = pname;
rev = "d363bd2d8257babbcb6db15bd83fd6465df7c268";
sha256 = "0g11324j1s2631zzf7zxc8s0nqd4fwvcni0kbvfpfxg96gy2wwfm";
rev = "d44c44b52148e58ca3842c3efedf3115e376d800";
sha256 = "sha256-naoCEVBfydqSeGGbXYBXfg0PP+Fzk05jFoul7XAz/tM=";
};
patches = [ ./janestreet-0.16.patch ];
propagatedBuildInputs = [
base64
bos
@ -43,7 +39,7 @@ buildDunePackage rec {
tyxml
];
minimalOCamlVersion = "4.12";
minimalOCamlVersion = "4.14";
meta = {
inherit (src.meta) homepage;

View File

@ -1,205 +0,0 @@
diff --git a/lib/engine/scheduler.ml b/lib/engine/scheduler.ml
index e32bd0f..93b566b 100644
--- a/lib/engine/scheduler.ml
+++ b/lib/engine/scheduler.ml
@@ -601,7 +601,7 @@ module Make(Backend : Backend) = struct
)
)
| Trywith tw -> (
- match Table.find sched.traces (Workflow.id tw.w) with
+ match Hashtbl.find sched.traces (Workflow.id tw.w) with
| Some eventual_trace -> (
eventual_trace >>= function
| Ok (Run r) ->
@@ -667,10 +667,10 @@ module Make(Backend : Backend) = struct
let register_build sched ~id ~build_trace =
let open Eval_thread.Infix in
(
- match Table.find sched.traces id with
+ match Hashtbl.find sched.traces id with
| None ->
let trace = build_trace () in
- Table.set sched.traces ~key:id ~data:trace ;
+ Hashtbl.set sched.traces ~key:id ~data:trace ;
trace
| Some trace -> trace
) >>= fun trace ->
@@ -854,7 +854,7 @@ module Make(Backend : Backend) = struct
Eval_thread.join l.elts ~f:(build ?target sched)
| Trywith tw -> (
build sched ?target tw.w >> fun w_result ->
- match Table.find sched.traces (Workflow.id tw.w) with
+ match Hashtbl.find sched.traces (Workflow.id tw.w) with
| Some eventual_trace -> (
eventual_trace >> function
| Ok (Run r) when run_trywith_recovery r.details ->
diff --git a/lib/multinode/bistro_multinode.ml b/lib/multinode/bistro_multinode.ml
index 01dc5ac..3fc6b0e 100644
--- a/lib/multinode/bistro_multinode.ml
+++ b/lib/multinode/bistro_multinode.ml
@@ -130,7 +130,7 @@ module Server = struct
let search (type s) (table : s String.Table.t) ~f =
let module M = struct exception Found of string * s end in
try
- String.Table.fold table ~init:() ~f:(fun ~key ~data () -> if f ~key ~data then raise (M.Found (key, data))) ;
+ Hashtbl.fold table ~init:() ~f:(fun ~key ~data () -> if f ~key ~data then raise (M.Found (key, data))) ;
None
with M.Found (k, v) -> Some (k, v)
@@ -145,7 +145,7 @@ module Server = struct
match allocation_attempt with
| None -> Some elt
| Some (worker_id, (Resource curr)) ->
- String.Table.set pool.available ~key:worker_id ~data:(Resource { np = curr.np - np ; mem = curr.mem - mem }) ;
+ Hashtbl.set pool.available ~key:worker_id ~data:(Resource { np = curr.np - np ; mem = curr.mem - mem }) ;
Lwt.wakeup u (worker_id, Resource { np ; mem }) ;
None
)
@@ -163,12 +163,12 @@ module Server = struct
t
let add_worker pool (Worker { id ; np ; mem ; _ }) =
- match String.Table.add pool.available ~key:id ~data:(Allocator.Resource { np ; mem }) with
+ match Hashtbl.add pool.available ~key:id ~data:(Allocator.Resource { np ; mem }) with
| `Ok -> allocation_pass pool
| `Duplicate -> failwith "A worker has been added twice"
let release pool worker_id (Allocator.Resource { np ; mem }) =
- String.Table.update pool.available worker_id ~f:(function
+ Hashtbl.update pool.available worker_id ~f:(function
| None -> failwith "Tried to release resources of inexistent worker"
| Some (Resource r) -> Resource { np = r.np + np ; mem = r.mem + mem }
)
@@ -235,13 +235,13 @@ module Server = struct
| Subscript { np ; mem } ->
let id = new_id () in
let w = create_worker ~np ~mem id in
- String.Table.set state.workers ~key:id ~data:w ;
+ Hashtbl.set state.workers ~key:id ~data:w ;
Worker_allocator.add_worker state.alloc w ;
log (Logger.Debug (sprintf "new worker %s" id)) ;
Lwt.return (Client_id id)
| Get_job { client_id } -> (
- match String.Table.find state.workers client_id with
+ match Hashtbl.find state.workers client_id with
| None -> Lwt.return None
| Some (Worker worker) ->
Lwt.choose [
@@ -250,22 +250,22 @@ module Server = struct
] >>= function
| `Job wp ->
let workflow_id = workflow_id_of_job_waiter wp in
- String.Table.set worker.running_jobs ~key:workflow_id ~data:wp ;
+ Hashtbl.set worker.running_jobs ~key:workflow_id ~data:wp ;
Lwt.return (Some (job_of_job_waiter wp))
| `Stop -> Lwt.return None
)
| Plugin_result r ->
- let Worker worker = String.Table.find_exn state.workers r.client_id in
+ let Worker worker = Hashtbl.find_exn state.workers r.client_id in
Lwt.return (
- match String.Table.find_exn worker.running_jobs r.workflow_id with
+ match Hashtbl.find_exn worker.running_jobs r.workflow_id with
| Waiting_plugin wp -> Lwt.wakeup wp.waiter r.result
| Waiting_shell_command _ -> assert false (* should never happen *)
)
| Shell_command_result r ->
- let Worker worker = String.Table.find_exn state.workers r.client_id in
+ let Worker worker = Hashtbl.find_exn state.workers r.client_id in
Lwt.return (
- match String.Table.find_exn worker.running_jobs r.workflow_id with
+ match Hashtbl.find_exn worker.running_jobs r.workflow_id with
| Waiting_plugin _ -> assert false (* should never happen *)
| Waiting_shell_command wp -> Lwt.wakeup wp.waiter r.result
)
@@ -307,7 +307,7 @@ module Server = struct
let request_resource backend req =
Worker_allocator.request backend.state.alloc req >|= fun (worker_id, resource) ->
- String.Table.find_exn backend.state.workers worker_id, resource
+ Hashtbl.find_exn backend.state.workers worker_id, resource
let release_resource backend worker_id res =
Worker_allocator.release backend.state.alloc worker_id res
@@ -334,7 +334,7 @@ module Server = struct
* loop () *)
let eval backend { worker_id ; workflow_id } f x =
- let Worker worker = String.Table.find_exn backend.state.workers worker_id in
+ let Worker worker = Hashtbl.find_exn backend.state.workers worker_id in
let f () = f x in
let t, u = Lwt.wait () in
let job_waiter = Waiting_plugin { waiter = u ; f ; workflow_id } in
@@ -342,7 +342,7 @@ module Server = struct
t
let run_shell_command backend { worker_id ; workflow_id } cmd =
- let Worker worker = String.Table.find_exn backend.state.workers worker_id in
+ let Worker worker = Hashtbl.find_exn backend.state.workers worker_id in
let t, u = Lwt.wait () in
let job = Waiting_shell_command { waiter = u ; cmd ; workflow_id } in
Lwt_queue.push worker.pending_jobs job ;
diff --git a/lib/utils/dot_output.ml b/lib/utils/dot_output.ml
index 90c299f..d13fceb 100644
--- a/lib/utils/dot_output.ml
+++ b/lib/utils/dot_output.ml
@@ -24,7 +24,7 @@ module G = struct
(* let successors g u = fold_succ (fun h t -> h :: t) g u [] *)
let rec of_workflow_aux seen acc u =
- if S.mem seen u then (seen, acc)
+ if Set.mem seen u then (seen, acc)
else (
let deps = W.Any.deps u in
let seen, acc =
@@ -34,7 +34,7 @@ module G = struct
in
let acc = add_vertex acc u in
let acc = List.fold deps ~init:acc ~f:(fun acc v -> add_edge acc u v) in
- let seen = S.add seen u in
+ let seen = Set.add seen u in
seen, acc
)
@@ -109,7 +109,7 @@ let dot_output ?db oc g ~needed =
]
in
let vertex_attributes u =
- let needed = (match db with None -> true | Some _ -> false) || S.mem needed u in
+ let needed = (match db with None -> true | Some _ -> false) || Set.mem needed u in
let color = if needed then black else light_gray in
let shape = `Shape (shape u) in
let W.Any w = u in
@@ -141,7 +141,7 @@ let dot_output ?db oc g ~needed =
| _ -> []
in
let color =
- if (match db with None -> true | Some _ -> false) || (S.mem needed u && not (already_done u))
+ if (match db with None -> true | Some _ -> false) || (Set.mem needed u && not (already_done u))
then black else light_gray in
style @ [ `Color color ]
in
diff --git a/lib/utils/repo.ml b/lib/utils/repo.ml
index 06abcd5..206a99e 100644
--- a/lib/utils/repo.ml
+++ b/lib/utils/repo.ml
@@ -160,7 +160,7 @@ let protected_set repo =
| Select s -> fold_path_workflow acc (W.Any s.dir)
| Input _ -> acc
| Shell _
- | Plugin _ -> String.Set.add acc (W.id w)
+ | Plugin _ -> Set.add acc (W.id w)
| Trywith tw ->
fold_path_workflow (fold_path_workflow acc (W.Any tw.w)) (W.Any tw.failsafe)
| Ifelse ie ->
@@ -187,7 +187,7 @@ let cache_clip_fold ~bistro_dir repo ~f ~init =
let protected = protected_set repo in
let db = Db.init_exn bistro_dir in
Db.fold_cache db ~init ~f:(fun acc id ->
- f db acc (if String.Set.mem protected id then `Protected id else `Unprotected id)
+ f db acc (if Set.mem protected id then `Protected id else `Unprotected id)
)
let cache_clip_dry_run ~bistro_dir repo =

View File

@ -0,0 +1,103 @@
diff --git a/config/xConfigurator.ml b/config/xConfigurator.ml
index 268df4a..73e1850 100644
--- a/config/xConfigurator.ml
+++ b/config/xConfigurator.ml
@@ -8,7 +8,7 @@ let (!%) fmt = Printf.sprintf fmt
module Configurator = struct
include Configurator.V1
- let ( ^/ ) = Caml.Filename.concat
+ let ( ^/ ) = Stdlib.Filename.concat
let path_sep =
if Sys.win32 then
@@ -19,7 +19,7 @@ module Configurator = struct
let exe = if Sys.win32 then ".exe" else ""
let get_path () =
- match Caml.Sys.getenv "PATH" with
+ match Stdlib.Sys.getenv "PATH" with
| exception Not_found -> []
| s -> String.split ~on:path_sep s
@@ -27,7 +27,7 @@ module Configurator = struct
List.find_map dirs ~f:(fun dir ->
List.find_map bases ~f:(fun base ->
let path = dir ^/ base in
- if Caml.Sys.file_exists path then Some path else None))
+ if Stdlib.Sys.file_exists path then Some path else None))
let find_program prog =
let prog = prog ^ exe in
@@ -45,13 +45,13 @@ module Configurator = struct
| s ->
(* findlib 1.7.3 installs META file for graphics
even when there is no graphics library installed. *)
- let dest = Caml.Filename.temp_file "test" ".cma" in
- let res = match Caml.Sys.command & !% "ocamlfind ocamlc -package %s -o %s -linkpkg" n dest with
+ let dest = Stdlib.Filename.temp_file "test" ".cma" in
+ let res = match Stdlib.Sys.command & !% "ocamlfind ocamlc -package %s -o %s -linkpkg" n dest with
| 0 -> Some s
| _ -> None
| exception _ -> None
in
- (try Caml.Sys.remove dest with _ -> ());
+ (try Stdlib.Sys.remove dest with _ -> ());
res
| exception Findlib.No_such_package _ -> None
@@ -83,14 +83,14 @@ type item =
module Make(A : sig val name : string end) = struct
let t = create A.name
- let log fmt = Caml.Format.eprintf fmt
+ let log fmt = Stdlib.Format.eprintf fmt
module Package_conf = Package_conf
open Package_conf
let extract_package_conf xs =
- Caml.List.fold_left merge empty
- (Caml.List.map (fun item -> match item with
+ Stdlib.List.fold_left merge empty
+ (Stdlib.List.map (fun item -> match item with
| Library (Some pkc) -> pkc
| _ -> empty) xs)
@@ -167,8 +167,8 @@ module Make(A : sig val name : string end) = struct
let by_cc ~c_flags ~link_flags ~headers ~functions:fnames () =
log "Checking library %s by using C compiler... " (String.concat ~sep:" " link_flags);
let headers = "stdio.h" :: headers in
- let includes = Caml.List.map (!% "#include <%s>") headers in
- let fcalls = Caml.List.map (!% " ( (void(*)()) (%s) )();") fnames in
+ let includes = Stdlib.List.map (!% "#include <%s>") headers in
+ let fcalls = Stdlib.List.map (!% " ( (void(*)()) (%s) )();") fnames in
let code =
String.concat ~sep:"\n"
& includes
diff --git a/core/images.ml b/core/images.ml
index 563ab7e..a53a6a4 100644
--- a/core/images.ml
+++ b/core/images.ml
@@ -102,7 +102,7 @@ let get_extension s =
| _ -> s, ""
let guess_extension s =
- let s = String.lowercase s in
+ let s = String.lowercase_ascii s in
match s with
| "gif" -> Gif
| "bmp" -> Bmp
diff --git a/core/units.ml b/core/units.ml
index 634bc9c..ddd6eae 100644
--- a/core/units.ml
+++ b/core/units.ml
@@ -30,7 +30,7 @@ let parse_length s = (* return in pt *)
let digit,unit =
if l > 2 then String.sub s 0 2, String.sub s (l-2) 2 else "", "" in
try
- (List.assoc (String.lowercase unit) units) *. float_of_string digit
+ (List.assoc (String.lowercase_ascii unit) units) *. float_of_string digit
with
| Not_found -> (* think it is in "pt" *)
float_of_string s in

View File

@ -15,9 +15,8 @@ buildDunePackage rec {
sha256 = "1m2c76ghisg73dikz2ifdkrbkgiwa0hcmp21f2fm2rkbf02rq3f4";
};
postPatch = ''
substituteInPlace core/{images,units}.ml --replace String.lowercase String.lowercase_ascii
'';
# stdio v0.17 compatibility; also replaces `String.lowercase` with `String.lowercase_ascii`
patches = [ ./camlimages.patch ];
nativeBuildInputs = [ cppo ];
buildInputs = [ dune-configurator findlib graphics lablgtk stdio ];

View File

@ -13,7 +13,7 @@ buildDunePackage rec {
hash = "sha256-iSg0QsTcU0MT/Cletl+hW6bKyH0jkp7Jixqu8H59UmQ=";
};
patches = [ ./git_commit.patch ./janestreet-0.16.patch ];
patches = [ ./git_commit.patch ./janestreet-0.17.patch ];
strictDeps = true;

View File

@ -1,7 +1,29 @@
diff --git a/app/cfstream_test.ml b/app/cfstream_test.ml
index 457c5e5..c6a01a5 100644
--- a/app/cfstream_test.ml
+++ b/app/cfstream_test.ml
@@ -73,7 +73,7 @@ let test_uncombine () =
let test_partition () =
let f x = x mod 2 = 0 in
let l = List.init 100 ~f:(fun _ -> Random.int 10) in
- let r1 = Caml.List.partition f l in
+ let r1 = Stdlib.List.partition f l in
let r2 = of_list l |> partition ~f |> fun (a, b) -> to_list a, to_list b in
assert_equal
~printer:int_list_tuple_printer
diff --git a/lib/CFStream_stream.ml b/lib/CFStream_stream.ml
index 25c0e5a..94da2e3 100644
index 25c0e5a..835791c 100644
--- a/lib/CFStream_stream.ml
+++ b/lib/CFStream_stream.ml
@@ -83,7 +83,7 @@ let find xs ~f = find_map xs ~f:(fun x -> if f x then Some x else None)
let find_exn xs ~f =
match find xs ~f with
| Some x -> x
- | None -> raise Caml.Not_found
+ | None -> raise Stdlib.Not_found
;;
let exists xs ~f =
@@ -287,7 +287,7 @@ let group_aux xs map eq =
;;

View File

@ -3,7 +3,7 @@
buildDunePackage rec {
pname = "dbf";
version = "0.1.1";
version = "0.2.0";
minimalOCamlVersion = "4.08";
@ -12,8 +12,8 @@ buildDunePackage rec {
src = fetchFromGitHub {
owner = "pveber";
repo = "dbf";
rev = version;
hash = "sha256-h1K5YDLbXGEJi/quKXvSR0gZ+WkBzut7AsVFv+Bm8/g=";
rev = "v${version}";
hash = "sha256-096GodM3J/4dsVdylG+6xz/p6ogUkhDGdFjiPwl/jLQ=";
};
buildInputs = [ ppx_cstruct ];

View File

@ -17,6 +17,9 @@ buildDunePackage rec {
propagatedBuildInputs = [ base fmt ];
# base v0.17 compatibility
patches = [ ./genspio.patch ];
doCheck = true;
meta = with lib; {

View File

@ -0,0 +1,714 @@
diff --git a/src/examples/downloader.ml b/src/examples/downloader.ml
index 93638e5..a785549 100644
--- a/src/examples/downloader.ml
+++ b/src/examples/downloader.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let downloader () =
let open Genspio.EDSL in
@@ -154,7 +154,7 @@ let downloader () =
; string " -> not HTTP(s) or FTP: NOT IMPLEMENTED" ] ] ) ] )
let () =
- match Caml.Sys.argv |> Array.to_list |> List.tl_exn with
+ match Stdlib.Sys.argv |> Array.to_list |> List.tl_exn with
| ["make"; path] -> (
let script = Genspio.Compile.to_many_lines (downloader ()) in
let content =
@@ -163,12 +163,12 @@ let () =
match path with
| "-" -> Fmt.pr "\n`````\n%s`````\n%!" content
| other ->
- let o = Caml.open_out other in
- Caml.Printf.fprintf o "%s%!" content ;
- Caml.close_out o )
+ let o = Stdlib.open_out other in
+ Stdlib.Printf.fprintf o "%s%!" content ;
+ Stdlib.close_out o )
| other ->
Fmt.epr "Wrong command line: [%s]\n"
(List.map ~f:(Fmt.str "%S") other |> String.concat ~sep:"; ") ;
Fmt.epr "Usage:\n%s make <path>\n Create the downloader script.\n%!"
- Caml.Sys.argv.(0) ;
- Caml.exit 1
+ Stdlib.Sys.argv.(0) ;
+ Stdlib.exit 1
diff --git a/src/examples/multigit.ml b/src/examples/multigit.ml
index e05885c..b0e5fd2 100644
--- a/src/examples/multigit.ml
+++ b/src/examples/multigit.ml
@@ -7,7 +7,7 @@
$genspio_multigit $BINNPATH
*)
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
let msg fmt = Fmt.kstr (Fmt.epr "%s\n%!") fmt
@@ -62,7 +62,7 @@ end
let version_string =
Fmt.str "%s (Genspio: %s)"
- (try Caml.Sys.getenv "multigit_version" with _ -> "0")
+ (try Stdlib.Sys.getenv "multigit_version" with _ -> "0")
Genspio.Meta.version
module Multi_status = struct
@@ -504,7 +504,7 @@ end
let cmdf fmt =
Fmt.kstr
(fun s ->
- match Caml.Sys.command s with
+ match Stdlib.Sys.command s with
| 0 -> ()
| other -> Fmt.kstr failwith "CMD: %S failed with %d" s other )
fmt
@@ -531,13 +531,13 @@ module Meta_repository = struct
let cmd_to_string_list cmd =
let i = Unix.open_process_in cmd in
let rec loop acc =
- try loop (Caml.input_line i :: acc)
- with _ -> Caml.close_in i ; List.rev acc in
+ try loop (Stdlib.input_line i :: acc)
+ with _ -> Stdlib.close_in i ; List.rev acc in
loop []
let readme_md ~path:_ ~output =
- let o = Caml.open_out output in
- let open Caml.Format in
+ let o = Stdlib.open_out output in
+ let open Stdlib.Format in
let fmt = formatter_of_out_channel o in
let out f = fprintf fmt f in
let sec c s = out "%s\n%s\n\n" s (String.make (String.length s) c) in
@@ -591,7 +591,7 @@ module Meta_repository = struct
par "" ;
section "Authors / Making-of" ;
par
- "This repository is generated by an OCaml program which itself was \
+ "This repository is generated by an OStdlib.program which itself was \
written by [Seb Mondet](https://seb.mondet.org), it uses the \
[Genspio](https://smondet.gitlab.io/genspio-doc/) EDSL library, and \
serves as one of its examples of usage, see also its \
@@ -599,7 +599,7 @@ module Meta_repository = struct
par
"Similarly, you may check out the <https://github.com/smondet/cosc> \
repository, which is also a bunch of shell scripts maintained by an \
- OCaml program." ;
+ OStdlib.program." ;
section "Example Session / Demo" ;
let git_repos_top = "/tmp/git-repos-example" in
let git_repos_hammerlab = git_repos_top // "hammerlab" in
@@ -724,21 +724,21 @@ end
*)
let () =
- let path = Caml.Sys.argv.(1) in
+ let path = Stdlib.Sys.argv.(1) in
cmdf "mkdir -p %s" (Filename.quote path) ;
let repomode =
- try String.(Caml.Sys.getenv "repomode" = "true") with _ -> false in
+ try String.(Stdlib.Sys.getenv "repomode" = "true") with _ -> false in
let output filename script long_description =
let gms = if repomode then path // "bin" // filename else path // filename in
msg "Outputting %S" gms ;
cmdf "mkdir -p %s" Filename.(quote (dirname gms)) ;
- let o = Caml.open_out gms in
- Caml.Format.(
+ let o = Stdlib.open_out gms in
+ Stdlib.Format.(
fprintf
(formatter_of_out_channel o)
"#!/bin/sh\n\n%s\n\n%a\n"
( long_description ()
- @ [ "The following is generated by an OCaml program using the \
+ @ [ "The following is generated by an OStdlib.program using the \
Genspio EDSL."; "See <https://smondet.gitlab.io/genspio-doc/>."
]
|> List.map ~f:(Fmt.str "# %s")
@@ -746,7 +746,7 @@ let () =
Genspio.Compile.To_slow_flow.Script.pp_posix
(Genspio.Compile.To_slow_flow.compile
(script () |> Genspio.Transform.Constant_propagation.process) )) ;
- Caml.close_out o ;
+ Stdlib.close_out o ;
cmdf "chmod +x %s" (Filename.quote gms) in
Multi_status.(output name script long_description) ;
Activity_report.(output name script long_description) ;
diff --git a/src/examples/service_composer.ml b/src/examples/service_composer.ml
index ef3c69b..b52969f 100644
--- a/src/examples/service_composer.ml
+++ b/src/examples/service_composer.ml
@@ -36,7 +36,7 @@
`cosc config show` is actually able to call `cosc-configuration-display`.
*)
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
let msg fmt = Fmt.kstr (Fmt.epr "%s\n%!") fmt
@@ -46,7 +46,7 @@ module Gedsl = Genspio.EDSL
let cmdf fmt =
Fmt.kstr
(fun s ->
- match Caml.Sys.command s with
+ match Stdlib.Sys.command s with
| 0 -> ()
| other -> Fmt.kstr failwith "CMD: %S failed with %d" s other )
fmt
@@ -87,24 +87,24 @@ module Script = struct
output_path // String.concat ~sep:"-" (root :: t.relative_path)
```
- The function `write` is the only real I/O of this whole OCaml program.
+ The function `write` is the only real I/O of this whole OStdlib.program.
*)
let write ?(compiler = `Slow_flow) t ~output_path ~root =
let path = output_path // String.concat ~sep:"-" (root :: t.relative_path) in
- let o = Caml.open_out path in
+ let o = Stdlib.open_out path in
msg "Outputting “%s” to %s\n%!" t.description path ;
( match compiler with
| `Slow_flow ->
Fmt.(
pf
- (Caml.Format.formatter_of_out_channel o)
+ (Stdlib.Format.formatter_of_out_channel o)
"#!/bin/sh\n\n%a\n" Genspio.Compile.To_slow_flow.Script.pp_posix
(Genspio.Compile.To_slow_flow.compile
(t.make ~root |> Genspio.Transform.Constant_propagation.process) ))
| `Standard ->
- Caml.Printf.fprintf o "#!/bin/sh\n\n%s\n"
+ Stdlib.Printf.fprintf o "#!/bin/sh\n\n%s\n"
(Genspio.Compile.to_many_lines (t.make ~root)) ) ;
- Caml.close_out o ; cmdf "chmod +x %s" path
+ Stdlib.close_out o ; cmdf "chmod +x %s" path
end
(*md Configuration of the scripts is bootstrapped with an environment
@@ -275,7 +275,7 @@ module Manual = struct
(Environment.var_configuration_path env)
env.Environment.default_configuration_path root root
@ par
- "The scripts are generated by an OCaml program which uses the \
+ "The scripts are generated by an OStdlib.program which uses the \
[Genspio](https://smondet.gitlab.io/genspio-doc) EDSL/library. \
The code generator serves as one of the usage examples of the \
library, see its \
@@ -341,7 +341,7 @@ module Manual = struct
let image = "smondet/genspio-doc-dockerfiles:apps406" in
Fmt.kstr par
"If you have [`opam`](https://opam.ocaml.org), setting up the \
- genspio repository is easy (only simple, pure OCaml \
+ genspio repository is easy (only simple, pure OStdlib.\
dependencies), if not, or if you just like Docker™, the \
generator is available in the `%s` image, see:"
image
@@ -912,7 +912,7 @@ module Example_script = struct
let basic env root =
let call s = Fmt.str "%s %s" root s in
let conf = "/tmp/example-basic.d" in
- let cmt fmt = Fmt.str Caml.("# " ^^ fmt) in
+ let cmt fmt = Fmt.str Stdlib.("# " ^^ fmt) in
( "basic"
, [ cmt "We setup the configuration root path:"
; Fmt.str "export %s=%s" (Environment.var_configuration_path env) conf
@@ -1051,13 +1051,13 @@ let make ?default_configuration_path ?default_screen_name ~name ~output_path ()
let () =
let anon = ref [] in
let anon_fun p = anon := p :: !anon in
- let usage = Fmt.str "%s [-help] <path>" Caml.Sys.argv.(0) in
+ let usage = Fmt.str "%s [-help] <path>" Stdlib.Sys.argv.(0) in
let name = ref None in
let output_path = ref None in
let config_path = ref None in
let screen_name = ref None in
let output_readme = ref false in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--name"
@@ -1077,7 +1077,7 @@ let () =
, Fmt.str "<script-name> Where to write the scripts." ) ] in
Arg.parse args anon_fun usage ;
List.iter !anon ~f:(msg "Ignoring %s") ;
- let die () = Caml.exit 2 in
+ let die () = Stdlib.exit 2 in
let need opt = function
| Some o -> o
| None ->
diff --git a/src/examples/small.ml b/src/examples/small.ml
index f6e4504..8c776a6 100644
--- a/src/examples/small.ml
+++ b/src/examples/small.ml
@@ -1,10 +1,10 @@
open! Base
-let examples = ref ([] : (Caml.out_channel -> unit) list)
+let examples = ref ([] : (Stdlib.out_channel -> unit) list)
let example ?show name description code =
let f o =
- Caml.Printf.fprintf o
+ Stdlib.Printf.fprintf o
"let () = examples := Example.make ~ocaml:%S %s %S %S %s :: !examples\n"
code
(match show with None -> "" | Some s -> Fmt.str "~show:%s" s)
@@ -303,7 +303,7 @@ Genspio.EDSL.(
(******************************************************************************)
let () =
- let open Caml in
+ let open Stdlib.in
let open Printf in
let o = open_out Sys.argv.(1) in
fprintf o "%s"
@@ -318,7 +318,7 @@ let examples = ref []
fprintf o "%s"
{ocaml|
let () =
- List.iter (List.rev !examples) ~f:(Example.run Caml.Format.std_formatter)
+ List.iter (List.rev !examples) ~f:(Example.run Stdlib.Format.std_formatter)
|ocaml} ;
close_out o ;
printf "%s: Done.\n%!" Sys.argv.(0)
diff --git a/src/examples/vm_tester.ml b/src/examples/vm_tester.ml
index f8272b9..59c81e0 100644
--- a/src/examples/vm_tester.ml
+++ b/src/examples/vm_tester.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
let ( // ) = Filename.concat
@@ -18,7 +18,7 @@ module Shell_script = struct
try String.sub ~pos:0 ~len:40 m with _ -> m
let path {name; content; _} =
- let open Caml in
+ let open Stdlib.in
let hash = Marshal.to_string content [] |> Digest.string |> Digest.to_hex in
let tag = String.sub hash 0 8 in
"_scripts" // Fmt.str "%s_%s.sh" (sanitize_name name) tag
@@ -54,7 +54,7 @@ module Run_environment = struct
let tmp_name_of_url = function
| Http (url, ext) ->
- ("_cache" // Caml.Digest.(string url |> to_hex))
+ ("_cache" // Stdlib.Digest.(string url |> to_hex))
^ Option.value_map ~default:"" ext ~f:(fun `Xz -> ".xz")
let make_files files =
@@ -410,14 +410,14 @@ end
let cmdf fmt =
Fmt.kstr
(fun cmd ->
- match Caml.Sys.command cmd with
+ match Stdlib.Sys.command cmd with
| 0 -> ()
| other -> Fmt.kstr failwith "Command %S did not return 0: %d" cmd other
)
fmt
let write_lines p l =
- let open Caml in
+ let open Stdlib.in
let o = open_out p in
Base.List.iter l ~f:(Printf.fprintf o "%s\n") ;
close_out o
@@ -427,7 +427,7 @@ let () =
Fmt.kstr
(fun s ->
Fmt.epr "Wrong CLI: %s\n%!" s ;
- Caml.exit 2 )
+ Stdlib.exit 2 )
fmt in
let example = ref None in
let path = ref None in
@@ -458,7 +458,7 @@ let () =
with
| Some s -> s
| None -> fail "Don't know VM %S" arg ) in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--ssh-port"
diff --git a/src/lib/EDSL.ml b/src/lib/EDSL.ml
index 9663489..9d31805 100644
--- a/src/lib/EDSL.ml
+++ b/src/lib/EDSL.ml
@@ -5,7 +5,7 @@ type c_string = Language.c_string
type byte_array = Language.byte_array
type fd_redirection = Language.fd_redirection
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
open Language.Construct
include Language.Construct.Base
@@ -109,7 +109,7 @@ let tmp_file ?tmp_dir name : file =
[ get_tmp_dir; str "/"
; str
(Fmt.str "genspio-tmp-file-%s-%s" clean
- Caml.Digest.(string name |> to_hex) ) ] in
+ Stdlib.Digest.(string name |> to_hex) ) ] in
let tmp = Str.concat_list [path; string "-tmp"] in
object (_self)
method get = get_stdout (call [string "cat"; path])
@@ -172,7 +172,7 @@ module Command_line = struct
let variable {switches; _} =
Fmt.str "%s_%s" prefix
( String.concat ~sep:"" switches
- |> Caml.Digest.string |> Caml.Digest.to_hex ) in
+ |> Stdlib.Digest.string |> Stdlib.Digest.to_hex ) in
let inits = ref [] in
let to_init s = inits := s :: !inits in
let cases = ref [] in
@@ -331,7 +331,7 @@ let fresh_name suf =
object
method v = 42
end in
- Fmt.str "g-%d-%d-%s" (Caml.Oo.id x) (Random.int 100_000) suf
+ Fmt.str "g-%d-%d-%s" (Stdlib.Oo.id x) (Random.int 100_000) suf
let sanitize_name n =
String.map n ~f:(function
diff --git a/src/lib/EDSL_v0.ml b/src/lib/EDSL_v0.ml
index 1ac12de..dd82023 100644
--- a/src/lib/EDSL_v0.ml
+++ b/src/lib/EDSL_v0.ml
@@ -5,7 +5,7 @@ type c_string = Language.c_string
type byte_array = Language.byte_array
type fd_redirection = Language.fd_redirection
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
include Language.Construct
@@ -63,7 +63,7 @@ let tmp_file ?tmp_dir name : file =
[ get_tmp_dir; c_string "/"
; c_string
(Fmt.str "genspio-tmp-file-%s-%s" clean
- Caml.Digest.(string name |> to_hex) ) ] in
+ Stdlib.Digest.(string name |> to_hex) ) ] in
let tmp = C_string.concat_list [path; string "-tmp"] in
object (self)
method get = get_stdout (call [string "cat"; path])
@@ -127,7 +127,7 @@ module Command_line = struct
let variable {switches; _} =
Fmt.str "%s_%s" prefix
( String.concat ~sep:"" switches
- |> Caml.Digest.string |> Caml.Digest.to_hex ) in
+ |> Stdlib.Digest.string |> Stdlib.Digest.to_hex ) in
let inits = ref [] in
let to_init s = inits := s :: !inits in
let cases = ref [] in
@@ -139,7 +139,7 @@ module Command_line = struct
let bool_of_var var = getenv (string var) |> Bool.of_string in
let anon_tmp =
Fmt.kstr tmp_file "parse-cli-%s"
- Caml.(Marshal.to_string options [] |> Digest.string |> Digest.to_hex)
+ Stdlib.(Marshal.to_string options [] |> Digest.string |> Digest.to_hex)
in
let anon = anon_tmp#get |> Elist.deserialize_to_c_string_list in
let applied_action =
@@ -293,7 +293,7 @@ let fresh_name suf =
object
method v = 42
end in
- Fmt.str "g-%d-%d-%s" (Caml.Oo.id x) (Random.int 100_000) suf
+ Fmt.str "g-%d-%d-%s" (Stdlib.Oo.id x) (Random.int 100_000) suf
let sanitize_name n =
String.map n ~f:(function
diff --git a/src/lib/common.ml b/src/lib/common.ml
index fe9cfee..d98d697 100644
--- a/src/lib/common.ml
+++ b/src/lib/common.ml
@@ -4,7 +4,7 @@ module Unique_name = struct
let x = ref 0
let create prefix =
- Caml.incr x ;
+ Stdlib.incr x ;
Fmt.str "%s_%d_%d" prefix !x (Random.int 100_000)
let variable = create
diff --git a/src/lib/compile.ml b/src/lib/compile.ml
index 12cc836..d365e37 100644
--- a/src/lib/compile.ml
+++ b/src/lib/compile.ml
@@ -53,7 +53,7 @@ module To_posix = struct
(fun ppf s -> pf ppf "@[`%s`@]" s) )
more )
()
- |> Caml.Filename.quote in
+ |> Stdlib.Filename.quote in
str " printf -- '%%s\\n' %s >&2 " msg_str
let one_liner =
@@ -116,7 +116,7 @@ let to_many_lines ?max_argument_length ?no_trap e =
to_legacy `Multi_line ?max_argument_length ?no_trap e
let quick_run_exn ?max_argument_length ?no_trap e =
- match to_many_lines ?max_argument_length ?no_trap e |> Caml.Sys.command with
+ match to_many_lines ?max_argument_length ?no_trap e |> Stdlib.Sys.command with
| 0 -> ()
| other -> Fmt.failwith "Command returned %d" other
@@ -125,7 +125,7 @@ let to_string_hum e = Fmt.str "%a" pp_hum e
let to_one_line_hum e =
let buf = Buffer.create 42 in
- let formatter = Caml.Format.formatter_of_buffer buf in
- Caml.Format.pp_set_margin formatter 10_000_000 ;
- Caml.Format.fprintf formatter "@[<h>%a@]@?" pp_hum e ;
+ let formatter = Stdlib.Format.formatter_of_buffer buf in
+ Stdlib.Format.pp_set_margin formatter 10_000_000 ;
+ Stdlib.Format.fprintf formatter "@[<h>%a@]@?" pp_hum e ;
Buffer.contents buf
diff --git a/src/lib/language.ml b/src/lib/language.ml
index cf7b810..6f71027 100644
--- a/src/lib/language.ml
+++ b/src/lib/language.ml
@@ -1,7 +1,7 @@
open Common
(* Here we use the legacy module (too much code to change at once): *)
-module Format = Caml.Format
+module Format = Stdlib.Format
type c_string = C_string
type byte_array = Byte_Array
diff --git a/src/lib/standard_compiler.ml b/src/lib/standard_compiler.ml
index 7e639c6..bc8848b 100644
--- a/src/lib/standard_compiler.ml
+++ b/src/lib/standard_compiler.ml
@@ -147,7 +147,7 @@ let rec to_ir : type a. _ -> _ -> a Language.t -> internal_representation =
match c_str with
| Byte_array_to_c_string (Literal (Literal.String s))
when Literal.Str.easy_to_escape s ->
- argument (Caml.Filename.quote s |> check_length)
+ argument (Stdlib.Filename.quote s |> check_length)
| Byte_array_to_c_string (Literal (Literal.String s))
when Literal.Str.impossible_to_escape_for_variable s ->
error ~comment_backtrace:comments (`Not_a_c_string s)
diff --git a/src/lib/to_slow_flow.ml b/src/lib/to_slow_flow.ml
index e1305ce..0f812aa 100644
--- a/src/lib/to_slow_flow.ml
+++ b/src/lib/to_slow_flow.ml
@@ -33,10 +33,10 @@ let expand_octal_command ~remove_l s =
let m = ref 0
let var_name ?expression ?script tag =
- Caml.incr m ;
+ Stdlib.incr m ;
let stag = String.map tag ~f:(function '-' -> '_' | a -> a) in
Fmt.str "genspio_%s_%d_%d_%s" stag (Random.int 100_000_000) !m
- Caml.(
+ Stdlib.(
Marshal.to_string (expression, script) [Marshal.Closures]
|> Digest.string |> Digest.to_hex)
@@ -49,7 +49,7 @@ module Tmp_db = struct
let make ?(deletion_grouping = 20) how =
let default_tmpdir =
match how with
- | `Fresh -> Caml.Filename.concat "/tmp" (var_name "tmpdir")
+ | `Fresh -> Stdlib.Filename.concat "/tmp" (var_name "tmpdir")
| `Use p -> p in
{default_tmpdir; tmp_file_db= []; deletion_grouping}
@@ -122,10 +122,10 @@ module Script = struct
let v = Fmt.str "$(%s)" (expand_octal_command ~remove_l:false oct) in
if not arithmetic then Fmt.str "\"%s\"" v else v
| Literal_value s ->
- let v = Caml.Filename.quote s in
+ let v = Stdlib.Filename.quote s in
if arithmetic then Fmt.str "$(printf -- %s)" v else v
| File s ->
- let v = Fmt.str "$(cat %s)" (Caml.Filename.quote s) in
+ let v = Fmt.str "$(cat %s)" (Stdlib.Filename.quote s) in
if not arithmetic then Fmt.str "\"%s\"" v else v
| Tmp_file_in_variable s ->
(* Parameters.(tmp_file_db := s :: !tmp_file_db) ; *)
@@ -150,7 +150,7 @@ module Script = struct
| Literal_value s -> string_to_octal s
| File f ->
Fmt.str "$(cat %s | od -t o1 -An -v | tr -d ' \\n')"
- (Caml.Filename.quote f)
+ (Stdlib.Filename.quote f)
| Tmp_file_in_variable f ->
(* Parameters.(tmp_file_db := f :: !tmp_file_db) ; *)
Fmt.str "$(cat \"${%s}\" | od -t o1 -An -v | tr -d ' \\n')" f
@@ -162,7 +162,7 @@ module Script = struct
| Unit -> assert false
| Raw_inline s -> s
| Literal_value _ -> assert false
- | File f -> Caml.Filename.quote f
+ | File f -> Stdlib.Filename.quote f
| Tmp_file_in_variable f ->
(* Parameters.(tmp_file_db := f :: !tmp_file_db) ; *)
Fmt.str "\"${%s}\"" f
@@ -343,7 +343,7 @@ let rec to_ir : type a. fail_commands:_ -> tmpdb:_ -> a t -> Script.t =
let esc = string_to_octal v ~prefix:"\\" in
mk (rawf "printf -- '%s' > %s" esc tmparg, tmp)
| Literal_value v ->
- mk (rawf "printf -- '%%s' %s > %s" (Caml.Filename.quote v) tmparg, tmp)
+ mk (rawf "printf -- '%%s' %s > %s" (Stdlib.Filename.quote v) tmparg, tmp)
| File p -> mk (rawf ":", make [] (File p))
| Tmp_file_in_variable p -> mk (rawf "cp \"${%s}\" %s" p tmparg, tmp)
| Raw_inline s -> mk (rawf "printf -- '%%s' %s > %s" s tmparg, tmp)
@@ -725,7 +725,7 @@ let compile ?(default_tmpdir = `Fresh) ?(signal_name = "USR1")
let fail_commands s =
match trap with
| `Exit_with _ ->
- [ rawf "printf '%%s\\n' %s > %s " (Caml.Filename.quote s) tmparg
+ [ rawf "printf '%%s\\n' %s > %s " (Stdlib.Filename.quote s) tmparg
; rawf "kill -s %s ${%s}" signal_name pid ]
| `None ->
failwith "You cannot use the `fail` construct with no `trap` strategy"
@@ -851,9 +851,9 @@ let test () =
let ir = compile expr in
fprintf std_formatter "==== TEST %d ====\n%a\n%!" idx Script.pp_posix ir ;
let script_file = Fmt.str "/tmp/script-%d.sh" idx in
- let o = Caml.open_out script_file in
+ let o = Stdlib.open_out script_file in
fprintf (formatter_of_out_channel o) "\n%a\n%!" Script.pp_posix ir ;
- Caml.flush o ;
- Caml.close_out o ;
- let res = Fmt.kstr Caml.Sys.command "sh %s" script_file in
+ Stdlib.flush o ;
+ Stdlib.close_out o ;
+ let res = Fmt.kstr Stdlib.Sys.command "sh %s" script_file in
fprintf std_formatter "\nRESULT: %d\n" res )
diff --git a/src/lib/transform.ml b/src/lib/transform.ml
index a1f16a3..78bb202 100644
--- a/src/lib/transform.ml
+++ b/src/lib/transform.ml
@@ -370,7 +370,7 @@ module Constant_propagation = struct
let count = ref 0 in
let check ?trace name e res =
let p = process ?trace e in
- Caml.incr count ;
+ Stdlib.incr count ;
match Poly.(p = res) with
| true -> ()
| false ->
diff --git a/src/test-lib/test_lib.ml b/src/test-lib/test_lib.ml
index eba7adf..ecf765d 100644
--- a/src/test-lib/test_lib.ml
+++ b/src/test-lib/test_lib.ml
@@ -1,9 +1,9 @@
open! Base
-let ( // ) = Caml.Filename.concat
+let ( // ) = Stdlib.Filename.concat
-module Filename = Caml.Filename
-module Sys = Caml.Sys
+module Filename = Stdlib.Filename
+module Sys = Stdlib.Sys
module Test = struct
type t =
@@ -82,7 +82,7 @@ module Shell_directory = struct
if String.length long > 30 then String.sub long ~pos:0 ~len:30
else long )
(List.length args) returns
- Caml.(
+ Stdlib.(
Marshal.to_string script [Marshal.Closures]
|> Digest.string |> Digest.to_hex
|> fun s -> String.sub s 0 10)
@@ -358,9 +358,9 @@ module Example = struct
( match Genspio.Compile.To_posix.(string ~options:multi_line) code with
| Ok script ->
let tmp = Filename.temp_file "genspio-example" ".sh" in
- let o = Caml.open_out tmp in
- Caml.Printf.fprintf o "\n%s\n" script ;
- Caml.close_out o ;
+ let o = Stdlib.open_out tmp in
+ Stdlib.Printf.fprintf o "\n%s\n" script ;
+ Stdlib.close_out o ;
(* ff fmt "@[<hov 2>* Compiled:@ `%s`@ (%d bytes)@]@\n" tmp (String.length script); *)
let out = Filename.temp_file "genspio-example" ".out" in
let err = Filename.temp_file "genspio-example" ".err" in
@@ -371,10 +371,10 @@ module Example = struct
let show_file name path =
let fence = String.make 50 '`' in
ff fmt "@\n%s:@\n@\n%s@\n" name fence ;
- let i = Caml.open_in path in
+ let i = Stdlib.open_in path in
let rec loop () =
try
- ff fmt "%c" @@ Caml.input_char i ;
+ ff fmt "%c" @@ Stdlib.input_char i ;
loop ()
with _ -> () in
loop () ; ff fmt "@\n%s@\n@\n" fence in
diff --git a/src/test/main.ml b/src/test/main.ml
index 3374bdf..44d4e3f 100644
--- a/src/test/main.ml
+++ b/src/test/main.ml
@@ -1,5 +1,5 @@
open! Base
-module Filename = Caml.Filename
+module Filename = Stdlib.Filename
open Tests.Test_lib
module Compile = Genspio.Language
module Construct = Genspio.EDSL_v0
@@ -635,7 +635,7 @@ let () =
@@ exits ~name:"getenv" 25
(let open Construct in
let alternate_get_env v =
- (* We cannot use OCaml's Sys.getenv because the compilation output may
+ (* We cannot use OStdlib.s Sys.getenv because the compilation output may
be run on a different host/system (through SSH or alike). *)
exec ["sh"; "-c"; Fmt.str "echo ${%s} | tr -d '\\n'" v]
|> get_stdout |> Byte_array.to_c in
@@ -1224,14 +1224,14 @@ let () =
Fmt.kstr
(fun s ->
Fmt.epr "Error: %s\nUsage: %s\n%!" s usage ;
- Caml.exit 1 )
+ Stdlib.exit 1 )
fmt in
let anon_fun p = anon := p :: !anon in
let no_compilation_tests = ref false in
let extra_slow_flow_tests = ref false in
let extra_transform_cp_tests = ref false in
let filter_tests = ref None in
- let module Arg = Caml.Arg in
+ let module Arg = Stdlib.Arg in
let args =
Arg.align
[ ( "--important-shells"
@@ -1294,13 +1294,13 @@ let () =
let todo = Test_directory.contents testdir ~path testlist in
List.iter todo ~f:(function
| `File (p, v) ->
- let mo = Caml.open_out p in
- Caml.Printf.fprintf mo "%s\n" v ;
- Caml.close_out mo
+ let mo = Stdlib.open_out p in
+ Stdlib.Printf.fprintf mo "%s\n" v ;
+ Stdlib.close_out mo
| `Directory v -> Fmt.kstr Sys.command "mkdir -p '%s'" v |> ignore ) ) ;
let errors =
if !no_compilation_tests then false else compilation_error_tests () in
if !extra_slow_flow_tests then Genspio.To_slow_flow.test () ;
if !extra_transform_cp_tests then
Genspio.Transform.Constant_propagation.test () ;
- Caml.exit (if errors then 23 else 0)
+ Stdlib.exit (if errors then 23 else 0)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
{
lib,
fetchFromGitHub,
buildDunePackage,
defaultVersion ? "0.17.0",
}:
{
pname,
version ? defaultVersion,
hash,
minimalOCamlVersion ? "5.1",
doCheck ? true,
buildInputs ? [ ],
...
}@args:
buildDunePackage (
args
// {
inherit version buildInputs;
inherit minimalOCamlVersion;
src = fetchFromGitHub {
owner = "janestreet";
repo = pname;
rev = "v${version}";
sha256 = hash;
};
inherit doCheck;
meta = {
license = lib.licenses.mit;
homepage = "https://github.com/janestreet/${pname}";
} // args.meta;
}
)

View File

@ -0,0 +1,24 @@
diff --git a/js_of_ocaml_patches.ml b/js_of_ocaml_patches.ml
index 58dd9d5..964b55e 100644
--- a/js_of_ocaml_patches.ml
+++ b/js_of_ocaml_patches.ml
@@ -15,6 +15,6 @@ module Dom_html = struct
inherit Js_of_ocaml.Dom_html.canvasRenderingContext2D
method ellipse :
- float -> float -> float -> float -> float -> float -> float -> unit meth
+ float -> float -> float -> float -> float -> float -> float -> bool t -> unit meth
end
end
diff --git a/js_of_ocaml_patches.mli b/js_of_ocaml_patches.mli
index 4aecc41..8ed5d50 100644
--- a/js_of_ocaml_patches.mli
+++ b/js_of_ocaml_patches.mli
@@ -14,6 +14,6 @@ module Dom_html : sig
inherit Js_of_ocaml.Dom_html.canvasRenderingContext2D
method ellipse :
- float -> float -> float -> float -> float -> float -> float -> unit meth
+ float -> float -> float -> float -> float -> float -> float -> bool t -> unit meth
end
end

View File

@ -1,6 +1,7 @@
{ lib, fetchurl, version ? "0.26.2", astring, base, camlp-streams, cmdliner_1_0
, cmdliner_1_1, csexp, dune-build-info, either, fix, fpath, menhirLib, menhirSdk
, ocaml-version, ocp-indent, odoc-parser, result, stdio, uuseg, uutf, ... }:
, ocaml-version, ocp-indent, odoc-parser, result, stdio, uuseg, uutf
, janeStreet_0_15, ... }:
# The ocamlformat package have been split into two in version 0.25.1:
# one for the library and one for the executable.
@ -42,8 +43,12 @@ rec {
cmdliner_v =
if lib.versionAtLeast version "0.21.0" then cmdliner_1_1 else cmdliner_1_0;
library_deps = [
base
base_v = if lib.versionAtLeast version "0.25.1" then base else janeStreet_0_15.base;
stdio_v =if lib.versionAtLeast version "0.25.1" then stdio else janeStreet_0_15.stdio;
library_deps= [
base_v
cmdliner_v
dune-build-info
fix
@ -51,7 +56,7 @@ rec {
menhirLib
menhirSdk
ocp-indent
stdio
stdio_v
uuseg
uutf
] ++ lib.optionals (lib.versionAtLeast version "0.20.0") [

View File

@ -17,6 +17,9 @@ buildDunePackage rec {
minimalOCamlVersion = "4.14";
# base v0.17 compatibility
patches = [ ./tdigest.patch ];
propagatedBuildInputs = [
base
ppx_sexp_conv

View File

@ -0,0 +1,17 @@
diff --git a/src/cmap.ml b/src/cmap.ml
index 69f447b..3afb2b6 100644
--- a/src/cmap.ml
+++ b/src/cmap.ml
@@ -173,6 +173,12 @@ end = struct
let of_list_with_key_multi list ~get_key =
Using_comparator.of_list_with_key_multi ~comparator list ~get_key
+ let of_list_with_key_fold list ~get_key ~init ~f =
+ failwith "Map.of_list_with_key_fold: not implemented yet"
+
+ let of_list_with_key_reduce list ~get_key ~f =
+ failwith "Map.of_list_with_key_reduce: not implemented yet"
+
let of_alist alist = Using_comparator.of_alist ~comparator alist
let of_alist_or_error alist = Using_comparator.of_alist_or_error ~comparator alist

View File

@ -1,5 +1,38 @@
diff --git a/src/big.ml b/src/big.ml
index 7cd327f..f84bc10 100644
--- a/src/big.ml
+++ b/src/big.ml
@@ -11,7 +11,7 @@ let big_font_map =
] in
let uchar_of_char =
- let open Caml.Uchar in
+ let open Stdlib.Uchar in
function
| '[' -> of_int 0x258C
| ']' -> of_int 0x2590
@@ -48,4 +48,4 @@ let image_of_string attr str =
List.map (String.to_list str) ~f:(fun ch ->
List.map (Map.find_exn big_font_map ch) ~f:(I.uchars attr)
|> I.vcat
- ) |> I.hcat
\ No newline at end of file
+ ) |> I.hcat
diff --git a/src/display.ml b/src/display.ml
index bd6f7e4..44d7f6d 100644
--- a/src/display.ml
+++ b/src/display.ml
@@ -41,7 +41,7 @@ let splits_header timer width =
let joined = I.hcat cell_padded in
let padded = left_pad width joined in
- let br = I.uchar Colors.label (Caml.Uchar.of_int 0x2500) width 1 in
+ let br = I.uchar Colors.label (Stdlib.Uchar.of_int 0x2500) width 1 in
I.(padded <-> br)
type time_status = Ahead_gain | Ahead_loss | Behind_gain | Behind_loss | Gold
diff --git a/src/dune b/src/dune
index a50b09a..54cc770 100644
index a50b09a..2b00ee2 100644
--- a/src/dune
+++ b/src/dune
@@ -1,7 +1,7 @@

View File

@ -751,7 +751,9 @@ let
# Jane Street
janePackage =
if lib.versionOlder "4.13.1" ocaml.version
if lib.versionOlder "5.1" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_17.nix {}
else if lib.versionOlder "4.13.1" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_16.nix {}
else if lib.versionOlder "4.10.2" ocaml.version
then callPackage ../development/ocaml-modules/janestreet/janePackage_0_15.nix {}
@ -762,7 +764,13 @@ let
else null;
janeStreet =
if lib.versionOlder "4.13.1" ocaml.version
if lib.versionOlder "5.1" ocaml.version
then import ../development/ocaml-modules/janestreet/0.17.nix
{
inherit self;
inherit (pkgs) bash fzf lib openssl zstd;
}
else if lib.versionOlder "4.13.1" ocaml.version
then import ../development/ocaml-modules/janestreet/0.16.nix {
inherit self;
inherit (pkgs) bash fetchpatch fzf lib openssl zstd krb5;