opam icon indicating copy to clipboard operation
opam copied to clipboard

Invariant/compiler messages needs update

Open rjbou opened this issue 4 years ago • 1 comments

On an switch creation or empty switch there is no package is not compiler message while in a switch with packages it is:

$ opam switch create foo ocaml

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml"]
^C

[WARNING] Switch foo left partially installed
$ opam switch set-invariant ocaml-base-compiler --sw foo
The switch invariant was set to ocaml-base-compiler
$ opam switch set-invariant ocaml --sw foo
The switch invariant was set to ocaml

$ opam sw set-invariant ocaml --sw bar
[WARNING] Packages ocaml don't have the 'compiler' flag set.
The switch invariant was set to ocaml

And not found package error message refers to a compiler package

$ opam switch set-invariant ocamll
[ERROR] No compiler matching `ocamll' found, use `opam switch list-available' to see what is available, or use `--packages' to select packages explicitly.

rjbou avatar Oct 15 '21 10:10 rjbou

I don't think we need to care about packages in the invariant which don't have the compiler flag any more - that made a certain amount of sense in 2.0 with base packages (because it fixed the versions) but it's adding a warning to something which is a nice feature, now!

I'm wondering if it's best just to do away with the warning completely - opam switch create foo ocaml-base-compiler is still just as "unstable" w.r.t. compiler version as opam switch create foo --empty && opam install ocaml-base-compiler, so the warning isn't really adding much anymore.

We had talked about (but I don't think tracked) altering the solution display to show more clearly packages covered by the invariant which have changed - a halfway house towards that might be to highlight packages flagged compiler which are about to be upgraded/downgraded? So if you've installed something which is going to cause the compiler to upgrade/downgrade and you weren't expecting it, at least that change isn't then buried inside the other 300 packages which are being built!

dra27 avatar Oct 15 '21 10:10 dra27

Fixed by #5208

rjbou avatar Mar 15 '23 09:03 rjbou