-
Notifications
You must be signed in to change notification settings - Fork 346
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
How to get a local opam switch in a consistent state? #4161
Comments
Opam relies on a solver to compute the actions to do (install, upgrade, downgrade, remove), and the result is not deterministic. The available packages in the repository can also have an effect on the solver's result. Why pinning packages add confusion to the switch state ? If you want to keep a specific version from being upgraded, you can use a version pinning. Otherwise, you can create an opam file containing all needed packages with their exact version and install that virtual opam file, |
I feel like there is too much freedom left for the specification of a package's dependencies.
Sure. According to my experience, even the release of a thorougly tested package by opam-repository can break the installation of an already published dependent package.
It's unclear and based on my experience.
For a complex set of packages, I do |
If you lock all dependencies to a version, you'll get a deterministic package set to install. But the set of actions will remain dependent from your switch state (if a package is already installed in one and not in the other, the set of actions will differ). On pinning, when you version pin a package, it ensures that the package won't be upgraded on update, so it reduces nondeterminism. Others kind of pin have an effect on the opam file, so yes, it can make the installation less consistent regarding opam repository. |
Summary:
Thinking about these opam files, I had the following idea:
Looking at https://opam.ocaml.org/packages/foo/ one will find: and for each compiler, the set of dependencies. That can create conflicts between sets of packages. But in fact this would reveal and isolate a compatibility issue instead of letting him appear on someone local opam repo. It may look weird/unusual to many people because they are used to think about their package. But in reality, the OCaml compiler is the leader of the ecosystem, and any package provider should align to it. What do you think about that proposal? PS: in, say https://opam.ocaml.org/packages/ocaml-base-compiler/ , the drop-down menu is sorted in increasing order. What about sorting in decreasing order, so that the more recent are immediately available? |
Ping @rjbou for a decision on this one |
On different machines (same distribution, debian buster), as soon as installation problems are encountered and solved on one machine, doing
opam install foo bar baz
is often not enough to get exactly the same switch state on another machine (i.e. the same set of installed packages). It's like opam silently keeps track of some previously computed constraints, that don't allow to reach a new switch state withopam install
commands.So, once a set of installed opam packages is locally validated by the developer, instead of sharing a set of
opam install
commands, one reliable solution is to share a switch state by doingopam switch export
from the validated switch on first machine, then by doingopam switch import
from an opam switch on another machine.When package installation is broken, doing
opam pin add some-patched-repo
can temporarily solve the problem but it often adds some confusion to the state of the opam switch.Doing
opam switch export
from two machines gives a comparison of their switch states, but is not enough to explain why there are not in the same state despite the sameopam { install | reinstall | pin add }
commands are executed.Does opam keep track of change history of a switch?
What is the recommended way/tool for inspecting accurately what's beneath the state of an opam switch? (i.e. to get more than what
opam switch export
gives).How to cleanly and securely fix/reset a switch to get exactly the same switch state as if build from scratch with a sequence of
opam install
commands?Thanks.
The text was updated successfully, but these errors were encountered: