Skip to content
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

Please provide a subcommand to refresh the crates.io index #3377

Closed
joshtriplett opened this issue Dec 8, 2016 · 11 comments
Closed

Please provide a subcommand to refresh the crates.io index #3377

joshtriplett opened this issue Dec 8, 2016 · 11 comments
Labels
A-new-subcommand Area: new subcommand

Comments

@joshtriplett
Copy link
Member

When writing other tools that use the cargo API, and that don't want to unconditionally update the crates.io index from the network, it would help to have a cargo subcommand that refreshes the crates.io index. That avoids having to add such a subcommand to every other such tool built on the cargo API.

@alexcrichton alexcrichton added the A-new-subcommand Area: new subcommand label Dec 9, 2016
@Eh2406
Copy link
Contributor

Eh2406 commented Oct 14, 2017

Or more generally an subcommand for querying the index, so we are not each reinventing it. Maybe move the index stuff into a crate, like the crates.io library. There is rust-crates-index but it is not kept up to date with how cargo maintains the index.

@Eh2406
Copy link
Contributor

Eh2406 commented Jan 31, 2018

Note that crater will in 178 use cargo search lazy_static as a way to get cargo to update the index. Then it will use the -Z no-index-update to skip checking if the index is still up to date.

@Arnavion
Copy link

Arnavion commented Aug 3, 2018

You can use cargo search --limit 0 instead of using a crate like lazy_static.

@nabijaczleweli
Copy link
Contributor

nabijaczleweli commented Sep 2, 2018

Since 5e680f2, cargo search will no longer update the registry. This has hit those users of cargo install-update who default to nightly so far, but will outright break every installation as that commits gets released down.

This also is a bug in cargo search: it doesn't provide accurate results. We either need a flag for cargo search to always update it, or another command to do so.

@Eh2406
Copy link
Contributor

Eh2406 commented Sep 3, 2018

cc #5621 where the logic for search was changed.
Note that one of the users of the search hack was crater, so when we have somthing that works, they need a PR. In the meantime @pietroalbini how big a deal is it that this is broken?

@pietroalbini
Copy link
Member

Uh, this means Crater won't update the registry when generating the lockfiles :/
While cargo update-registry rides the trains I guess we could use cargo install lazy_static, which should do nothing but update the registry (@Eh2406 want to send a PR to Crater?)

@epage
Copy link
Contributor

epage commented Dec 16, 2022

With the sparse registry, is this command still practical to add?

Note, we also have #11034

@epage
Copy link
Contributor

epage commented Oct 11, 2023

With this proposal being incompatible with sparse index, I'm closing this. We still have #11034 for the comment about querying the index. If there is a reason we should keep this open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
@japm48
Copy link

japm48 commented Oct 16, 2023

@epage

With this proposal being incompatible with sparse index, I'm closing this. We still have #11034 for the comment about querying the index. If there is a reason we should keep this open, let us know!

Could you elaborate on this incompatibility?
I have not read about the sparse index implementation, but I don't understand how there could not be a command that would, at least, check if a local copy of whatever was previously downloaded is outdated.

@epage
Copy link
Contributor

epage commented Oct 16, 2023

With the git-based registry, the index is downloaded all-or-nothing.

With the sparse registry, each package is kept in an individual file that is downloaded. What to download is context dependent.

You brought up the solution of "re-downloaded whats downloaded". That might work in your case but I suspect it won't work in enough other cases for such a feature to stand on its own. Something like #11034 indirectly offers a way of providing this functionality that adapts to the needs of the user.

@clarfonthey
Copy link
Contributor

In my case, the ability to download the index came from the fact that it was a substantial upfront cost that was useful to perform ahead of time as a cache-warming step. Now that this cost is effectively zero (when downloading dependencies, a majority of the cost is now the dependencies themselves, and not the index), I can rely on just downloading dependencies for crates as I need them.

So, I'm fine with the decision to say, this specific use case isn't necessarily needed, but general index introspection is still good. If you really wanted to download the source for a bunch of crates ahead of time without making a custom empty crate to handle this logic, for example, that would fit under that. Downloading just the index doesn't even solve that problem anyway, since the sources still have to be downloaded separately.

jfreuden added a commit to jfreuden/MicroSDeck that referenced this issue Feb 22, 2024
the cargo search doesn't update the index and later in the thread is pointed out this is unnecessary now. Which is good because this doesn't work anymore
jfreuden added a commit to jfreuden/MicroSDeck that referenced this issue Feb 23, 2024
According to rust-lang/cargo#3377 (comment)
the cargo search doesn't update the index and later in the thread is pointed out this is unnecessary now. Which is good because this doesn't work anymore
CEbbinghaus pushed a commit to CEbbinghaus/MicroSDeck that referenced this issue Feb 25, 2024
* Change the build-docker.sh file to return exit code from build
According to rust-lang/cargo#3377 (comment)
the cargo search doesn't update the index and later in the thread is pointed out this is unnecessary now. Which is good because this doesn't work anymore
* Version bump of Decky CLI to 0.0.2 should fix the Github Runner failing to register error status codes from `cargo build` in backend
CEbbinghaus added a commit to CEbbinghaus/MicroSDeck that referenced this issue Mar 1, 2024
* chore: moved version file
* chore: created symbolic link
* feat: upgraded logging and added config
* Fixed build errors
* Changed to Json logs & improved some events
* Replaced last references to log & expanded logging
* Fixed log level regression & formatted everything
* swapped version back keep original in backend
* bugfix: removed newline and fixed code to trim
* Added back trim fix
* Reset version to master
* chore: Fixed clippy lints
* Added scan interval to config
* Change the build-docker.sh file to return exit code from build (#18)
* Change the build-docker.sh file to return exit code from build
According to rust-lang/cargo#3377 (comment)
the cargo search doesn't update the index and later in the thread is pointed out this is unnecessary now. Which is good because this doesn't work anymore
* Version bump of Decky CLI to 0.0.2 should fix the Github Runner failing to register error status codes from `cargo build` in backend
* Refactored events
* chore: did some light refactoring
* chore: updated log
* chore: Updated Version
---------
Co-authored-by: jfreuden <jfreuden@alumni.cmu.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-new-subcommand Area: new subcommand
Projects
None yet
Development

No branches or pull requests

9 participants