You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The specific case I'm hoping to help for involves running cargo builds in containers. In my case, I'm building system packages for Rust binaries, but I can imagine this being useful for cases like CI as well.
Basically, between builds of the same crate, it's appropriate to cache the results of cargo fetch to avoid downloading every time a build is triggered. However, between builds of different crates, you may not have a specific Cargo.toml to run cargo fetch for, even though the crate index itself still may need to be updated.
It would be useful to be able to run some command that would update the index for a registry (defaulting to crates.io) without having to run some other operation like cargo fetch, so that this command can be run ahead of running any crate-specific operations. In my case, this means I'd be able to share the crates.io cache between builds for crates instead of having to download it every time.
Proposed Solution
Ideally, there would be a command cargo update-index (name doesn't matter too much) that would accept the --registry and --index options from cargo install, but not actually perform anything other than a registry index update. It should work without any options to just update the crates.io index to the default location.
Notes
No response
The text was updated successfully, but these errors were encountered:
A workaround is, like you said, using cargo install to install a lib crate. For instance, the following command will fail after updating the registry index (empty-library is preserved by rust-lang):
Problem
The specific case I'm hoping to help for involves running cargo builds in containers. In my case, I'm building system packages for Rust binaries, but I can imagine this being useful for cases like CI as well.
Basically, between builds of the same crate, it's appropriate to cache the results of
cargo fetch
to avoid downloading every time a build is triggered. However, between builds of different crates, you may not have a specificCargo.toml
to runcargo fetch
for, even though the crate index itself still may need to be updated.It would be useful to be able to run some command that would update the index for a registry (defaulting to crates.io) without having to run some other operation like
cargo fetch
, so that this command can be run ahead of running any crate-specific operations. In my case, this means I'd be able to share the crates.io cache between builds for crates instead of having to download it every time.Proposed Solution
Ideally, there would be a command
cargo update-index
(name doesn't matter too much) that would accept the--registry
and--index
options fromcargo install
, but not actually perform anything other than a registry index update. It should work without any options to just update thecrates.io
index to the default location.Notes
No response
The text was updated successfully, but these errors were encountered: