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

add a way to share Cargo.lock information #4353

Closed
metajack opened this issue Aug 2, 2017 · 17 comments
Closed

add a way to share Cargo.lock information #4353

metajack opened this issue Aug 2, 2017 · 17 comments
Labels
A-crate-dependencies Area: [dependencies] of any kind C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update

Comments

@metajack
Copy link

metajack commented Aug 2, 2017

We would like some way for a crate to depend on libservo and inherit (in some fashion) the pinned dependencies. Currently libraries have their Cargo.locks ignored, which is the correct behavior, but there are special cases where this doesn't work, and Servo's dependence on pinned versions of nightly Rust are one of these cases.

At the Mozilla All Hands this was discussed and a cargo update --lockfile was proposed.

@metajack
Copy link
Author

metajack commented Aug 2, 2017

cc @shinglyu @paulrouget

@alexcrichton
Copy link
Member

One thing which may work today (I'd have to check) is to just copy some other project's Cargo.lock into the current directory. In theory that should work just fine and the next cargo build will simply update the lock file accordingly, doing rough conservative updates where it can (and sticking to what's in the lock file if it can).

Maybe worth testing?

@paulrouget
Copy link

This is what we do as of now, and it works.

The problem is that we have to manually copy and update the lock.

@alexcrichton
Copy link
Member

Oh awesome! In that case this should be a very easy feature to implement! We'd just need to add a flag and thread it through.

@paulrouget
Copy link

How would cargo update --lockfile work?

Let's imagine I put together a rust project that depends on the libservo crate, I want the Cargo.lock of my project to use the libservo lock file. So I would do cargo update --lockfile libservo ?

@alexcrichton
Copy link
Member

Oh I'm thinking that you'd have a checkout of the Servo lockfile somewhere locally, so you'd do somethign like cargo update --start-from path/to/servo/Cargo.lock (or something like that)

@metajack
Copy link
Author

Is it possible we could specify it from a dependency? So you could do cargo update --start-from servo?

@alexcrichton
Copy link
Member

I think it may be pretty tricky to get that working. Cargo doesn't even know what the crate servo is until it's halfway through resolution, and if it found at that point a Cargo.lock it'd have to abort everything and restart. From a conceptual point of view I think it'd make more sense to take a raw file, but I can see from a UI perspective it'd be nicer to take a crate on crates.io.

@metajack
Copy link
Author

What about putting in a git url to the project? File system is so clumsy. I don't have particular suggestions on mechanism, but I would like it not to be point to a file deep in some tree. For starters, what if you don't have servo checked out?

@tschneidereit
Copy link

Cargo doesn't even know what the crate servo is until it's halfway through resolution, and if it found at that point a Cargo.lock it'd have to abort everything and restart.

How long does it take to get to that state, for a decent-sized Cargo.toml file? If it's still (maybe even dozens of) seconds, perhaps worth considering?

I get that it's conceptually dissatisfying, but I don't think it's too hard to reason about from a user's point of view (which otherwise I'd be concerned about.)

@shinglyu
Copy link

GitHub seems to have an API to get the file [0] (not sure about other git hosting sites). Maybe we can scan for Cargo.lock in the top level directory first and then download it to the right location? We don't need to do it recursively, right? Because the top-level Cargo.lock is flattened?

[0] https://developer.github.com/v3/repos/contents/#get-contents

@carols10cents carols10cents added A-crate-dependencies Area: [dependencies] of any kind C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update labels Aug 27, 2017
@dwijnand
Copy link
Member

I wonder: is this still a requirement for libservo users?

@paulrouget
Copy link

I wonder: is this still a requirement for libservo users?

Yes.

@samyak-jain
Copy link

Is this feature open for contributions?

@alexcrichton
Copy link
Member

I think this is still along the lines of a reasonable feature to contribute, but I don't think we know well enough what the feature should look like. The first thing to do here is to get a consensus about what the requirements are for a solution and then sketch what the solution might look like.

@epage
Copy link
Contributor

epage commented May 24, 2023

See also #5332

@epage
Copy link
Contributor

epage commented Oct 14, 2023

As this looks like a duplicate of #5332 and that one has the more interesting conversations, I'm going to close this in favor of that one. If there is a reason this should be open still, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crate-dependencies Area: [dependencies] of any kind C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-update
Projects
None yet
Development

No branches or pull requests

9 participants