From 1e3d1b1ebcc9b14afb3a0caef700bf2116889001 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mar 11 2017 13:47:56 +0000 Subject: packaging Signed-off-by: Igor Gnatenko --- diff --git a/index.rst b/index.rst index 06d173d..f21214c 100644 --- a/index.rst +++ b/index.rst @@ -24,6 +24,12 @@ You can download packages created by our SIG from our fedorapeople repository. T .. _ripgrep: https://github.com/BurntSushi/ripgrep +--------- +Packaging +--------- + +You can find packaging guidelines and hints on :ref:`packaging` page. + -------- Meetings -------- diff --git a/packaging.rst b/packaging.rst new file mode 100644 index 0000000..a5f4c0a --- /dev/null +++ b/packaging.rst @@ -0,0 +1,270 @@ +.. _packaging: + +========= +Packaging +========= + +Apart from guidelines mentioned below, package must follow `Fedora Packaging Guidelines`_. + +.. _Fedora Packaging Guidelines: https://fedoraproject.org/wiki/Packaging:Guidelines + +------ +Naming +------ + +Packages **MUST** be named: + + * *rust-foo-devel* when it contains only library + * *bar* when it contains only binary + * *baz* (for binaries) and subpackage *rust-baz-devel* (for library) when it contains both + +------------- +ExclusiveArch +------------- + +Packages **MUST** have ``ExclusiveArch: %{rust_arches}```. + +------------ +Dependencies +------------ + +Packagers **MUST** use ``with`` rich dependency operator and specify exact version range for dependencies and their features. + +------------- +BuildRequires +------------- + +Packages **MUST** have ``BuildRequires: rust`` and ``BuildRequires: cargo``. + +-------- +Examples +-------- + +Library +======= + +:: + + %bcond_without check + + %global debug_package %{nil} + + %global crate synom + + Name: rust-%{crate} + Version: 0.11.3 + Release: 1%{?dist} + Summary: Stripped-down Nom parser used by Syn + + License: MIT or ASL 2.0 + URL: https://crates.io/crates/synom + Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate + + ExclusiveArch: %{rust_arches} + + BuildRequires: rust + BuildRequires: cargo + # [dependencies] + BuildRequires: (crate(unicode-xid) >= 0.0.4 with crate(unicode-xid) < 0.0.5) + %if %{with check} + # [dev-dependencies] + BuildRequires: ((crate(syn) >= 0.11.0 with crate(syn) < 0.12.0) with crate(syn/parsing) with crate(syn/full)) + %endif + + %description + %{summary}. + + %package devel + Summary: %{summary} + BuildArch: noarch + + %description devel + Stripped-down Nom parser used by Syn. + + 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 LICENSE-APACHE + %doc README.md + %{cargo_registry}/%{crate}-%{version}/ + + %changelog + +Binary +====== + +:: + + %bcond_without check + + %global crate ripgrep + + Name: %{crate} + Version: 0.4.0 + Release: 5%{?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 windows + # * No simd + # * Bump env_logger, https://github.com/BurntSushi/ripgrep/pull/382 + # * Bump termcolor, https://github.com/BurntSushi/ripgrep/commit/a114b860635c98198d53e6ba8ed37c88df2c5cc3 + Patch0: ripgrep-0.4.0-fix-metadata.diff + # Fix build with new termcolor, https://github.com/BurntSushi/ripgrep/commit/22cb644eb6fc7872c1a0e5e084791b87382014b4 + Patch1: 0001-termcolor-add-support-for-output-to-standard-error.patch + + ExclusiveArch: %{rust_arches} + + BuildRequires: rust + BuildRequires: cargo + # [dependencies] + BuildRequires: (crate(bytecount) >= 0.1.4 with crate(bytecount) < 0.2.0) + BuildRequires: (crate(clap) >= 2.19.0 with crate(clap) < 3.0.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.1.7 with crate(ignore) < 0.2.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.18.0 with crate(clap) < 3.0.0) + BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) + + %description + 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 + %license LICENSE-MIT UNLICENSE COPYING + %doc README.md CHANGELOG.md + %{_bindir}/rg + %{_mandir}/man1/rg.1* + + %changelog + +Binary + Library +================ + +:: + + %bcond_without check + + %global crate rustfmt + + Name: %{crate} + Version: 0.7.1 + Release: 2%{?dist} + Summary: Tool to find and fix Rust formatting issues + + # https://github.com/rust-lang-nursery/rustfmt/issues/1340 + 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.7.1-fix-metadata.diff + # https://github.com/rust-lang-nursery/rustfmt/pull/1338 + Patch1: 0001-bump-env_logger-to-0.4.patch + Patch2: 0002-bump-regex-to-0.2.patch + Patch3: 0003-bump-syntex_-to-0.58.patch + + ExclusiveArch: %{rust_arches} + + BuildRequires: rust + BuildRequires: cargo + # [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(itertools) >= 0.5.8 with crate(itertools) < 0.6.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(multimap) >= 0.3.0 with crate(multimap) < 0.4.0) + BuildRequires: (crate(regex) >= 0.2.0 with crate(regex) < 0.3.0) + BuildRequires: (crate(rustc-serialize) >= 0.3.0 with crate(rustc-serialize) < 0.4.0) + BuildRequires: (crate(strings) >= 0.0.1 with crate(strings) < 0.0.2) + BuildRequires: (crate(syntex_errors) >= 0.58.0 with crate(syntex_errors) < 0.59.0) + BuildRequires: (crate(syntex_syntax) >= 0.58.0 with crate(syntex_syntax) < 0.59.0) + BuildRequires: (crate(term) >= 0.4.0 with crate(term) < 0.5.0) + BuildRequires: (crate(toml) >= 0.2.1 with crate(toml) < 0.3.0) + BuildRequires: (crate(unicode-segmentation) >= 1.0.0 with crate(unicode-segmentation) < 2.0.0) + # [build-dependencies] + BuildRequires: (crate(walkdir) >= 1.0.3 with crate(walkdir) < 2.0.0) + + %description + %{summary}. + + %package -n rust-%{crate}-devel + Summary: %{summary} + BuildArch: noarch + + %description -n rust-%{crate}-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 + %{_bindir}/rustfmt + %{_bindir}/cargo-fmt + + %files -n rust-%{crate}-devel + %{cargo_registry}/%{crate}-%{version}/ + + %changelog