-
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
Add an API to generate registry index data #4497
Comments
In order to test out #4506, I've created a minimal registry! The part that this proposed command would create is this file's contents, given the current crate. I don't think we envision people running this command and doing something manually with the output, though that will be possible. The main goal is to enable any tool to be able to create the same registry entries that crates.io creates right now, without needing to run all of crates.io. |
@carols10cents from what I can tell #4506 deals with |
Yes, #4506 is only tangentially related-- someone on gitter was asking for an example of what a "minimal registry" would look like and what this command needs to generate, and #4506 had just happened to prompt me to do just that :)
Cargo can be used as a dependency, and someone on gitter also suggested adding a public API function that returns the text this command would output, so I think that would work. Does that sound ok? |
I started to look into it. |
What would be the best way to calculate the checksum? Edit: I noticed that the hash changes on every |
@carols10cents Do you have strong opinions on whether this should live as a cargo subcommand or a separate package we publish to crates.io? My only concern is that cargo could become one of those tools where you type |
I guess I don't feel super strongly about whether this is part of cargo or external, but it should be in the rust-lang org and it's seeming like having a library with a public api function as well as a binary would be useful... |
I definitely agree about both of those points. |
So where should it be? |
Is anyone actively working on this, if not then I may make a start on a new crate to add the interface, this way it makes it a lot easier for versioning the interface for external crates to use (not to mention the reduction in time as cargo takes ages to compile when you are only needing a tiny amount of the function). |
I'd like to but no one answered me here or in gitter, and I don't want to make such important decisions by myself. |
After taking a look it would seem to me more useful to have a command which adds the entry in a git registry directly, for example this code. It just seems to me like anyone who uses a command to generate the fragment of index would need to also perform the following:
That seems like a bunch of code which has already been written that anyone who uses the new command will also need to write (or copy). Is there some use case which I am missing? |
We don't want it to do things that are highly contextual to specific users. Possibly it could make a git commit for you, but definitely not pull or push, since those involve questions of which remote is the source of truth, and what authentication do you use. |
Leaving out the pull and push and just updating a git repo would still make for quite a clean split, rather than spreading the knowledge of the registry layout around different crates. |
I have implemented a working prototype here: https://github.com/synek317/cargo/tree/synek317_generate_index_metadata I decided to create |
Any updates on this? |
@hallfox have you checked my branch? I think it is ready but unfortunately I had no time to push it. |
with this issue resolved, would we entreprise users, trying to use rust behind a firewall, with access to an artifactory server, be finally able to use rust? we have no access whatsoever to crates.io. |
Yeah, I have seen it, was waiting for when you'd open a PR! Do you feel
it's ready yet, or is there some blocker?
…On Thu, Jun 21, 2018, 2:02 AM synek317 ***@***.***> wrote:
@hallfox <https://github.com/hallfox> have you checked my branch? I think
it is ready but unfortunately I had no time to push it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4497 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEfkSyl-BaOBPYfbbq-fpHbpiirAGHNTks5t-zbXgaJpZM4PZeP->
.
|
Actually, I was blocked with two things (+ time):
|
@synek317 have you had time to continue with this? |
Rather than implementing this in-tree, I have posted an experimental subcommand which relies on |
@ehuss this is not a good solution. I mean, I was also concerned if generate-index-metadata should be included in cargo or in subcommand as you can see in my comment above. Anyway registry structs are currently defined in crates.io and in cargo, as carols10cents pointed it out in the first comment. Instead of unifying it, you are adding another copy. I've also some personal objections because now someone's effort (mine or yours, probably mine) will be wasted. If anyone had answered my previous question, I could just move it to the subcommand. Not even mentioning that your implementation is something different than @carols10cents was asking in the first comment. |
@synek317 I apologize for the lack of coordination. The code I posted is not intended to be a permanent solution. It was intended to explore what would be needed to support this functionality outside of Cargo, and to gauge the utility. The Cargo team is actively discussing the possibility of reorganizing some of the internals to make them more easily accessible in isolation and in a more stable form. However, it is not entirely clear, yet, exactly how that should appear, or how useful it would be. Different projects have different needs, so it's not always obvious how it should look and who it would serve. |
Given time has gone by, is there some feedback from people using https://crates.io/crates/cargo-index ? I have to say the docs didn't happen to mention it or I would have tried it out months ago. Maybe cargo local-registry should mention it in the alternatives section on their readme? |
See RFC 2141 for more details/context.
Currently, the knowledge of what goes in the registry index in what format lives in crates.io:
In order to support minimal registries, we'd like cargo to be able to generate the JSON information that should go into a registry for the current crate.
Cargo does already understand how to read these entries! We need to teach it how to create them as well :)
So as I understand it, this would involve:
Serialize
for theRegistryPackage
structgenerate-index-metadata
, that should:RegistryPackage
for the current crate, reusing code that sends relevant information to crates.io when appropriateThe text was updated successfully, but these errors were encountered: