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

Not clear how to [patch] sources other than crates-io #4499

Closed
frankier opened this issue Sep 16, 2017 · 5 comments
Closed

Not clear how to [patch] sources other than crates-io #4499

frankier opened this issue Sep 16, 2017 · 5 comments
Labels
A-documenting-cargo-itself Area: Cargo's documentation

Comments

@frankier
Copy link

So I think this might be a documentation bug rather than anything else. On the page: http://doc.crates.io/manifest.html#the-patch-section

Each key after [patch] is a URL of the source that's being patched, or crates-io if you're modifying the https://crates.io registry. In the example above crates-io could be replaced with a git URL such as https://github.com/rust-lang-nursery/log.

So after reading this, there are two thing you might try. If you're not that familiar with toml, then you might try the following:

[patch.https://github.com/rust-lang-nursery/log]
...

This is not valid toml. Another thing you might try is

[patch]
"https://github.com/rust-lang-nursery/log" = { log = { path = "/path/to/log/" } }

But this is ignored ("warning: unused manifest key: patch")

Ideally there would be a working example in the docs.

@alexcrichton alexcrichton added the A-documenting-cargo-itself Area: Cargo's documentation label Sep 16, 2017
@elidupree
Copy link

I was able to get this feature working by putting the URL in quotes:

[dependencies]
codecophony = {git = "https://github.com/elidupree/codecophony.git"}

...

[patch."https://github.com/elidupree/codecophony.git"]
codecophony = {path="/n/codecophony-share-build/codecophony"}

@Ericson2314
Copy link
Contributor

Ericson2314 commented Feb 2, 2018

With something like rust-lang/rfcs#1133 on the horizon, we will also have standard library deps. Eventually Cargo and the provided compiler will somehow negotiate to get Cargo any compiler-specific sources for standard library crates. But, figuring that out will involve many people and grind things to a halt. So the stop-gap solution in rust-lang/rfcs#1133 was to allow the user to [patch]-in standard library deps so that users can continue without this.

tl;dr, need to [patch] standard library deps.

@alexcrichton
Copy link
Member

I believe this was since documented, so closing.

@Ericson2314
Copy link
Contributor

@sjackman
Copy link

Patching dependencies does not work if it's for the same location but a different branch

See #5478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation
Projects
None yet
Development

No branches or pull requests

5 participants