From 8081806702d208986bc13170e2c1a5833634f726 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 27 2018 14:29:02 +0000 Subject: [PATCH 1/5] rust: move examples to separate files Signed-off-by: Igor Gnatenko --- diff --git a/guidelines/modules/ROOT/examples/rust-clap.spec b/guidelines/modules/ROOT/examples/rust-clap.spec new file mode 100644 index 0000000..9379865 --- /dev/null +++ b/guidelines/modules/ROOT/examples/rust-clap.spec @@ -0,0 +1,71 @@ +# Generated by rust2rpm +%bcond_without check +%global debug_package %{nil} + +%global crate clap + +Name: rust-%{crate} +Version: 2.25.0 +Release: 1%{?dist} +Summary: Simple to use, efficient, and full featured Command Line Argument Parser + +License: MIT +URL: https://crates.io/crates/clap +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * clippy is nightly +# * Loose unicode-segmentation requirements, it was done to support old Rust +Patch0: clap-2.25.0-fix-metadata.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(ansi_term) >= 0.9.0 with crate(ansi_term) < 0.10.0) +BuildRequires: (crate(atty) >= 0.2.2 with crate(atty) < 0.3.0) +BuildRequires: (crate(bitflags) >= 0.9.0 with crate(bitflags) < 0.10.0) +BuildRequires: (crate(strsim) >= 0.6.0 with crate(strsim) < 0.7.0) +BuildRequires: (crate(term_size) >= 0.3.0 with crate(term_size) < 0.4.0) +BuildRequires: (crate(textwrap) >= 0.6.0 with crate(textwrap) < 0.7.0) +BuildRequires: (crate(unicode-segmentation) >= 1.1.0 with crate(unicode-segmentation) < 2.0.0) +BuildRequires: (crate(unicode-width) >= 0.1.4 with crate(unicode-width) < 0.2.0) +BuildRequires: (crate(vec_map) >= 0.8.0 with crate(vec_map) < 0.9.0) +BuildRequires: (crate(yaml-rust) >= 0.3.5 with crate(yaml-rust) < 0.4.0) +%if %{with check} +# [dev-dependencies] +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) +BuildRequires: (crate(regex) >= 0.2.0 with crate(regex) < 0.3.0) +%endif + +%description +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +A simple to use, efficient, and full featured Command Line Argument Parser. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files devel +%license LICENSE-MIT +%doc README.md CHANGELOG.md CONTRIBUTORS.md +%{cargo_registry}/%{crate}-%{version}/ diff --git a/guidelines/modules/ROOT/examples/rust-ripgrep.spec b/guidelines/modules/ROOT/examples/rust-ripgrep.spec new file mode 100644 index 0000000..989bd29 --- /dev/null +++ b/guidelines/modules/ROOT/examples/rust-ripgrep.spec @@ -0,0 +1,74 @@ +# Generated by rust2rpm +%bcond_without check + +%global crate ripgrep + +Name: rust-%{crate} +Version: 0.5.2 +Release: 3%{?dist} +Summary: Line oriented search tool using Rust's regex library + +License: Unlicense or MIT +URL: https://crates.io/crates/ripgrep +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * No simd +# * No paths +# * Bump encoding_rs to 0.6, https://github.com/BurntSushi/ripgrep/pull/518 +Patch0: ripgrep-0.5.2-fix-metadata.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(atty) >= 0.2.2 with crate(atty) < 0.3.0) +BuildRequires: (crate(bytecount) >= 0.1.4 with crate(bytecount) < 0.2.0) +BuildRequires: (crate(clap) >= 2.24.1 with crate(clap) < 3.0.0) +BuildRequires: (crate(encoding_rs) >= 0.6.0 with crate(encoding_rs) < 0.7.0) +BuildRequires: (crate(env_logger) >= 0.4.0 with crate(env_logger) < 0.5.0) +BuildRequires: (crate(grep) >= 0.1.5 with crate(grep) < 0.2.0) +BuildRequires: (crate(ignore) >= 0.2.0 with crate(ignore) < 0.3.0) +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) +BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0) +BuildRequires: (crate(log) >= 0.3.0 with crate(log) < 0.4.0) +BuildRequires: (crate(memchr) >= 1.0.0 with crate(memchr) < 2.0.0) +BuildRequires: (crate(memmap) >= 0.5.0 with crate(memmap) < 0.6.0) +BuildRequires: (crate(num_cpus) >= 1.0.0 with crate(num_cpus) < 2.0.0) +BuildRequires: (crate(regex) >= 0.2.1 with crate(regex) < 0.3.0) +BuildRequires: (crate(same-file) >= 0.1.1 with crate(same-file) < 0.2.0) +BuildRequires: (crate(termcolor) >= 0.3.0 with crate(termcolor) < 0.4.0) +# [build-dependencies] +BuildRequires: (crate(clap) >= 2.24.1 with crate(clap) < 3.0.0) +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) + +%description +%{summary}. + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} +Line oriented search tool using Rust's regex library. Combines +the raw performance of grep with the usability of the silver searcher. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install +install -D -p -m0644 doc/rg.1 %{buildroot}%{_mandir}/man1/rg.1 + +%if %{with check} +%check +%cargo_test +%endif + +%files -n %{crate} +%license LICENSE-MIT UNLICENSE COPYING +%doc README.md CHANGELOG.md +%{_bindir}/rg +%{_mandir}/man1/rg.1* diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index f763881..4d24c6e 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -1,4 +1,4 @@ -__TOC__ += Rust This document details best practices for packaging Rust crates. Note that the rust2rpm tool, available as a Fedora package or at https://pagure.io/fedora-rust/rust2rpm, automates many of these steps. It is advisable to try `+rust2rpm $crate+` first before attempting to write a specfile by hand. @@ -14,7 +14,7 @@ Packages MUST have `+BuildRequires: rust-packaging+`. === Automatic Dependency Generation -`+rust-packaging+` automatically creates Requires/Provides based on `+%cargo_registry/*/Cargo.toml+` files. +`rust-packaging` automatically creates Requires/Provides based on `+%{cargo_registry}/*/Cargo.toml+` files. The Provides generator creates `+crate($name) = $version+` and `+crate($name/$feature) = $version+` for each "feature" the crate provides. @@ -64,7 +64,8 @@ Packagers MUST NOT package crates which do not work with the distribution. That If the crate can be made usable, packagers MUST patch packages which use such dependencies, for example: -.... +[source,diff] +---- --- cryptovec-0.3.4/Cargo.toml 2017-05-20T16:48:34+02:00 +++ cryptovec-0.3.4/Cargo.toml 2017-06-20T16:02:18.204182+02:00 @@ -10,5 +10,3 @@ @@ -85,7 +86,7 @@ If the crate can be made usable, packagers MUST patch packages which use such de extern crate kernel32; use libc::{malloc, free, c_void}; #[cfg(not(windows))] -.... +---- Such patches SHOULD be forwarded upstream. @@ -95,160 +96,21 @@ Such patches SHOULD be forwarded upstream. Rust library packages are packaged as source-only packages, as we do not build dynamic link libraries at this time due to the lack of a stabilized ABI for Rust. -.... -# Generated by rust2rpm -%bcond_without check -%global debug_package %{nil} - -%global crate clap - -Name: rust-%{crate} -Version: 2.25.0 -Release: 1%{?dist} -Summary: Simple to use, efficient, and full featured Command Line Argument Parser - -License: MIT -URL: https://crates.io/crates/clap -Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate -# Initial patched metadata -# * clippy is nightly -# * Loose unicode-segmentation requirements, it was done to support old Rust -Patch0: clap-2.25.0-fix-metadata.diff - -ExclusiveArch: %{rust_arches} - -BuildRequires: rust-packaging -# [dependencies] -BuildRequires: (crate(ansi_term) >= 0.9.0 with crate(ansi_term) < 0.10.0) -BuildRequires: (crate(atty) >= 0.2.2 with crate(atty) < 0.3.0) -BuildRequires: (crate(bitflags) >= 0.9.0 with crate(bitflags) < 0.10.0) -BuildRequires: (crate(strsim) >= 0.6.0 with crate(strsim) < 0.7.0) -BuildRequires: (crate(term_size) >= 0.3.0 with crate(term_size) < 0.4.0) -BuildRequires: (crate(textwrap) >= 0.6.0 with crate(textwrap) < 0.7.0) -BuildRequires: (crate(unicode-segmentation) >= 1.1.0 with crate(unicode-segmentation) < 2.0.0) -BuildRequires: (crate(unicode-width) >= 0.1.4 with crate(unicode-width) < 0.2.0) -BuildRequires: (crate(vec_map) >= 0.8.0 with crate(vec_map) < 0.9.0) -BuildRequires: (crate(yaml-rust) >= 0.3.5 with crate(yaml-rust) < 0.4.0) -%if %{with check} -# [dev-dependencies] -BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) -BuildRequires: (crate(regex) >= 0.2.0 with crate(regex) < 0.3.0) -%endif - -%description -%{summary}. - -%package devel -Summary: %{summary} -BuildArch: noarch - -%description devel -A simple to use, efficient, and full featured Command Line Argument Parser. - -This package contains library source intended for building other packages -which use %{crate} from crates.io. - -%prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep - -%build -%cargo_build - -%install -%cargo_install - -%if %{with check} -%check -%cargo_test -%endif - -%files devel -%license LICENSE-MIT -%doc README.md CHANGELOG.md CONTRIBUTORS.md -%{cargo_registry}/%{crate}-%{version}/ -.... +.rust-clap.spec +[source] +---- +include::{examplesdir}/rust-clap.spec[] +---- === Binary Application packages are compiled into binaries, with the application name used as the package name for the output binary package. -.... -# Generated by rust2rpm -%bcond_without check - -%global crate ripgrep - -Name: rust-%{crate} -Version: 0.5.2 -Release: 3%{?dist} -Summary: Line oriented search tool using Rust's regex library - -License: Unlicense or MIT -URL: https://crates.io/crates/ripgrep -Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate -# Initial patched metadata -# * No simd -# * No paths -# * Bump encoding_rs to 0.6, https://github.com/BurntSushi/ripgrep/pull/518 -Patch0: ripgrep-0.5.2-fix-metadata.diff - -ExclusiveArch: %{rust_arches} - -BuildRequires: rust-packaging -# [dependencies] -BuildRequires: (crate(atty) >= 0.2.2 with crate(atty) < 0.3.0) -BuildRequires: (crate(bytecount) >= 0.1.4 with crate(bytecount) < 0.2.0) -BuildRequires: (crate(clap) >= 2.24.1 with crate(clap) < 3.0.0) -BuildRequires: (crate(encoding_rs) >= 0.6.0 with crate(encoding_rs) < 0.7.0) -BuildRequires: (crate(env_logger) >= 0.4.0 with crate(env_logger) < 0.5.0) -BuildRequires: (crate(grep) >= 0.1.5 with crate(grep) < 0.2.0) -BuildRequires: (crate(ignore) >= 0.2.0 with crate(ignore) < 0.3.0) -BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) -BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0) -BuildRequires: (crate(log) >= 0.3.0 with crate(log) < 0.4.0) -BuildRequires: (crate(memchr) >= 1.0.0 with crate(memchr) < 2.0.0) -BuildRequires: (crate(memmap) >= 0.5.0 with crate(memmap) < 0.6.0) -BuildRequires: (crate(num_cpus) >= 1.0.0 with crate(num_cpus) < 2.0.0) -BuildRequires: (crate(regex) >= 0.2.1 with crate(regex) < 0.3.0) -BuildRequires: (crate(same-file) >= 0.1.1 with crate(same-file) < 0.2.0) -BuildRequires: (crate(termcolor) >= 0.3.0 with crate(termcolor) < 0.4.0) -# [build-dependencies] -BuildRequires: (crate(clap) >= 2.24.1 with crate(clap) < 3.0.0) -BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) - -%description -%{summary}. - -%package -n %{crate} -Summary: %{summary} - -%description -n %{crate} -Line oriented search tool using Rust's regex library. Combines -the raw performance of grep with the usability of the silver searcher. - -%prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep - -%build -%cargo_build - -%install -%cargo_install -install -D -p -m0644 doc/rg.1 %{buildroot}%{_mandir}/man1/rg.1 - -%if %{with check} -%check -%cargo_test -%endif - -%files -n %{crate} -%license LICENSE-MIT UNLICENSE COPYING -%doc README.md CHANGELOG.md -%{_bindir}/rg -%{_mandir}/man1/rg.1* -.... +.rust-ripgrep.spec +[source] +---- +include::{examplesdir}/rust-ripgrep.spec[] +---- === Library + Binary From 793c2cab514e308563916b1708ace8f5d1a0301c Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 27 2018 14:29:02 +0000 Subject: [PATCH 2/5] rust: replace rustfmt example with cbindgen rustfmt is retired from fedora (now it is part of Rust compiler), so it is better to show something somewhat real ;) Signed-off-by: Igor Gnatenko --- diff --git a/guidelines/modules/ROOT/examples/rust-cbindgen.spec b/guidelines/modules/ROOT/examples/rust-cbindgen.spec new file mode 100644 index 0000000..50c5bed --- /dev/null +++ b/guidelines/modules/ROOT/examples/rust-cbindgen.spec @@ -0,0 +1,74 @@ +# Generated by rust2rpm +%bcond_without check + +%global crate cbindgen + +Name: rust-%{crate} +Version: 0.6.3 +Release: 2%{?dist} +Summary: Tool for generating C bindings to Rust code + +# Upstream license specification: MPL-2.0 +License: MPLv2.0 +URL: https://crates.io/crates/cbindgen +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * Bump pinned serde, https://github.com/eqrion/cbindgen/pull/207 +Patch0: cbindgen-fix-metadata.diff + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(clap) >= 2.0.0 with crate(clap) < 3.0.0) +BuildRequires: (crate(log) >= 0.4.0 with crate(log) < 0.5.0) +BuildRequires: ((crate(serde) >= 1.0.0 with crate(serde) < 2.0.0) with crate(serde/derive)) +BuildRequires: crate(serde_derive) = 1.0.58 +BuildRequires: (crate(serde_json) >= 1.0.0 with crate(serde_json) < 2.0.0) +BuildRequires: ((crate(syn) >= 0.14.0 with crate(syn) < 0.15.0) with crate(syn/clone-impls) with crate(syn/derive) with crate(syn/extra-traits) with crate(syn/full) with crate(syn/parsing) with crate(syn/printing)) +BuildRequires: (crate(tempfile) >= 3.0.0 with crate(tempfile) < 4.0.0) +BuildRequires: (crate(toml) >= 0.4.0 with crate(toml) < 0.5.0) + +%description +%{summary}. + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +A tool for generating C bindings to Rust code. + +This package contains library source intended for building other packages +which use %{crate} from crates.io. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files -n %{crate} +%license LICENSE +%doc README.md +%{_bindir}/cbindgen + +%files devel +%license LICENSE +%doc ARCHITECTURE.md CONTRIBUTING.md README.md +%{cargo_registry}/%{crate}-%{version}/ diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index 4d24c6e..5cfa947 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -114,83 +114,8 @@ include::{examplesdir}/rust-ripgrep.spec[] === Library + Binary -.... -# Generated by rust2rpm -%bcond_without check - -%global crate rustfmt - -Name: rust-%{crate} -Version: 0.9.0 -Release: 1%{?dist} -Summary: Tool to find and fix Rust formatting issues - -License: ASL 2.0 or MIT -URL: https://crates.io/crates/rustfmt -Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate -# Initial patched metadata -# * No windows -Patch0: rustfmt-0.9.0-fix-metadata.diff - -ExclusiveArch: %{rust_arches} - -BuildRequires: rust-packaging -# [dependencies] -BuildRequires: (crate(diff) >= 0.1.0 with crate(diff) < 0.2.0) -BuildRequires: (crate(env_logger) >= 0.4.0 with crate(env_logger) < 0.5.0) -BuildRequires: (crate(getopts) >= 0.2.0 with crate(getopts) < 0.3.0) -BuildRequires: (crate(libc) >= 0.2.11 with crate(libc) < 0.3.0) -BuildRequires: (crate(log) >= 0.3.0 with crate(log) < 0.4.0) -BuildRequires: (crate(regex) >= 0.2.0 with crate(regex) < 0.3.0) -BuildRequires: (crate(serde) >= 1.0.0 with crate(serde) < 2.0.0) -BuildRequires: (crate(serde_derive) >= 1.0.0 with crate(serde_derive) < 2.0.0) -BuildRequires: (crate(serde_json) >= 1.0.0 with crate(serde_json) < 2.0.0) -BuildRequires: (crate(strings) >= 0.1.0 with crate(strings) < 0.2.0) -BuildRequires: (crate(syntex_errors) >= 0.59.0 with crate(syntex_errors) < 0.60.0) -BuildRequires: (crate(syntex_syntax) >= 0.59.0 with crate(syntex_syntax) < 0.60.0) -BuildRequires: (crate(term) >= 0.4.0 with crate(term) < 0.5.0) -BuildRequires: (crate(toml) >= 0.4.0 with crate(toml) < 0.5.0) -BuildRequires: (crate(unicode-segmentation) >= 1.0.0 with crate(unicode-segmentation) < 2.0.0) - -%description -%{summary}. - -%package -n %{crate} -Summary: %{summary} - -%description -n %{crate} -%{summary}. - -%package devel -Summary: %{summary} -BuildArch: noarch - -%description devel -Tool to find and fix Rust formatting issues. - -This package contains library source intended for building other packages -which use %{crate} from crates.io. - -%prep -%autosetup -n %{crate}-%{version} -p1 -%cargo_prep - -%build -%cargo_build - -%install -%cargo_install - -%if %{with check} -%check -%cargo_test -%endif - -%files -n %{crate} -%{_bindir}/rustfmt -%{_bindir}/cargo-fmt - -%files devel -%license LICENSE-APACHE LICENSE-MIT -%{cargo_registry}/%{crate}-%{version}/ -.... +.rust-cbindgen.spec +[source] +---- +include::{examplesdir}/rust-cbindgen.spec[] +---- From 22e48dc723d5a8d476efa316cade5c36769c30cc Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 27 2018 14:29:02 +0000 Subject: [PATCH 3/5] rust: make crates.io clickable Signed-off-by: Igor Gnatenko --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index 5cfa947..f0de3f9 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -4,7 +4,7 @@ This document details best practices for packaging Rust crates. Note that the ru == Naming -Rust crates should be named `+rust-+`. Crates are expected to be from crates.io. Rust applications that aren't from crates.io SHOULD follow the main guidelines for package names. +Rust crates should be named `+rust-+`. Crates are expected to be from https://crates.io[crates.io]. Rust applications that aren't from crates.io SHOULD follow the main guidelines for package names. At this time, Rust libraries MUST be from crates.io, as this enforces a certain standard in how they are packaged and built. From 86d0fd715a129def0dd0c4d72531a377648d08a9 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 27 2018 14:29:02 +0000 Subject: [PATCH 4/5] rust: SHOULD → MUST for naming Signed-off-by: Igor Gnatenko --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index f0de3f9..ed2b950 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -4,7 +4,7 @@ This document details best practices for packaging Rust crates. Note that the ru == Naming -Rust crates should be named `+rust-+`. Crates are expected to be from https://crates.io[crates.io]. Rust applications that aren't from crates.io SHOULD follow the main guidelines for package names. +Rust crates MUST be named `rust-$crate`. The crates are expected to be from https://crates.io[crates.io]. Rust applications that aren't from crates.io MUST follow the main guidelines for package names. At this time, Rust libraries MUST be from crates.io, as this enforces a certain standard in how they are packaged and built. From 9c65f73544804a58ac513b99250943c4d098f667 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sep 27 2018 14:29:03 +0000 Subject: [PATCH 5/5] rust: add note about excluding files There are few reasons for this: * BRP scripts are run with full buildroot (not taking %exclude into account) which slows down build process and might fail because some brp not allowing such file to be present in there (hello unversioned Python shebangs). * Forwarding such exclude line to upstream will make possible to remove any downstream patching in future. This is beneficial for upstream because their archives on crates.io will be smaller which people like. Signed-off-by: Igor Gnatenko --- diff --git a/guidelines/modules/ROOT/pages/Rust.adoc b/guidelines/modules/ROOT/pages/Rust.adoc index ed2b950..eb00561 100644 --- a/guidelines/modules/ROOT/pages/Rust.adoc +++ b/guidelines/modules/ROOT/pages/Rust.adoc @@ -58,6 +58,28 @@ All rust packages MUST have `+ExclusiveArch: %{rust_arches}+`. Packagers MUST run `+%cargo_prep+` to prepare configuration for further cargo invocations (sets up RUSTFLAGS and all other stuff). +=== Exclude unnecessary files + +* Packagers SHOULD exclude files which are not used by anything (things like `appveyor.yml` and CI scripts). +* Packagers SHOULD use https://doc.rust-lang.org/cargo/reference/manifest.html#the-exclude-and-include-fields-optional[exclude field in Cargo.toml] instead of using `+%exclude+` +* Packagers SHOULD forward such patches to upstream + +Example: + +[source,diff] +---- +--- csv-1.0.1/Cargo.toml 1970-01-01T01:00:00+01:00 ++++ csv-1.0.1/Cargo.toml 2018-09-25T07:14:47.639840+02:00 +@@ -22,6 +22,7 @@ + categories = ["encoding", "parser-implementations"] + license = "Unlicense/MIT" + repository = "https://github.com/BurntSushi/rust-csv" ++exclude = ["/.travis.yml", "/appveyor.yml", "/ci/*", "/scripts/*"] + [profile.bench] + debug = true + +---- + === Nightly, Other Platforms, etc. crates Packagers MUST NOT package crates which do not work with the distribution. That is, if the crate depends on nightly-only features or works only for non-Linux platforms, the crate is not suitable for inclusion in Fedora.