Open Eh2406 opened 4 years ago
To summarize the comments from https://github.com/pubgrub-rs/pubgrub/issues/39 so far:
mpizenberg: https://github.com/pubgrub-rs/pubgrub/issues/39#issuecomment-710786729
It seems that a patch replaces directly the list of existing versions of a package by one explicitely provided in the patch. I tend to believe this is then just a matter of doing exactly that a DependencyProvider
implementation.
Are the versions specified authorized to be new (non-existing in crates)? If not, this is just a matter of adjusting the get_dependencies
method of a DependencyProvider
implementation. If yes, it also needs to adjust the list_available_versions
.
I think the bugs in Cargo's resolver have to do with the fact that a selected version can report its package name, but with "replacements" that may not be the same as the name the dependency asked for. In pubgrub, thanks to @mpizenberg's foresight to use generics, we know that we never rely on V.get_package() == P
for anything, as we did not ask for a get_package
method.
As such I think you are wright, it is just technical complexity in the implementation of a DependencyProvider
"replacements" (in cargo the patch section and the replace) are a way to substitute the code for one package with some other code. In dart it is called dependency-overrides
This issue is to split off and continue the conversation from https://github.com/pubgrub-rs/pubgrub/issues/39.