From 6bda93a6425fff5b4f0a290adc0f48fa594aae74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Jul 2022 12:46:26 +0200 Subject: [PATCH 1/5] Bump to Dune 3.3 --- dune-project | 2 +- obuilder-spec.opam | 2 +- obuilder.opam | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dune-project b/dune-project index 6fab1720..5fd93afe 100644 --- a/dune-project +++ b/dune-project @@ -1,4 +1,4 @@ -(lang dune 2.7) +(lang dune 3.3) (name obuilder) (formatting disabled) (generate_opam_files true) diff --git a/obuilder-spec.opam b/obuilder-spec.opam index e900c02a..ec0b2309 100644 --- a/obuilder-spec.opam +++ b/obuilder-spec.opam @@ -10,7 +10,7 @@ homepage: "https://github.com/ocurrent/obuilder" doc: "https://ocurrent.github.io/obuilder/" bug-reports: "https://github.com/ocurrent/obuilder/issues" depends: [ - "dune" {>= "2.7"} + "dune" {>= "3.3"} "fmt" {>= "0.8.9"} "sexplib" "astring" diff --git a/obuilder.opam b/obuilder.opam index e6b428b4..c3b31f58 100644 --- a/obuilder.opam +++ b/obuilder.opam @@ -10,7 +10,7 @@ homepage: "https://github.com/ocurrent/obuilder" doc: "https://ocurrent.github.io/obuilder/" bug-reports: "https://github.com/ocurrent/obuilder/issues" depends: [ - "dune" {>= "2.7"} + "dune" {>= "3.3"} "lwt" {>= "5.6.1"} "astring" "fmt" {>= "0.8.9"} From d0876ff4fb0f8d8c3da3ba2c0d8d49460479cf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Jul 2022 12:46:58 +0200 Subject: [PATCH 2/5] Fix warning 67 unused-functor-parameter --- lib/build.mli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/build.mli b/lib/build.mli index 5f94b364..f839c16d 100644 --- a/lib/build.mli +++ b/lib/build.mli @@ -22,7 +22,7 @@ module Context : sig *) end -module Make (Store : S.STORE) (Sandbox : S.SANDBOX) (Fetch : S.FETCHER) : sig +module Make (Store : S.STORE) (Sandbox : S.SANDBOX) (_ : S.FETCHER) : sig include S.BUILDER with type context := Context.t val v : store:Store.t -> sandbox:Sandbox.t -> t From 2448d0ea0a6df5d8bd86701fa82e34fda5fce24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Jul 2022 12:56:07 +0200 Subject: [PATCH 3/5] Don't store promise that is never read or bound to File "lib/db_store.ml", line 9, characters 4-27: 9 | cancelled : unit Lwt.t; ^^^^^^^^^^^^^^^^^^^^^^^ Error (warning 69 [unused-field]): record field cancelled is never read. (However, this field is used to build or mutate values.) --- lib/db_store.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/db_store.ml b/lib/db_store.ml index 50540809..472ab90c 100644 --- a/lib/db_store.ml +++ b/lib/db_store.ml @@ -6,7 +6,6 @@ let ( >>!= ) = Lwt_result.bind module Make (Raw : S.STORE) = struct type build = { mutable users : int; - cancelled : unit Lwt.t; set_cancelled : unit Lwt.u; (* Resolve this to cancel (when [users = 0]). *) log : Build_log.t Lwt.t; result : (([`Loaded | `Saved] * S.id), [`Cancelled | `Msg of string]) Lwt_result.t; @@ -19,7 +18,7 @@ module Make (Raw : S.STORE) = struct dao : Dao.t; (* Invariants for builds in [in_progress]: - [result] is still pending and [log] isn't finished. - - [cancelled] is resolved iff [users = 0]. *) + - [set_cancelled] is resolved iff [users = 0]. *) mutable in_progress : build Builds.t; } @@ -101,7 +100,7 @@ module Make (Raw : S.STORE) = struct let log, set_log = Lwt.wait () in let tail_log = log >>= fun log -> Build_log.tail ?switch log (client_log `Output) in let cancelled, set_cancelled = Lwt.wait () in - let build = { users = 1; cancelled; set_cancelled; log; result } in + let build = { users = 1; set_cancelled; log; result } in Lwt_switch.add_hook_or_exec switch (fun () -> dec_ref build; Lwt.return_unit) >>= fun () -> t.in_progress <- Builds.add id build t.in_progress; Lwt.async From 50afc6413b619ec488a248f9e10eb8a6362fc867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Jul 2022 17:49:01 +0200 Subject: [PATCH 4/5] Mock sandbox doesn't need a state directory --- test/mock_sandbox.ml | 3 +-- test/mock_sandbox.mli | 2 +- test/test.ml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/mock_sandbox.ml b/test/mock_sandbox.ml index e899ebb1..eb22bf44 100644 --- a/test/mock_sandbox.ml +++ b/test/mock_sandbox.ml @@ -1,5 +1,4 @@ type t = { - dir : string; expect : (cancelled:unit Lwt.t -> ?stdin:Obuilder.Os.unix_fd -> @@ -22,4 +21,4 @@ let run ~cancelled ?stdin ~log t (config:Obuilder.Config.t) dir = | ex -> Lwt_result.fail (`Msg (Printexc.to_string ex)) ) -let create dir = { dir; expect = Queue.create () } +let create () = { expect = Queue.create () } diff --git a/test/mock_sandbox.mli b/test/mock_sandbox.mli index eaaf9fb9..dd44d05c 100644 --- a/test/mock_sandbox.mli +++ b/test/mock_sandbox.mli @@ -1,6 +1,6 @@ include Obuilder.S.SANDBOX -val create : string -> t +val create : unit -> t val expect : t -> (cancelled:unit Lwt.t -> ?stdin:Obuilder.Os.unix_fd -> diff --git a/test/test.ml b/test/test.ml index 7001be89..1b94a226 100644 --- a/test/test.ml +++ b/test/test.ml @@ -24,7 +24,7 @@ let get store path id = let with_config fn = Mock_store.with_store @@ fun store -> - let sandbox = Mock_sandbox.create (Mock_store.state_dir store / "sandbox") in + let sandbox = Mock_sandbox.create () in let builder = B.v ~store ~sandbox in let src_dir = Mock_store.state_dir store / "src" in Os.ensure_dir src_dir; From fe97fd9c7830a97fb9889d2ff2eb8cc3590dd49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonin=20D=C3=A9cimo?= Date: Fri, 8 Jul 2022 13:55:40 +0200 Subject: [PATCH 5/5] Attach stress.exe to obuilder package ocaml-ci executes this if only obuilder-spec can be build: opam exec -- dune build --only-packages=obuilder-spec @install @check @runtest && rm -rf _build Dune would try to build stress.exe as part of the obuider-spec package @check alias. However, stress links with the obuilder library and such is part of the obuilder package. The easiest way to express it is to make it a no-op test of the obuilder package, so that it is not build with obuilder-spec. --- stress/dune | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stress/dune b/stress/dune index 03fd1a7e..4d59814c 100644 --- a/stress/dune +++ b/stress/dune @@ -1,3 +1,6 @@ -(executable - (name stress) - (libraries obuilder cmdliner fmt.tty)) +; No-op test to attach stress.exe to the obuilder package +(test + (name stress) + (libraries obuilder cmdliner fmt.tty) + (package obuilder) + (action (progn)))