Hello everyone,

I have committed myself to add dependency support for Cargo. The way Cargo
sources are currently implemented isn't right in my eyes and I have
discussed this with Brian and he said we would re-discuss it tomorrow, but
I live in a different time zone so I probably won't get hold of him. So I
have written up a rough proposal here <http://z0w0.me/cargo-proposal> because
I feel this should be proposed before I start trying to implement
dependencies in the current system. It's a bigger document than it should
be because I go on a bit.. but I'll summarise the general gist of it.

> Currently, each source contains a packages.json file. Whenever a new
package is added, the user would need to cargo sync the packages.json file.
This would also need to be done, if dependencies were implemented, whenever
a package has a new version. Coupled with the extremely bad usability of
this, with lots of packages, there could be quite large package.json files
if there are eventually thousands of packages. @brson suggested that it
could do a git pull so it only grabs changes, but this would not apply for
sources that don't run on git. The alternative is to not have a central
package and instead an API that sources follow (not really an API, as it
can be implemented with static files just like the current system can be
hosted on Github).

I propose the following:

<url>/source.json - access to a source's information (such as signing keys)
<url>/crates.json - access to a an array of all packages in the source (by
name), used by the cargo list feature
<url>/crates/<name>.json - access to a certain crate's information by name
(equivalent to the objects inside packages.json
OPTIONAL: <url>/crates/<uuid>.json - access to a certain crate's
information by uuid (will probably change)
OPTIONAL: all of the above files have a .sig file each. Only require if the
source.json file specifies a key.

This way it can still be used on Github, but can also be implemented
dynamically, so it's pretty much an `API`. e.g. we could still use
https://raw.github.com/mozilla/cargo-central/master<https://raw.github.com/mozilla/cargo-central/master/packages.json>
as
the source URL, and then have a source.json file, a crates.json file and
then have crates/rustray.json files.

tl;dr - I am proposing that Cargo does not have a single packages.json as
this requires syncing every time there is a version or other info change
for a single package. Instead, the information for a package is accessed
when it is being installed. This document also discusses how I intend to
implement dependencies and correct un-installation (it does weak pattern
matching now).

I am willing to meet halfway and implement both `offline` (old) and
`online` (mine), but I don't think it would be a good idea.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to