-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Update replaced registry before search #5621
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
Update replaced registry before search #5621
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
c3525db to
ce0f05d
Compare
|
@alexcrichton just a friendly ping to keep this on your radar. |
|
@alexcrichton I'm glad that you are back now! At present, |
|
@knight42 the search API though isn't part of the replace-with business and is pretty specific to crates.io itself? |
|
Well yes.. but cargo now needs to update the local In addition, is it necessary to update the local |
|
Aha an excellent point! Hm though we don't necessarily want to stabilize the API of the registry yet, however. In that sense I wonder if this is a case where something like a proxy would be most useful? Is that possible to set up or is a dedicated registry server running inside of China? Currently Cargo only knows about the git index, it doesn't actually know about crates.io's URL or server. A |
|
Pulling the git repo through a proxy is workable, but that would require extra work on client side. Currently, If I understand correctly, @alexcrichton you do agree that we don't need to update a git repo before search, right? If so, I could implement such a method. |
|
@knight42 yeah I think we should probably implement "don't update the registry before search". If you're interested in implementing that I can try to help out! |
|
@alexcrichton Now if I don't update first, I cannot pass the tests, and it sounds reasonable to fetch the repo if it is missing on local machine. What if I update a repo only if it is missing? To be specific, I would call |
|
@knight42 excactly my thinking as well! And yeah I'd only update in the case of a config access error |
ce0f05d to
79d6228
Compare
|
@alexcrichton Done! |
|
The error seems spurious.. |
|
Thanks! Although this looks like it's still got the code to handle replaced registries, is that still needed? Additionally, could a test be added that the index isn't updated when it's already available? |
|
@alexcrichton I believe handling replaced registries is still necessary, because one may want to update the registry he specified in As for the test, I don't know how to create a local registry with available index, does testsuite provide such a utility? |
|
Ah ok I think I understand yeah, I think though in that case we'd want to move this logic to the And yeah the test suite in places like |
79d6228 to
0db28ca
Compare
|
@alexcrichton Sorry for the delay, have been busy these days. Now corresponding tests have been added, PTAL. |
|
☔ The latest upstream changes (presumably #5762) made this pull request unmergeable. Please resolve the merge conflicts. |
And update the replaced registry specified in `.cargo/config`
0db28ca to
7d279fe
Compare
|
@alexcrichton rebased |
|
@knight42 hm are the tests here hitting the actual crates.io registry? We try to avoid that when possible, but I think with the new logic it'll see through the redirection and go to crates.io, right? (sorry for the delay in taking a look!) |
|
@alexcrichton Of course not. I have added two tests: |
|
@bors: r+ Ok! |
|
📌 Commit 7d279fe has been approved by |
…richton Update replaced registry before search Close #5550. It seems that updating the replaced registry before search has not been well considered in cargo and I have to add a function to trait `core::source::Source` to get the replaced `SourceId`. I am not sure whether this is a good design, any advice is welcome.
|
☀️ Test successful - status-appveyor, status-travis |
Close #5550.
It seems that updating the replaced registry before search has not been well considered in cargo and I have to add a function to trait
core::source::Sourceto get the replacedSourceId.I am not sure whether this is a good design, any advice is welcome.