From 848d8fdb6b158b59783396f97717faa658f1ab51 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Aug 23 2022 10:40:48 +0000 Subject: [PATCH 1/5] Rust: remove mentions of Fedora < 35; add notes for update process --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index 70f88a9..d6b7708 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -289,28 +289,21 @@ the `Cargo.toml` file MUST be patched to remove them, for example: ---- -== Notes on the build process - -CAUTION: The build process for Rust packages has evolved over time, - especially for binary packages. - Packages for source-only library crates were historically only built on Rawhide, - but will also start being available on stable branches starting with Fedora 34. - -* Originally, binary packages for stable releases were built using Modularity, - leveraging its buildroot-only packages filtering capabilities, - but this approach was dropped in the Fedora 31 timeframe. -* From Fedora 31 to Fedora 33, binary packages are built with a special process - (leveraging koji side tags), using base packages from the relevant stable Fedora release, - except for Rust crates, which were included from Rawhide. -* From Fedora 34 onward, the workflow for building Rust packages will no longer be special -- - packages for both library crates *and* applications will be available and built normally, - without having to rely on a different procedure for release branches. - -NOTE: Source-only Rust packages were granted a general exception to the - https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/[Updates policy], - so they can be freely updated in release branches in addition to rawhide - (announced in the corresponding FESCo ticket: - https://pagure.io/fesco/issue/2474[F34 System-Wide Change: Rust Crate Packages For Release Branches]). +== Update process + +Source-only Rust packages were granted a general exception to the +https://docs.fedoraproject.org/en-US/fesco/Updates_Policy/[Updates policy], +so they can be freely updated in release branches in addition to rawhide +(announced in the corresponding FESCo ticket: +https://pagure.io/fesco/issue/2474[F34 System-Wide Change: Rust Crate Packages For Release Branches]). + +If possible, packages for Rust library crates SHOULD be updated +to the same version across all currently supported branches of Fedora. +Exceptions for this rule might be: + +* system dependencies are too old on older branches (for example, `+libgit2+`) +* pushing API-incompatible versions would result in broken packages on stable + branches (for example, packages for the `+gtk-rs+` project crates) == Examples From ac74f656005d087a66dab89e34f93492a7ff9b02 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Aug 23 2022 10:43:14 +0000 Subject: [PATCH 2/5] Rust: document rust2rpm v22 features for new automation --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index d6b7708..24663bb 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -7,7 +7,7 @@ Note that the https://pagure.io/fedora-rust/rust2rpm[*rust2rpm*] tool (packaged as `python3-rust2rpm` for Fedora) automates most of the steps that are necessary for creating `+.spec+` files for Rust crates. -It is advisable to try `+rust2rpm $crate+` first, +It is advisable to try `+rust2rpm -s $crate+` first, and to only modify its output for your needs, before attempting to write a `+.spec+` file by hand. Most of the time, `+rust2rpm+` output can be used almost without modifications. @@ -18,10 +18,11 @@ or patches for upstream `+Cargo.toml+` files (with `+rust2rpm -p+`) are required, for example: * trimming a generated `+Summary+` tag that is too long -* dropping non-linux platform-specific dependencies +* dropping non-linux platform-specific dependencies (automated by rust2rpm v22+) * dropping features that are only supported by nightly builds of the Rust compiler * dropping unstable features that require manually overriding compiler flags * dropping *unused* optional features with missing dependencies + (can be automated by using a `+rust2rpm.conf+` configuration file) == Package Naming @@ -289,6 +290,13 @@ the `Cargo.toml` file MUST be patched to remove them, for example: ---- +NOTE: The patch to remove platform-specific dependencies for non-linux platforms + is automatically generated by rust2rpm versions 22 and later. + Additionally, a configuration file for rust2rpm (`+rust2rpm.conf+`) + can be added to the package's dist-git repository + to disable generation of subpackages for specific features, + (for example, nightly-only features). + == Update process Source-only Rust packages were granted a general exception to the From 8a58e8e8cc20aaf0119da36bb2b9c52f7925ab1a Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Aug 23 2022 11:04:04 +0000 Subject: [PATCH 3/5] Rust: split rules for package sources from naming guidelines --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index 24663bb..9aa6f0a 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -24,12 +24,7 @@ are required, for example: * dropping *unused* optional features with missing dependencies (can be automated by using a `+rust2rpm.conf+` configuration file) -== Package Naming - -=== Library crates - -Source packages for Rust crates which contain a library with a public API -MUST be named `rust-$crate`. +== Package Sources Only library crates that are published on crates.io MAY be packaged for Fedora, since this enforces a certain standard of how crates are packaged and built, @@ -37,6 +32,18 @@ ensures that all the crate's dependencies are available from crates.io as well, and that there are no package name collisions due to the unique crate names in the crates.io namespace. +Crates that contain only an application but no library interface +MAY be packaged even if they are not published on crates.io, +because those packages are leaves +and cannot be depended on by other Rust crates. + +== Package Naming + +=== Library crates + +Source packages for Rust crates which contain a library with a public API +MUST be named `rust-$crate`. + === Mixed library / application crates Source packages for Rust crates @@ -60,11 +67,8 @@ because a crate can start to include a public library API at any time, in which case the "Mixed library / application crates" rules would apply, and the package would need to be renamed to include the `+rust-+` prefix. -Crates that contain only an application but no library interface -MAY be packaged even if they are not published on crates.io, -because those packages are leaves -and cannot be depended on by other Rust crates. -Such packages MUST follow the default xref:Naming.adoc[Naming Guidelines] +Application-only Rust projects which are not packaged from crates.io +must follow the general xref:Naming.adoc[Naming Guidelines] (i.e. drop the `+rust-+` prefix from the source package name) so that they cannot introduce potential source package name collisions with crates from the crates.io namespace. From 42c83fd061330518738ad447bbe9d22222522526 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Aug 23 2022 11:04:36 +0000 Subject: [PATCH 4/5] Rust: add an exception to the "only crates.io" rule for complex packages --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index 9aa6f0a..c6a9c17 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -37,6 +37,12 @@ MAY be packaged even if they are not published on crates.io, because those packages are leaves and cannot be depended on by other Rust crates. +Complex projects with multiple components (i.e. bindings for other languages), +which cannot be packaged from sources that are published on crates.io alone, +MAY include subpackages for their Rust library interface +(`+rust-$crate-devel+`, `+rust-$crate+feature-devel+`, etc.) +ONLY if this crate is also published on crates.io under the same name. + == Package Naming === Library crates From 7e625c2cd17f14fde2a284268811f754cde2a239 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Aug 23 2022 11:05:15 +0000 Subject: [PATCH 5/5] Rust: update last-reviewed date --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index c6a9c17..982ae55 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -1,5 +1,5 @@ = Rust Packaging Guidelines -:last-reviewed: 2021-12-18 +:last-reviewed: 2022-08-23 == rust2rpm