Skip to content

Support for (or documentation for) multiple "directory" type registries #10045

Open
@gspr

Description

@gspr

Problem

I often find it desireable to replace source.crates-io with a local registry. Thanks to source replacement, that's as easy as:

[net]
offline = true

[source]

[source.crates-io]
replace-with = "local-replacement"

[source.local-replacement]
directory = "/a/local/directory"

Here, /a/local/directory is simply a directory containing directories of the form cratename-version, each one of those containing the source code for a crate at a fixed version. Cargo will then not reach out to crates.io to find dependencies, but rather look only in that directory.

It seems unclear from the documentation whether one can add more such directories for other dependencies, and have those checked whenever a dependency cannot be satisfied by the one in source.local-replacement. One way seems to be to set up a full-blown secondary registry locally, which feels like a massive overkill for a reasonably simple task other programming language tooling can do. And it seems like Cargo must already have the functionality to treat a simple filesystem directory as a registry (for the purposes of source replacement at least).

Proposed Solution

It would be extremely convenient to be able to specify another stanza like

[source.more-crates]
directory = "/another/local/directory"

and have Cargo look there for dependencies that it cannot satisfy from source.local-replacement.

Notes

It is unclear to me whether this is a problem of Cargo's capabilities (in which case this is a feature request), Cargo's documentation (in which case this a documentation bug report) or me (in which case this is a cry for hel… I mean support request).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-directory-sourceArea: directory sources (vendoring)C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions