tarides / ocaml-platform-installer

The best way for developers to write software in OCaml
ISC License
60 stars 8 forks source link

Keep the cache repository enabled(?) #139

Closed panglesd closed 1 year ago

panglesd commented 1 year ago

When we started the project, we tried to be as invisible as possible:

However, this was in fact in contradiction with user experience:

  1. We sometimes need to replace ocamlformat version #126,
  2. The package name were not working great with with-dev-tools #128
  3. When we remove the cache, it messes with the installed packages (see https://github.com/tarides/ocaml-platform-installer/pull/134#discussion_r1021634654), so we cannot any more manipulate with update, upgrade, remove, reinstall, opam show is wrong...

Since solving 1. and 2. has already made us go in the direction of more "intrusivity" for a better user experience, #127 and #134, I suggest continuing with 3. and keep the cache repo enabled after ocaml-platform has finished running.

Running ocaml-platform would leave the switch modified.

There is still the problem of pinned and variants compilers, where the cache is not kept. One possible solution would be to store a "switch-specific" cache it in some "switch-specific" folder (one that would be remove by opam in case the switch is removed, if possible).

Julow commented 1 year ago

That works for me. I do not expect that the libraries of the tools are used much and as we discussed before, they could be packaged separately to make the dependency more explicit.

For the pinned compilers, the constraint on the compiler added to the packages should cover that ?

panglesd commented 1 year ago

For the pinned compilers, the constraint on the compiler added to the packages should cover that ?

I don't think we found a way to reliably detect (and differentiate) pinned compilers using opam language.

I think we have several options:

  1. Decide that we still remove the cache for pinned compiler packages, making upgrade, opam show, etc, wrong.
  2. Put the specific cache for a pinned compiler cache at <switch-prefix>/_ocaml-platform (even though this is not explicitly allowed by opam)
  3. Find a better way to detect and differentiate pinned and/or various variants compilers
  4. Decide that we drop support for pinned and/or variants compilers.

I am not sure what I prefer yet.

Julow commented 1 year ago

I'm not sure I understand. In the case of a pinned compiler, we install the packages from a temporary repository that is still removed when the installation is done. If our constraints are good, there shouldn't be any ambiguity ?

I think pinned compilers should have defined version numbers, right ? Cached packages have strong constraints on the compiler packages, that shouldn't match a pinned compiler.

panglesd commented 1 year ago

The problem is that, if you remove the repository from which the tools were installed, the tools inherit from the opam file from another repository.

So, for instance, opam show ocamlformat will have again all the constraints on the dependencies (such as odoc-parser and all the annoying ones).

Julow commented 1 year ago

I see now! A subsequent install of ocamlformat will go back to using the released package, because the cached package is no longer defined. I don't think the dependencies are modified until then but the --with-dev-setup will certainly trigger a re-install in this case.

Keeping the repository inside the switch prefix doesn't seem like a bad idea. There's <switch-prefix>/var/cache, it's currently used by Odig at runtime and is not cleaned up when Odig is uninstalled.

Perhaps pinned packages could be used for this purpose ? It's might come with more edge cases, so I'd suggest prefix/var/cache first.

panglesd commented 1 year ago

I agree, let's go with this solution!

panglesd commented 1 year ago

Closed by #140