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

opam install --formula don't set root packages #5947

Open
rjbou opened this issue May 6, 2024 · 1 comment
Open

opam install --formula don't set root packages #5947

rjbou opened this issue May 6, 2024 · 1 comment

Comments

@rjbou
Copy link
Collaborator

rjbou commented May 6, 2024

When using opam install --formula root packages are not set. It affects switch export/import mechanism, as well set-invariant one.

@rjbou rjbou added the KIND: BUG label May 6, 2024
@dra27
Copy link
Member

dra27 commented May 13, 2024

From today's meeting, for further discussion. I contend that there are two competing concepts in opam 2.1+:

  • Switch invariant (a formula - specifying a list of packages of course being a trivial case of a formula)
  • Root packages

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants