Open rjbou opened 2 months ago
From today's meeting, for further discussion. I contend that there are two competing concepts in opam 2.1+:
When a switch is created, the invariant (i.e. --formula
or --packages
converted to a formula) is stored and persisted. So what used to be the "base packages" has no need of roots, because the formula precisely describes it.
When a package is installed, it still gets marked as a root. At any solver operation, both the invariant and the roots must be satisfied (the roots not as strongly, as IIRC existing roots can be removed if a newer part of the request requires it).
For set-invariant
, I therefore don't think any roots should be amended - because we keep the formula. For opam install --formula
, where we don't keep the formula (at least at the moment), some roots should indeed be inferred. However, it's also fine/correct (to me) that opam install foo
followed by opam switch set-invariant --formula foo
has foo
marked as a root (because it was marked as a root at installation and invariant happens now to include it) where opam switch create baz --formula foo
does not mark foo
as a root (because it was never explicitly installed by the user, who specified an invariant formula instead).
When using
opam install --formula
root packages are not set. It affects switch export/import mechanism, as well set-invariant one.