Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 3 additions & 24 deletions service/service.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,11 @@ module Make (Opam_repo : Opam_repository_intf.S) = struct
| _ -> Fmt.failwith "BUG: bad output: %s" results)

let ocaml = OpamPackage.Name.of_string "ocaml"
let base_effects = OpamPackage.Name.of_string "base-effects"
let base_domains = OpamPackage.Name.of_string "base-domains"

let is_multicore ocaml_version =
let v =
Ocaml_version.of_string_exn
(OpamPackage.Version.to_string ocaml_version)
in
Ocaml_version.Configure_options.is_multicore v

(* If a local package has a literal constraint on OCaml's version and it doesn't match
the platform, we just remove that package from the set to test, so other packages
can still be tested. If it depends on base-effects or base-domains, require a multicore compiler. *)
let compatible_with ~log ~ocaml_version (dep_name, filter) =
can still be tested. *)
let compatible_with ~ocaml_version (dep_name, filter) =
let check_ocaml = function
| OpamTypes.Constraint (op, OpamTypes.FString v) ->
let v = OpamPackage.Version.of_string v in
Expand All @@ -133,16 +124,6 @@ module Make (Opam_repo : Opam_repository_intf.S) = struct
in
if OpamPackage.Name.equal dep_name ocaml then
OpamFormula.eval check_ocaml filter
else if
OpamPackage.Name.equal dep_name base_effects
|| OpamPackage.Name.equal dep_name base_domains
then (
try is_multicore ocaml_version
with ex ->
Log.info log "is_multicore %S failed: %a"
(OpamPackage.Version.to_string ocaml_version)
Fmt.exn ex;
false)
else true

let handle ~log request t =
Expand Down Expand Up @@ -176,9 +157,7 @@ module Make (Opam_repo : Opam_repository_intf.S) = struct
else
let opam = OpamFile.OPAM.read_from_string contents in
let deps = OpamFile.OPAM.depends opam in
OpamFormula.eval
(compatible_with ~log ~ocaml_version)
deps)
OpamFormula.eval (compatible_with ~ocaml_version) deps)
in
(* If some packages are compatible but some aren't, just solve for the compatible ones.
Otherwise, try to solve for everything to get a suitable error. *)
Expand Down