-
Notifications
You must be signed in to change notification settings - Fork 86
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
mkDummySrc doesn't behave well with manually filtered source #46
Comments
@winterqt totally random question, is the Cargo.lock file at the root of the filtered source? Right now |
Yup, it is, as is the |
Alright I've spotted the issue:
|
I assume you mean the hash in the store path for the final filtered source, right? Why is the root path taken into account anyways? Is that so the paths can be compared? As in, the prefix is stored, then stripped between two paths to compare, and if they don't match ( |
Yeah this is a very round-about way of avoiding I think I've found a potential solution, whenever we look for interesting files we should check if the input is a filtered source (and if so use |
When would it leave empty directories around? |
If you haven't read it already, hopefully this explains Nix's source filtering behavior (though the rest of the code block gives some extra context around what |
Just to make sure I'm understanding this correctly: the directory walking is done at eval time to prevent directories that we don't care about from being included during filtering (due to the top down lazy nature), right? |
Yes exactly! That prevents something like adding a new directory or changing an irrelevant file from invalidating the cache and rebuilding everything from scratch |
By the way, you're exactly right: see I'd be happy to write and test an implementation of this fix, and PR it if all goes well. |
Yep the original filter is honored and the dummy filter is layered on top!
Opened #47 with the fix which seems to work with my testing. Would you try it out and let me know if it works out? If it doesn't I would very much appreciate more tests if you have some to contribute ❤️ |
Using the following source filter as the argument to
crane.buildPackage
:results in the generated dummy source only containing
Cargo.toml
.I don't see anything in
mkDummySrc
that would be causing this behavior, and my filter is sane (I manually tested to make sure it contains bothCargo.toml
andCargo.lock
). My Crane input is at 223aaed. I've also confirmed that the given source works when not filtering.The text was updated successfully, but these errors were encountered: