-
Notifications
You must be signed in to change notification settings - Fork 27
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
Remove custom deduplication of packages and use opam solver instead #396
Conversation
It's a different approach and using hashes is interesting but I don't see how it would solve the issue why the deduplication was implemented. The case that keeps failing is this: There are OPAM packages The project to be locked depends on This solution would include both tarballs in the lock file (since their dev-repos match but their hashes don't) and if fetching those worked then dune wouldn't be able to build the solution since the duniverse then contains |
No this PR will say there is no solution (which is the fine answer to give here) as foo.1.1 and foo-lwt.1.0 will be in conflict |
Could you point out to a place where such constraints happen in practice? There is maybe a better way to fix those than to add (more) complexity in opam-monorepo. |
(Also I'm not sure I understand your example: what bar has anything to do with foo?) |
Sorry, the example I wrote said But if now it will fail to solve, this is:
The deduplication was added to make solutions that work in OPAM work in opam-monorepo while sidestepping the issues of having the same library multiple times in the duniverse. #331 is the case you've seen that would be affected. Where Thus introducing a conflict artificially would make it fail in the solver already, thus potentially making opam-monorepo fairly useless since a lot of compiling solutions (that work with OPAM) would be rejected. |
I'm still not sure to understand - this patch does exactly what @reynir is suggesting in #331 (comment): it makes the solver do the deduplication by always generate a consistent solution (for opam-monorepo). I'm ok to diverge from |
But the problem is not a solver problem. If you remove the deduplication the solver will leave you with a perfectly fine solution, the issue will be that this is not a solution that dune can build. The problem has actually very little to do with opam-monorepo, on the other hand, opam-monorepo tries to sidestep it as much as possible by hopefully only fetching tarballs where the To not split the discussion too much between here and there, I've replied to @reynir's comment on the original issue: #331 (comment) to explain the exact issue with |
Well that's fair, but then we trade the bug that constraints in some cases are ignored (and we try to optimistically use the newer version) with a strict failure in that case (so instead of maybe failing to build it will definitely fail to lock, thus decreasing the amount of packages that can be installed this way). We can of course do that and I am happy to have a more reliable solution but I also think that users will not be happy if a new version of opam-monorepo can't build a duniverse anymore after an older version was able to make it work (albeit in a rather wonky way). |
I am really curious if this is a real issue in practice. I'm really much more inclined to make the tool fail in an understandable way and let packages "fix" potential issues (like the temporary incompatibility of h2 and hpack which was fixed as soon as it was identified properly). I also think we could make the conflict message more explicit in case the conflict was added because of using the same I think we should get that one merged and released and see how that works in practice - happy to revert if something terrible happens ;-) |
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.
I am really curious if this is a real issue in practice. I'm really much more inclined to make the tool fail in an understandable way and let packages "fix" potential issues
I am unsure, this logic has been added before my involvement in opam-monorepo. We can certainly give it a try.
I think we should get that one merged and released and see how that works in practice - happy to revert if something terrible happens ;-)
We could release this as 0.4.0 and see what the user feedback will be. Maybe it will be indeed a better user experience!
456f52e
to
1d0118d
Compare
For some reasons the CI is broken and doesn't test anything. I think it comes from #395 -- fixing it now. |
Convert the constraint "if X and Y are from the same repository" into a conflict relationship in the opam metadata between `X` and all the version of `Y` which do not have the same exact version as `X`. This allow to remove the adhoc post-processing of opam solution which was going very wrong in lots of case. Hopefully, the results will now be much closer to what you would expect `opam` to produce.
1d0118d
to
a798337
Compare
Rebased |
Thanks. I think we should cut a release sometime soon so users can give this a spin and provide feedback. |
Sounds good - let me know when it's released and I'll try it on mirage stuff :p |
CHANGES: ### Added - Display warning when a package to be locked is missing a `dev-repo` field and is being skipped because of it (tarides/opam-monorepo#341, tarides/opam-monorepo#362, @kit-ty-kate, @Leonidas-from-XIV) - Add option `--keep-symlinked-dir` to preserve symlinks in `duniverse/`, which can be useful for local development. (tarides/opam-monorepo#348, tarides/opam-monorepo#366, @hannesm, @Leonidas-from-XIV) - Adopt the OCaml Code of Conduct (tarides/opam-monorepo#391, @rikusilvola) - Add solver tests (tarides/opam-monorepo#394, @samoht) ### Changed - Canonicalize the URLs of the OPAM `dev-repo` fields to be able to detect more semantically equivalent URLs, this should reduce the risk of build failures due to duplicate code pulled (tarides/opam-monorepo#118, tarides/opam-monorepo#365 @TheLortex, @Leonidas-from-XIV) - Simple the error message printed when dependencies don't use dune as their build system. The opam-0install diagnostic message is no longer printed in this case and the message has been reformatted and reworded to make the salient information easier to see. (tarides/opam-monorepo#384, @gridbugs) - Encode `dev-repo` constraints in the opam solver - this allows to resolve more involved version constraints that were failing before (tarides/opam-monorepo#396, @samoht) ### Deprecated ### Fixed - Error in case where multiple packages with different dev-repo fields would be placed in the same duniverse directory (tarides/opam-monorepo#377, @gridbugs) - Fix a failure when using opam-monorepo with an opam 2.2 root (tarides/opam-monorepo#379, @kit-ty-kate) - Fix assertion failure when prefix of "lock" subcommand is used (tarides/opam-monorepo#381, @gridbugs) - Treat packages without build commands as virtual only if also lack install commands, as some non-virtual packages might only have install commands. (tarides/opam-monorepo#376 @Leonidas-from-XIV, @gridbugs) - Improve the ordering of package candidates by putting broken packages at then end of the list (tarides/opam-monorepo#395, tarides/opam-monorepo#397, @samoht) ### Removed ### Security
CHANGES: ### Added - Display warning when a package to be locked is missing a `dev-repo` field and is being skipped because of it (tarides/opam-monorepo#341, tarides/opam-monorepo#362, @kit-ty-kate, @Leonidas-from-XIV) - Add option `--keep-symlinked-dir` to preserve symlinks in `duniverse/`, which can be useful for local development. (tarides/opam-monorepo#348, tarides/opam-monorepo#366, @hannesm, @Leonidas-from-XIV) - Adopt the OCaml Code of Conduct (tarides/opam-monorepo#391, @rikusilvola) - Add solver tests (tarides/opam-monorepo#394, @samoht) ### Changed - Canonicalize the URLs of the OPAM `dev-repo` fields to be able to detect more semantically equivalent URLs, this should reduce the risk of build failures due to duplicate code pulled (tarides/opam-monorepo#118, tarides/opam-monorepo#365 @TheLortex, @Leonidas-from-XIV) - Simple the error message printed when dependencies don't use dune as their build system. The opam-0install diagnostic message is no longer printed in this case and the message has been reformatted and reworded to make the salient information easier to see. (tarides/opam-monorepo#384, @gridbugs) - Encode `dev-repo` constraints in the opam solver - this allows to resolve more involved version constraints that were failing before (tarides/opam-monorepo#396, @samoht) ### Deprecated ### Fixed - Error in case where multiple packages with different dev-repo fields would be placed in the same duniverse directory (tarides/opam-monorepo#377, @gridbugs) - Fix a failure when using opam-monorepo with an opam 2.2 root (tarides/opam-monorepo#379, @kit-ty-kate) - Fix assertion failure when prefix of "lock" subcommand is used (tarides/opam-monorepo#381, @gridbugs) - Treat packages without build commands as virtual only if also lack install commands, as some non-virtual packages might only have install commands. (tarides/opam-monorepo#376 @Leonidas-from-XIV, @gridbugs) - Improve the ordering of package candidates by putting broken packages at then end of the list (tarides/opam-monorepo#395, tarides/opam-monorepo#397, @samoht) ### Removed ### Security
CHANGES: ### Added - Display warning when a package to be locked is missing a `dev-repo` field and is being skipped because of it (tarides/opam-monorepo#341, tarides/opam-monorepo#362, @kit-ty-kate, @Leonidas-from-XIV) - Add option `--keep-symlinked-dir` to preserve symlinks in `duniverse/`, which can be useful for local development. (tarides/opam-monorepo#348, tarides/opam-monorepo#366, @hannesm, @Leonidas-from-XIV) - Adopt the OCaml Code of Conduct (tarides/opam-monorepo#391, @rikusilvola) - Add solver tests (tarides/opam-monorepo#394, @samoht) ### Changed - Canonicalize the URLs of the OPAM `dev-repo` fields to be able to detect more semantically equivalent URLs, this should reduce the risk of build failures due to duplicate code pulled (tarides/opam-monorepo#118, tarides/opam-monorepo#365 @TheLortex, @Leonidas-from-XIV) - Simple the error message printed when dependencies don't use dune as their build system. The opam-0install diagnostic message is no longer printed in this case and the message has been reformatted and reworded to make the salient information easier to see. (tarides/opam-monorepo#384, @gridbugs) - Encode `dev-repo` constraints in the opam solver - this allows to resolve more involved version constraints that were failing before (tarides/opam-monorepo#396, @samoht) ### Deprecated ### Fixed - Error in case where multiple packages with different dev-repo fields would be placed in the same duniverse directory (tarides/opam-monorepo#377, @gridbugs) - Fix a failure when using opam-monorepo with an opam 2.2 root (tarides/opam-monorepo#379, @kit-ty-kate) - Fix assertion failure when prefix of "lock" subcommand is used (tarides/opam-monorepo#381, @gridbugs) - Treat packages without build commands as virtual only if also lack install commands, as some non-virtual packages might only have install commands. (tarides/opam-monorepo#376 @Leonidas-from-XIV, @gridbugs) - Improve the ordering of package candidates by putting broken packages at then end of the list (tarides/opam-monorepo#395, tarides/opam-monorepo#397, @samoht) ### Removed ### Security
Convert the constraint "if X and Y are from the same repository" into a conflict relationship in the opam metadata between
X
and all the version ofY
which do not have the same exact version asX
.This allow to remove the adhoc post-processing of opam solution which was going very wrong in lots of case. Hopefully, the results will now be much closer to what you would expect
opam
to produce.