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. rust2rpm-26.2.0-1.fc42.noarch Reproducible: Always Steps to Reproduce: 1. rust2rpm jsonwebkey 0.3.5 2. grep '^.package' rust-jsonwebkey.spec Actual Results: %package devel %package -n %{name}+default-devel %package -n %{name}+generate-devel %package -n %{name}+jsonwebtoken-devel %package -n %{name}+jwt-convert-devel %package -n %{name}+num-bigint-devel %package -n %{name}+p256-devel %package -n %{name}+pkcs-convert-devel %package -n %{name}+rand-devel %package -n %{name}+yasna-devel Expected Results: %package devel %package -n %{name}+default-devel %package -n %{name}+generate-devel %package -n %{name}+jwt-convert-devel %package -n %{name}+pkcs-convert-devel Not create subpackages for dependencies, only for features.
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