I have a project which uses cargo metadata to look up information about a crate's dependency tree. I seem to be falling into a gap between what's in the local copy of the index, and what's exposed through cargo metadata.
In particular, I'm looking to get the cksum for the crate's deps. AFAICT cargo metadata doesn't return this.
I found https://github.com/ehuss/cargo-index/tree/master/reg-index which implements this functionality for non-bare indexes, but it appears to assume that the working directory has materialised with a view of of a ref, rather than going via the git APIs which cargo itself appears to do since https://github.com/rust-lang/cargo/pull/4026. I'd be happy to add bare git support if it could be implemented in a way which should continue working in the future.
A few specific questions:
- Is there an easy way of getting the
cksumof a crate which I've overlooked, ideally using local data? - How stable is the git directory location, layout, and object format intended to be? AFAICT
cargo metadatayields amanifest_pathalong the lines of~/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-0.4.6/Cargo.tomland that can be trivially transformed into~/.cargo/registry/index/github.com-1ecc6299db9ec823where you cangit show origin/master:it/oa/itoawhich yields JSON-per-version. Which of these things is it reasonable to rely on?