← Back to issue list

rust plugin: fix cargo builds and run tests

View original Github issue

Metadata

Project
snapcraft
Number
#2158
Type
pull request
State
closed
Author
tismith
Labels
—
Created
Updated
Closed

Current evaluation

PR closed as superseded: the rust-plugin-improvements branch was deleted and the work was reworked and merged as snapcore/snapcraft#2170 (commit 4f80a1051) after cargo test broke cross-compilation.

Resolution: closed superseded

Reason: The original branch rust-plugin-improvements was removed (Travis could no longer clone it), and the author plus maintainer re-created the patch as #2170, which was merged as commit 4f80a1051, skipping cargo test when cross-compiling. The author closed #2158 pointing to #2170.

Evaluated by: mr-cal-bot

No scores available.

Issue body

This patch changes it so that we run all instances of cargo using the build environment. Fixes cases where a snap cleanbuild will error out with rustc being unable to be found during the pull step. This is the issue I asked for help with on the forum: [https://forum.snapcraft.io/t/problem-building-rust-based-snap/5776](https://forum.snapcraft.io/t/problem-building-rust-based-snap/5776) Also adds 'cargo test' to the build step, to fail the build if the tests aren't passing. Rust plugin unittests have been updated. - [ ] 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/)? - [ ] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [ ] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded PR closed as superseded: the rust-plugin-improvements branch was deleted and the work was reworked and merged as snapcore/snapcraft#2170 (commit 4f80a1051) after cargo test broke cross-compilation.
stealth/space-bunny-alpha — closed superseded Superseded by snapcore/snapcraft#2170, which reworked the patch to skip cargo test during cross-compilation and was merged as 4f80a1051.
stealth/space-bunny-alpha — closed superseded Rust plugin patch was superseded by canonical/snapcraft#2170, merged as 4f80a1051, to fix Cargo build-environment handling and address cross-compilation when running tests.
qwen/qwen3.6-35b-a3b — — 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.
qwen3.6-35b-a3b-mtp-q6 — — Superseded by PR #2170. Changes to fix cargo builds and integrate tests were reworked to resolve cross-compilation conflicts and CI branch issues, then reopened as a new pull request.

Update history

No update history recorded yet.

Related work

  • Superseded By: snapcore/snapcraft#2170 (confidence 97%)

    Same title, reworked patch; merged as commit 4f80a1051 and present in snapcraft/plugins/rust.py history.

  • Related To: snapcore/snapcraft#2264 (confidence 45%)

    Later commit 'rust plugin: do not ignore the cross compile target (#2264)' further refined cross-compile handling in the same file.

Related issues

Issue Project State Summary Similarity
#2169 Rust plugin improvements snapcraft closed Closed unmerged and superseded by snapcraft#2170, merged as commit 4f80a1051 to fix Cargo builds and add Rust plugin tests.
82%
#2170 rust plugin: fix cargo builds and run tests snapcraft merged Merged as commit 4f80a1051, fixing Rust plugin Cargo builds, skipping tests during cross-compilation, and adding tests.
81%
#1825858 rust plugin crashes when trying to rebuild a snap package snapcraft (launchpad) closed Rust plugin rebuilt via `cargo install` without `--force`, so re-running snapcraft failed. Fixed by merged PR snapcore/snapcraft#2620 (commit 601bd2df7), which adds `--force` to cargo args.
76%
#579 Add new plugin: rust snapcraft merged Merged PR #579 as commit 24f1def33, adding Snapcraft's Rust plugin, resolving conflicts, and updating plugin-list test expectations.
75%
#570 rust_plugin: multiple fixes (#560) craft-parts merged Merged backport #570 (8d87e98e) of #560: the Rust plugin now removes compiler plugins from final Snaps and drops a redundant channel override.
74%
#2434 rust plugin: refactor to use the latest rustup snapcraft merged Merged PR #2434 in commit 3e821ca8d, updating the Rust plugin for current rustup, sharing toolchain storage, and adopting .cargo/config.
73%
#198 plugins: rust craft-parts merged Merged PR #198 (bb92a132) ported Snapcraft’s Rust plugin into craft-parts for CRAFT-955 after prerequisite test refactor #199.
73%
#4297 Rust plugin: rewrite the Rust plugin for core20 snapcraft merged Merged as snapcore/snapcraft#4297 (b357ef5e7): added a core20 Rust plugin on the new plugin system with LTO, toolchain selection, and default-feature controls.
73%
#1654764 The rust plugin is not using the Cargo.toml from the part dir snapcraft (launchpad) closed Fixed by snapcore/snapcraft#1035, merged as commit 3f3673536 "rust plugin: use the part source path", so the Rust plugin builds in the part source dir and Cargo.lock lands there instead of the repo.
72%
#1852545 rust plugin build fails due to wrong env var snapcraft (launchpad) closed Fixed in snapcore/snapcraft#2849 (commit 0b2fdb72b) by separating CARGO_HOME and RUSTUP_HOME; the change was tracked as part of Snapcraft 3.10.
72%