rust plugin: fetch correct (locked) crates during pull
Metadata
Current evaluation
Merged fix for the rust plugin that corrected crate version fetching during pull by checking for Cargo.lock in the source directory instead of the build directory. Updated spread test to prevent regression.
Suggested action: —
No scores available.
Issue body
The previous PR was checking against the existence of the
Cargo.lock in builddir, which does not work at pull time.
So snapcraft it fetched the incorrect crate verisons at pull
time, but still built against the correct versions at build time.
Check for Cargo.lock in the source directory instead of the build
directory. This will work anytime after the rust project's sources
have been fetched.
Improve the spread test to hopefully capture this error by
ensuring that "time" is downloaded only once.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for the rust plugin that corrected crate version fetching during pull by checking for Cargo.lock in the source directory instead of the build directory. Updated spread test to prevent regression. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for the Rust plugin to fetch correct locked crate versions during pull. Changed Cargo.lock detection from the build directory to the source directory. Updated spread test to prevent regression. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for the Rust plugin checking Cargo.lock in the source directory instead of the build directory during pull. This ensures correct crate versions are fetched. Updated spread test verifies the fix. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2915 rust plugin: respect Cargo.lock if present in project | snapcraft | merged | Merged PR adds --locked flag to Rust plugin cargo commands when Cargo.lock exists. Author noted a timing bug where the lockfile check occurs too late for fetch, causing incorrect dependency resolution. A follow-up PR will fix it. | |
| #1561 rust plugin: record the Cargo.lock file | snapcraft | merged | Merged to record the Cargo.lock file in the Rust plugin, addressing issue #1475. Approved by two reviewers, passed CI checks, and modified two files (+85/-21 lines). | |
| #2170 rust plugin: fix cargo builds and run tests | snapcraft | merged | Merged fixes for cargo builds in the Rust plugin along with new tests. The change updated two files with 41 additions and 10 deletions, achieving 100% diff coverage. | |
| #2158 rust plugin: fix cargo builds and run tests | snapcraft | closed | Changes to fix cargo builds and add tests to the Rust plugin were closed and superseded by PR #2170 after the author discovered cargo test conflicts with cross-compilation, requiring a rework. |