Bug 2329304
Summary: | spec-files created with rust2rpm contain sub-packages for dependencies | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Uri Lublin <uril> |
Component: | rust2rpm | Assignee: | Rust SIG <rust-sig> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | decathorpe, rust-sig |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2024-11-28 09:46:08 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Uri Lublin
2024-11-28 09:25:05 UTC
A workaround exists: Prefix each dependency in [features] table with "dep:". For example: $ rust2rpm jsonwebkey 0.3.5 -p # run with -p and change Cargo.toml ==> creates jsonwebkey-fix-metadata.diff $ cat jsonwebkey-fix-metadata.diff --- jsonwebkey-0.3.5/Cargo.toml 1970-01-01T00:00:01+00:00 +++ jsonwebkey-0.3.5/Cargo.toml 2024-11-28T09:27:02.133502+00:00 @@ -73,14 +73,14 @@ [features] generate = [ - "p256", - "rand", + "dep:p256", + "dep:rand", ] jwt-convert = [ "pkcs-convert", - "jsonwebtoken", + "dep:jsonwebtoken", ] pkcs-convert = [ - "num-bigint", - "yasna", + "dep:num-bigint", + "dep:yasna", ] $ grep '^.package' rust-jsonwebkey.spec %package devel %package -n %{name}+default-devel %package -n %{name}+generate-devel %package -n %{name}+jwt-convert-devel %package -n %{name}+pkcs-convert-devel > Usually rust2rpm creates spec files with subpackages rust-<cratename>+<feature>-devel. > But now it also creates subpackages rust-<cratename>+<dependency>-devel for dependencies that appear in the [features] table. Yes- this is intentional, and matches behaviour of cargo itself. You can verify this by running `cargo metadata` against the project's "Cargo.toml" file and looking at the "features" property of the JSON output. > A workaround exists: > Prefix each dependency in [features] table with "dep:". This is not a workaround, it's applying a potentially breaking change compared to upstream - don't do it. It looks like there's a misunderstanding about how cargo works: All optional dependencies (unless hidden explicitly) *are* features. Please refer to the cargo documentation: https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies |