-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Can't run cargo metadata --offline
with crates.io replaced with a git registry
#8704
Comments
I think there might be some confusion, a I'm a bit unclear why you can access the network to clone the index, but then can't access it to do other operations? If you can access the network beforehand, I would suggest running |
Why would it need to download all the dependencies to display the metadata? Isn't a registry enough?
That's because the index is a single location, the sha256 of which can be easily pinned. That can't be said about output of arbitrary |
It is not. There is data in Cargo.toml that is not sufficiently tracked in the index. |
Can you explain what that data is or at least point me at somewhere I can look for it? |
There is a lot of information about a package displayed in the metadata output (documented in https://doc.rust-lang.org/cargo/commands/cargo-metadata.html) which is not in the index (documented in https://doc.rust-lang.org/cargo/reference/registries.html#index-format). There are some other fields, like |
Ok, thanks! |
I guess the question then boils down to whether adding an "offline" mode (one where only information from the index is displayed) to cargo-metadata would be acceptable. Or, I guess, we could fetch all of the sources on Nix side, place them somewhere Cargo can find them and then run cargo metadata. |
I have ended up going with the second solution
|
It looks like @balsoft's solution is the way to go here. Closing. |
Problem
In an attempt to resolve nix-community/crate2nix#148, I am trying to generate cargo metadata jsons using
cargo metadata --offline
. I need to run this usingnix
derivations, however, which run in sandbox environments without internet access. As a consequence I have not been able to runcargo vendor
orcargo local-registry
.Instead, I have tried using a local mirror of rust-lang/crates.io-index, and specified in
.cargo/config.toml
to replacecrates.io
with that mirror. However, whilecrates.io
supports checksums, my local mirror does not.Steps
https://github.com/rust-lang/crates.io-index
:crates.io
with the local mirrorcargo metadata --offline
:Notes
Output of
cargo version
:cargo 1.45.1 (f242df6ed 2020-07-22)
The text was updated successfully, but these errors were encountered: