Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not load the switch state to get the current OCaml version #403

Merged
merged 2 commits into from
Mar 19, 2024
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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 4 additions & 5 deletions cli/pull.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading