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

Cargo update doesn't look for overrides in the config file #1103

Closed
Manishearth opened this issue Dec 30, 2014 · 13 comments
Closed

Cargo update doesn't look for overrides in the config file #1103

Manishearth opened this issue Dec 30, 2014 · 13 comments

Comments

@Manishearth
Copy link
Member

This makes it a bit hard to work on rust upgrades locally, since cargo update provides convenient way of updating the lockfiles to specific hashes. However, if the hash doesn't exist in the github repo, it fails to update the lockfile with this error:

$ cargo update -p html5ever --precise 497339bd717fcd78451139a1d8ddc3d6d5836842 --verbose
    Updating git repository `https://github.com/servo/html5ever`
Unable to update https://github.com/servo/html5ever#497339bd

Caused by:
  [4] Revspec '497339bd717fcd78451139a1d8ddc3d6d5836842' not found.

This happens even if the hash exists in the local repo that the config paths key points to.

(Manually updating the lockfile and building works fine, since cargo build does look for overrides)

Manishearth added a commit to Manishearth/cargo that referenced this issue Dec 30, 2014
@Manishearth
Copy link
Member Author

I tried fixing this myself with this WIP, but it still isn't working. Not sure what I should be doing here.

@Manishearth
Copy link
Member Author

I guess to fix this Dependency::get_source_id() or something should be aware of the overrides.

@alexcrichton
Copy link
Member

I'm not sure I quite follow, but it looks like you're running cargo update, requesting a non-existent revision in a remote repository? Cargo needs to fetch the repository to learn about dependencies, so how could it ignore the fetch error?

@Manishearth
Copy link
Member Author

When there is a path override it shouldn't have to fetch the repo, right?

@alexcrichton
Copy link
Member

The purpose of cargo update is to update the lockfile, which doesn't take into account path overrides, requiring that the repo be fetched.

@Manishearth
Copy link
Member Author

@alexcrichton Can there be some other way to work on dependencies without requiring a push everytime? For example, being able to specify [dependency.something] overrides in the Cargo config would work.

@alexcrichton
Copy link
Member

Sorry, but I can't quite grapple what your use case is here. Do you want to update the Cargo.lock as-if all upstream repositories have their information, but you don't want to actually push any of that information?

I would like to support overrides in the manifest, but that seems orthogonal to the issue here.

@Manishearth
Copy link
Member Author

@alexcrichton say I'm doing a rust upgrade (or some sort of dependency
changes) and I'm trying to get a package to work. This package is used by many other dependencies (so updating all the Cargo.toml files to temporary take a local path is painful).

Basically, I want to be able to work on dependencies locally without having to edit toml files all over the place :)

@alexcrichton
Copy link
Member

That sounds like what the paths override in .cargo/config is for? Is that not working for you?

I would expect you to have a global ~/.cargo/config which has lots of path entries during a rust upgrade which are then all pushed at once.

@Manishearth
Copy link
Member Author

The path entries don't get updated via cargo update -p <package> --precise <hash> (so it stays locked on an old hash), cargo update instead looks for it in the main repo.

@alexcrichton
Copy link
Member

We talked about this on IRC and reached the conclusion that paths overrides are likely working as expected.

@Ericson2314
Copy link
Contributor

Do [replace] overrides work differently than this? Cargo weirdly fails to fetch me repos all the time.

@Ericson2314
Copy link
Contributor

Nevermind on the failure, old lockfile + force pushes was the issue and chucking the lockfile fixed it. Still, the fetches can sometimes be slow and it would be nice to avoid them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants