rust plugin: respect Cargo.lock if present in project
Metadata
Current evaluation
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.
Suggested action: —
No scores available.
Issue body
Rust workspaces already support Cargo.lock, but standard builds
do not. If "Cargo.lock" is present, add the "--locked" flag
to `cargo fetch` and `cargo install` commands.
Add unit tests and spread test for verification.
LP #1862219
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 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to add the --locked flag to cargo commands when Cargo.lock exists. The author later acknowledged a flaw causing incorrect dependency fetching and planned a follow-up PR to correct the build directory check. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds the --locked flag to cargo commands when Cargo.lock exists. Author later identified a builddir check bug causing incorrect dependency fetching and plans a follow-up fix. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2917 rust plugin: fetch correct (locked) crates during pull | snapcraft | merged | 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. | |
| #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). | |
| #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. |