← Back to issue list

cargo-use: support Rust workspaces better

View original Github issue

Metadata

Project
craft-parts
Number
#1217
Type
issue
State
open
Author
Saviq
Labels
—
Created
Updated
Closed
—

Current evaluation

Feature request: cargo-use plugin only supports a single crate (reads [package] from one Cargo.toml) and breaks on workspace crates that inherit metadata; proposal is a CARGO_PACKAGES key plus `cargo package --no-verify` build-override. Untriaged, no maintainer response.

Suggested action: needs triage

Reason: The issue has no labels, no assignee and zero comments, so no maintainer has assessed it — it is a valid, well-argued feature request but unactioned. Code confirms the gap: CargoUsePlugin._get_cargo_registry_dir_name() raises PartsError('Package section is missing in Cargo.toml file') when the root manifest is a virtual workspace, and get_build_commands() only ever copies one source dir, reproducing exactly the reported 'failed to find a workspace root' failure. The reporter supplied a concrete working build-override (CARGO_PACKAGES + `cargo package --no-verify` + checksum stub), which makes it easy to triage, but the actual plugin design (new property name, workspace version inheritance, per-crate packaging in a re-entrant build) is undecided, so it needs a maintainer to pick the API.

Evaluated by: mr-cal-bot

Impact: 55 Quick Win: 16 Complexity: 60 Confidence: 72 Actionability: 72

Issue body

### What needs to get done It's common for Rust repositories to contain multiple packages/crates in a single workspace. The `cargo-use` plugin needs to better support this. `crate package` is the standard way to "render" a crate standalone, and here's a `build-override` that works well: ```yaml build-environment: - CARGO_PACKAGES: . clap_builder override-build: &package-override | REGISTRY=$( readlink -f ${CRAFT_PART_INSTALL}/../export/cargo-registry ) mkdir --parents "${REGISTRY}" for package in ${CARGO_PACKAGES}; do cd ${CRAFT_PART_BUILD}/$package cargo package --no-verify done cd ${CRAFT_PART_BUILD} for crate in target/package/*.crate; do tar xzvf "${crate}" -C "${REGISTRY}" echo '{"files":{}}' > ${REGISTRY}/$( basename ${crate%.crate} )/.cargo-checksum.json done ``` `crate package --workspace` could create all the packages in one go, but is unreliable (many repositories fail in a myriad ways) and some crates might not even be desirable in the output, so giving the user agency on which crates to work through is likely appropriate. ### Why it needs to get done Pointing at each crate in a workspace individually is tedious, wasteful (pulling the same source multiple times) and error prone: ``` :: Caused by: :: failed to parse manifest at `/root/backstage/cargo-registry/toml_datetime-0.6.8/Cargo.toml` :: Caused by: :: error inheriting `edition` from workspace root manifest's `workspace.package.edition` :: Caused by: :: failed to find a workspace root ``` This is because the crate tries to inherit metadata from the workspace, e.g.: https://github.com/toml-rs/toml/blob/9154dcb3b2eea8a84db183806411adf081bc0977/crates/toml_datetime/Cargo.toml#L7-L11

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 55
Quick Win: 16
Complexity: 60
Confidence: 72
Actionability: 72
needs triage Feature request: cargo-use plugin only supports a single crate (reads [package] from one Cargo.toml) and breaks on workspace crates that inherit metadata; proposal is a CARGO_PACKAGES key plus `cargo package --no-verify` build-override. Untriaged, no maintainer response.
qwen/qwen3.6-35b-a3b
Impact: 65
Quick Win: 29
Complexity: 45
Confidence: 70
Actionability: 80
needs triage Feature request to add workspace-aware crate selection to the cargo-use plugin, allowing users to specify which crates from a Rust workspace to package instead of failing on workspace-inheriting crates.
qwen/qwen3.8-27b
Impact: 40
Quick Win: 18
Staleness: 62
Complexity: 55
Confidence: 80
Support Request: 15
needs triage Feature request to improve the cargo-use plugin for Rust workspaces (multi-crate repos), where crates inheriting metadata from the workspace root fail to parse. No labels or maintainer response; the plugin still lacks workspace support at HEAD.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 65
Confidence: 90
Support Request: 10
needs triage Enhancement request for cargo-use plugin to better handle Rust workspaces. Currently unlabelled, has zero comments, and shows no maintainer activity in over 200 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 65
Confidence: 90
Support Request: 10
needs triage Feature request to improve Rust workspace support in the cargo-use plugin. Currently lacks maintainer response, labels, or assignee. Requires architectural changes to handle multi-crate workspaces efficiently.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#2842 (confidence 60%)

    Merged snapcraft PR adding Rust workspace support (validated with Alacritty); same problem class, but it targets the snapcraft rust plugin rather than craft-parts' cargo-use registry plugin.

Related issues

No related issues found above the similarity threshold.