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

Include registry names in cargo metadata output #9052

Open
sunshowers opened this issue Jan 7, 2021 · 1 comment
Open

Include registry names in cargo metadata output #9052

sunshowers opened this issue Jan 7, 2021 · 1 comment
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata

Comments

@sunshowers
Copy link
Contributor

Describe the problem you are trying to solve
For some automated tooling built on top of guppy, I'd like to be able to reconstruct Cargo.toml dependency lines from cargo metadata output. This is possible to do for crates.io, path and Git dependencies, but doesn't appear to be possible to do for non-default registries.

Specifically, the bit that's missing is the name of the registry. The output format has a "registry" field in the dependencies section, but that contains the URL and not the name. The URL cannot be specified in Cargo.toml's registry field -- it must be a name.

Describe the solution you'd like
There's a few ways to do this, but I think the cleanest way would be to add a new top-level section to cargo metadata output, say registries, which has:

  • the default registry along with its URL (typically crates.io but could be something else)
  • any other registries in use along with their URLs.
  • possibly other details about each registry?
@sunshowers sunshowers added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 7, 2021
@sunshowers
Copy link
Contributor Author

sunshowers commented Jan 7, 2021

I guess another way would be to include the registry name in each URL (e.g. "registry+https://github.com/crates.io/index?name=crates-io", though that's a bit more of a breaking change.)

edit: I think this might be the correct way to do it, actually -- not sure if you can specify multiple registry names with the same index, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-metadata
Projects
None yet
Development

No branches or pull requests

2 participants