Open gspr opened 3 years ago
More discussion is at https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/clarifying.20sources
In case others need this, one can work around the problem quite easily using UnionFS/OverlayFS. Details here: https://stackoverflow.com/a/69977327
Short version: Create a new source with directory = "/the/union"
, and use it as your source.crates-io
replacement. Then use UnionFS/OverlayFS to make /the/union
a union of /a/local/directory
and /another/local/directory
(with whatever priority order you prefer).
Problem
I often find it desireable to replace
source.crates-io
with a local registry. Thanks to source replacement, that's as easy as:Here,
/a/local/directory
is simply a directory containing directories of the formcratename-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
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).