-
Notifications
You must be signed in to change notification settings - Fork 116
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
Ptw/do not skeleton patches #70
Ptw/do not skeleton patches #70
Conversation
It's important that people don't use `./rust-patches` or `rust-patches/*`, since the first won't match the regex and the second the shell will expand.
Easier to use than manually specifying, but doesn't handle non-top-level cargo.toml patches.
I implemented this approach in d570ac4. I personally like it better since the patch information is already encoded in the Let me know what you think! I'm happy to either revert it or try to add support for non-top-level |
@LukeMathWalker what do you think of the test I added? Do you think it's enough of a minimal example? |
I have seen the PR but I haven't had time to review it yet @prestontw - I'll provide feedback here when I do :) |
Should we rely on conventions of users putting all of their patches in one location? As long as they aren't intermixed with their source, it should be pretty easy to guess.
Here are what I see as the pro's and con's of each of the different approaches:
Maybe a mix of the third and first row would be a good compromise? We try to infer the paths, but we give someone the option to override that list if they want. |
The first row is not an option I am afraid - I want to maintain a minimal CLI interface for Can you go into more details on
I am not sure I understand what you mean here. On top of the test, could you provide an actual minimal reproducible example as a GitHub repo? It would make it easier to understand the current failure mode as well (you mentioned compilation errors, but you didn't provide details about them). |
Sorry! I will try to clarify. The failure occurs when someone tries to reference something that we define in a
For
since we minify all I'll work on creating a minimal reproducible example! That should be clearer than my explanation. |
Hi @LukeMathWalker, sorry for the delay. It's been hard to find time to try to minimize the problem, so in the meantime, here are some compilation issues I'm running into:
We patched |
Now I got it 😁
Can you elaborate? Once again, an example would be ideal. |
I'll describe this with another example first, then create a minimal repo (just in case it's clear enough that a minimal repo isn't necessary). We patch
To try to rephrase
I, the user, now have to discover the internal, implicit dependencies between the members of the entire |
I think this is the part that confuses me - why is |
Or are we working under the assumption that the patched version of |
This is correct. At least for the example, (I realized that one of my earlier points isn't as painful since we can look in |
I've been looking into recreating the issue in another repo, and it looks like we "patched" the dependencies by copying their entire Separately, I'm going to look if a similar issue pops up with using |
In trying to recreate the issue, I've come across a separate issue using
After investigating, this seems the most appropriate to me too---I don't think it's worth trying to approximate the patch directory based off of a weird historical vendor. If it makes sense to you, I'll revert this PR to a point where it was using the second option, then potentially raise another PR to address the issue in https://github.com/prestontw/cargo-chef-vendored-repo. How does that sound? |
Sounds good to me! |
How do you imagine this working? I am checking |
We could try to determine local path dependencies by using patched crates' |
You are right unfortunately - the lockfile is not very helpful in this case. |
Do you think that the complexity of traversing manifests is worth it? The alternative is adding more directories to the patches section of a |
I think that tools like Another possible avenue: |
It is possible to do the same with the output of This take a couple of seconds, but it works, and handles patches and relative dependencies without having to parse Cargo.toml or .cargo/config etc. The risk is that the cargo metadata command might hunt for cargo configs that are outside your docker context root, so your recipe JSON might change based on what someone has in their ~/.cargo/config if you're really unlucky? Maybe that's not a problem for us? @prestontw I haven't looked at your code yet (I'm writing this on my phone) so I might be missing the point entirely. Do you think that this approach might solve the problem for you? |
Hmm, interesting! So in my particular case, rather than filtering based on whether the package is in Looking at the manifests' and pulling more directories in based on explicit paths sounds the most robust to me, but I'm curious what other people think. @alsuren am I understanding what you're suggesting? |
Closing as stale. |
I've verified that this addresses #64 locally.
I've also added a test!
My main repository has several patched dependencies.
cargo chef
would turn these dependencies'lib.rs
files into empty strings.This would cause compilation issues since code I had patched in was suddenly missing.
Edit: I've now taken the below alternative approach.
To avoid erasing the bodies of these dependencies, I've added anignore_regexes
parameterfor
Prepare
. I would specify... --ignore-regexes "rust-patches/*"
. It's important that I use neither"./rust-patches/*"
since that would be treated as a regex norrust-patches/*
since that would be expanded by the shell.An alternative approach would be to get this information automatically from sections of the
Cargo.toml
that contain
patch
. @LukeMathWalker what do you think of manually specifying directories to ignorevs inferring them from
Cargo.toml
?