← Back to issue list

rust plugin: respect Cargo.lock if present in project

View original Github issue

Metadata

Project
snapcraft
Number
#2915
Type
pull request
State
merged
Author
cjp256
Labels
—
Created
Updated
Closed

Current evaluation

Merged as af326013a: standard Rust builds use Cargo.lock by passing --locked to cargo fetch and install. Follow-up #2917 corrected pull-time dependency fetching.

Resolution: closed resolved

Reason: PR #2915 was merged as af326013a, adding Cargo.lock-based --locked behavior with unit and spread tests. Follow-up PR #2917, commit 38928cd54, fixed the acknowledged builddir check so pull-time fetching used the locked dependencies.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged as af326013a: standard Rust builds use Cargo.lock by passing --locked to cargo fetch and install. Follow-up #2917 corrected pull-time dependency fetching.
stealth/space-bunny-alpha — closed resolved Merged #2915 (af326013a) to respect Cargo.lock with --locked; follow-up #2917 (38928cd54) fixed pull-time fetching of locked crates.
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.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/snapcraft#2917 (confidence 100%)

    Merged follow-up corrected pull-time crate fetching after #2915's author identified an incorrect builddir-based Cargo.lock check.

Related issues

Issue Project State Summary Similarity
#2917 rust plugin: fetch correct (locked) crates during pull snapcraft merged Merged PR #2917 (commit 38928cd54) fixed Rust pull-time crate fetching by checking Cargo.lock in the source directory and strengthened the spread test.
82%
#1561 rust plugin: record the Cargo.lock file snapcraft merged Merged PR #1561 as commit 57e9e320a, adding Cargo.lock recording to the Rust plugin as part of the #1475 build-recording work.
76%
#1862219 Snapcraft Rust Plugin Does not Respect Cargo.lock snapcraft (launchpad) closed Rust plugin now honours Cargo.lock: merged snapcore/snapcraft#2915 (af326013a) passes --locked to cargo fetch/install, with pull-stage fix in #2917 (38928cd54); shipped in Snapcraft 3.10.
74%