-
Notifications
You must be signed in to change notification settings - Fork 2.6k
cargo vendor
misses some files
#14034
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
Comments
cargo vendor
misses somr filescargo vendor
misses some files
As a quick sanity check kramdown-syntax_tree_sitter is locked to docs.rs shows that [email protected] does include that folder |
I just tried to reproduce this with |
ack, I tried cargo 1.76 and 1.77. Let me try 1.78 |
@epage Still fails for me. Here's my new
|
This is still failing for me on Cargo 1.79:
|
The problem is that There are a few issues here:
|
Oh, I remember now. It was #12509 (comment). Unfortunately based on that comment, it sounds like it might not be easy. |
### What does this PR try to resolve? `PathSource::list_files` has some heurstic rules for listing files. Those rules are mainly designed for `cargo package`. Previously, cargo-vendor relies on those rules to understand what files to vendor. However, it shouldn't use those rules because: * Package extracted from a `.crate` tarball isn't Git-controlled, some rules may apply differently. * The extracted package already went through `PathSource::list_files` during packaging. It should be clean enough. * Should keep crate sources from registry sources in a pristine state, which is exactly what vendoring is meant for. Instead, we switch to direct extraction into the vendor directory to ensure source code is the same as in the `.crate` tarball. ### How should we test and review this PR? There is already a test `vendor::package_exclude` for the fix of #9054, though now I think it is not a good fix. The test change shows the correct behavior change. I am not sure if we want more tests. Also, there are some caveats with this fix: * The overwrite protection in `unpack_package` assumes the unpack directory is always `<pkg>-<version`>. We don't want to remove this, but for cargo-vendor supports vendoring without version suffix. For that case, we need a temporary staging area, and move the unpacked source then. * The heurstic in `PathSource::list_files` did something "good" in general cases, like excluding hidden directories. That means common directories like `.github` or `.config` won't be vendored. After this, those get included. This is another round of churns. We might want to get other `cargo-vendor` changes along with this in one single release. ### Additional information * Fixes #9054 * Fixes #9555 * Fixes #9575 * Fixes #11000 * Fixes #14034 * Fixes #15080 * Fixes #15090 This also opens a door for * #10310 * #13191 Since we are changing vendored source (again), we might want to remove the `.rej`/`.orig` special rules in cargo-vendor, as well as look into the new source-dedup vendor dir layout. <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [benchmark-result](#15514 (comment)) by [weihanglo](https://github.com/weihanglo) Generated by triagebot, see [help](https://forge.rust-lang.org/triagebot/note.html) for how to add more <!-- TRIAGEBOT_SUMMARY_DATA_START$${"entries_by_url":{"https://github.com/rust-lang/cargo/pull/15514#issuecomment-2870275766":{"title":"benchmark-result","comment_url":"https://github.com/rust-lang/cargo/pull/15514#issuecomment-2870275766","author":"weihanglo"}}}$$TRIAGEBOT_SUMMARY_DATA_END --> <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
Problem
I'm trying to build this Cargo project with vendored deps. I'm able to build it normally (
cargo build
), and runningcargo vendor
exits without an error, but building using the vendored deps fails (cargo build
after modifying.cargo/config.toml
).It's pretty clear why it fails to build —
cargo vendor
hasn't copied thesrc/generate/templates
directory of thetree-sitter-cli
dependency, so I see a bunch of errors due toinclude_str!
trying to include nonexistent files.I'm not a Cargo expert, so I might be missing something, but I didn't see any reason why vendoring the dependencies would
miss this subfolder. Hopefully you can point me in the right direction if there's something obvious I missed.
Steps
git clone https://github.com/andrewtbiehl/kramdown-syntax_tree_sitter
cd kramdown-syntax_tree_sitter/ext/tree_sitter_adapter
RUBY=/path/to/bin/ruby cargo build
(observe that this succeeds)cargo vendor
(observe that this appears to succeed).cargo/config.toml
as directed by the output ofcargo vendor
cargo build
(observe that this fails)vendor/tree-sitter-cli/src/generate/templates
, although it does exist in the upstream repoPossible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: