-
Notifications
You must be signed in to change notification settings - Fork 428
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
fix(pkg): use available local package version to satisfy =version opam constraints #11517
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and seems to pass all tests :)
I have a worry about this though that it would require packages to have correct version information and will fail otherwise. In my experience, nearly every time I check out a git repo and it defines a version, the version is wrong. Unless it is the commit from the version it was tagged, but asides from that (name foo) (version 0.1.0)
in a git repo and foo.0.1.0
aren't necessarily compatible.
Currently all { = version}
constraints succeed because the version for all local packages is dev
and dune doesn't care about versions when building anyway, but if they don't match up, then we suddenly start failing to lock projects that worked before.
How does opam handle this? If you pin a package, will it use the version info from the opam
files or will it pick dev
by default?
Opam will use the version from the opam file if specified, or the latest known version from the opam-repo otherwise (which is bonkers, as it depends on when you last ran I would very much like to avoid this in dune pkg indeed... I'm hoping that there are two differences from how opam does things which makes this reasonable:
On the other end, I found it surprising that |
Writing a version inside the project file is a non starter for dune. One of the very first things that dune did to improve packaging over oasis and friends is relieve users of the duty to maintain these version numbers in their project configuration. While it’s a shame we don’t support this, writing such constraints seems like a misfeature to me. Just to give one example, when does it ever make sense to bump a constraint on a dependency whenever you released a version of your package? If this information is really needed to guide the solver, it can go in the workspace file. |
I think my original assessment of this PR was a bit harsh. We don't need to approve of this feature to support it. Existing users will remain largely unaffected by this. We should just be mindful that this is only an edge case that we don't mind supporting, and not promote it as the recommended way of interacting with the solver. |
I fully agree, yet I recall packages specifying this (I guess because if you specify
That said, could we maybe assess how many packages on opam would be affected (by checking out the dev-repo and seeing whether there's a version in If setting the version to So far the only usecase I know for it is when you have a project that has multiple packages that use |
aadbb2b
to
355e71e
Compare
355e71e
to
007434b
Compare
…raints Signed-off-by: ArthurW <[email protected]>
007434b
to
31368b1
Compare
…raints (ocaml#11517) Signed-off-by: ArthurW <[email protected]>
The solver currently assumes that local packages always have version
dev
even when thedune-project
or.opam
file specifies a different version. This leads to solver failure when a local package depends on a non-local package with a{= version}
constraint, since we won't find adev
version of the dependency in that case (as we should have used the locally specified version instead). cc @Leonidas-from-XIV