Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 2152697 - rust2rpm / rust-packaging doesn't support Rust 1.60+ features for optional and conditional dependencies
Summary: rust2rpm / rust-packaging doesn't support Rust 1.60+ features for optional an...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rust-packaging
Version: 38
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rust SIG
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2161128 (view as bug list)
Depends On: 2169233
Blocks: 2117147 2119164 2125013 2126224 2136580 2137029 2137245 2140158 2140269 2148310 2166384 2167496
TreeView+ depends on / blocked
 
Reported: 2022-12-12 17:54 UTC by Fabio Valentini
Modified: 2023-02-16 18:43 UTC (History)
4 users (show)

Fixed In Version: rust-packaging-24-1.fc39
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-16 18:43:10 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Fabio Valentini 2022-12-12 17:54:22 UTC
Cargo 1.60 introduced new syntax for specifying feature dependencies ("dep:foo" or "dep?/foo", for "optional dependencies" and "dependency features", respectively). rust2rpm, rust-packaging, and Rust RPM macros don't support this syntax, and packages can't be updated to versions of crates that start to use these features.

Tracked upstream here:
https://pagure.io/fedora-rust/rust2rpm/issue/186

Filed as tracking bug, so updates that are blocked by this missing feature can be marked appropriately.

Comment 1 Fabio Valentini 2023-01-16 20:25:32 UTC
*** Bug 2161128 has been marked as a duplicate of this bug. ***

Comment 2 Gris Ge 2023-01-20 07:44:34 UTC
Hi Fabio,

In case you didn't noticed, currently rust packaging tool is treating __every__ dependency as a internal feature.

For example, the rust-rtnetlink has Cargo.toml

[features]
test_as_root = []
default = ["tokio_socket"]
tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
smol_socket = ["netlink-proto/smol_socket", "async-global-executor"]


Then fedora packaging tool is treating `tokio` as a feature: `rust-rtnetlink+tokio-devel.noarch`.

A lot rust crate package is impacted on this.

Comment 3 Fabio Valentini 2023-01-20 12:26:13 UTC
Hi Gris - it looks like there's a misunderstanding here.
I am well aware about how our rust packaging works, and the behaviour is correct. :)

In cargo, optional dependencies *are* features. And up until Rust 1.60, there was no way to discriminate between optional dependencies that are supposed to be "internal" (i.e. implenentation details) or "public".

In your example, "tokio" is indeed an optional dependency, which is turned into a feature by cargo.

Now, what's new with Rust 1.60 is that you can actually mark optional dependencies as "private", in your example, that would look like using
tokio_socket = ["netlink-proto/tokio_socket", "dep:tokio"]
instead of
tokio_socket = ["netlink-proto/tokio_socket", "tokio"]
as cargo now no longer generates implicit features for optional dependencies if they are referenced like "dep:foo".

This new syntax is what our tools don't understand yet. But for packages that *don't* use this syntax, the generated feature subpackages *are correct* and match upstream cargo behaviour.

Comment 4 Ben Cotton 2023-02-07 15:00:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 5 Fedora Update System 2023-02-16 18:41:21 UTC
FEDORA-2023-77a65a092d has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-77a65a092d

Comment 6 Fedora Update System 2023-02-16 18:43:10 UTC
FEDORA-2023-77a65a092d has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.