diff --git a/CHANGES.md b/CHANGES.md index 67dd18aa8..987cf0c07 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,10 @@ - Fix support for pinned packages. In that case, it is not necessary to add dev-repo conflicts as `opam-monorepo` will always use the pinned repository. (#398, #353, @samoht, @reynir, reported by @emillon) +- Improve the speed of `opam monorepo pull`. Loading an switch state might take + a few seconds -- replace it with a call to `ocamlc --version` to check if the + lockfile is compatible with the currently available OCaml compiler + (#403, @samoht) ### Removed diff --git a/cli/pull.ml b/cli/pull.ml index 83719833a..b0bae11e8 100644 --- a/cli/pull.ml +++ b/cli/pull.ml @@ -75,16 +75,15 @@ let run (`Yes yes) (`Root root) (`Lockfile explicit_lockfile) D.Lockfile.ocaml_version lockfile |> Base.Result.of_option ~error:(`Msg "OCaml compiler not in lockfile") in - OpamSwitchState.with_ `Lock_none global_state @@ fun switch_state -> - let switch_ocaml_version = - OpamSwitchState.get_package switch_state D.Config.compiler_package_name - |> OpamPackage.version - in let* pulled = D.Pull.duniverse ~global_state ~root ~full ~preserve_symlinks:keep_symlinked_dir ~trim_clone:(not keep_git_dir) duniverse in + let* switch_ocaml_version = + let+ version = D.Exec.ocaml_version () in + OpamPackage.Version.of_string (Ocaml_version.to_string version) + in (match D.Opam.version_is_at_least locked_ocaml_version switch_ocaml_version with