From 26ef8a0c56d8f8981dcfc6fc3da0c89fbaf9c8e8 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 10 Dec 2024 14:03:20 -0500 Subject: [PATCH] Initial package (close RHBZ#2328487) - Re-generate with rust2rpm 27 for a slightly nicer spec file --- .gitignore | 1 + ...lections-1.5.0-no-icu-dev-dependency.patch | 12 ++ icu_collections-1.5.0-no-postcard.patch | 24 +++ icu_collections-fix-metadata.diff | 9 ++ rust-icu_collections.rpmlintrc | 4 + rust-icu_collections.spec | 142 ++++++++++++++++++ rust2rpm.toml | 68 +++++++++ sources | 1 + 8 files changed, 261 insertions(+) create mode 100644 .gitignore create mode 100644 icu_collections-1.5.0-no-icu-dev-dependency.patch create mode 100644 icu_collections-1.5.0-no-postcard.patch create mode 100644 icu_collections-fix-metadata.diff create mode 100644 rust-icu_collections.rpmlintrc create mode 100644 rust-icu_collections.spec create mode 100644 rust2rpm.toml create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23b27d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/icu_collections-1.5.0.crate diff --git a/icu_collections-1.5.0-no-icu-dev-dependency.patch b/icu_collections-1.5.0-no-icu-dev-dependency.patch new file mode 100644 index 0000000..37abbbb --- /dev/null +++ b/icu_collections-1.5.0-no-icu-dev-dependency.patch @@ -0,0 +1,12 @@ +diff -Naur icu_collections-1.5.0-original/src/iterator_utils.rs icu_collections-1.5.0/src/iterator_utils.rs +--- icu_collections-1.5.0-original/src/iterator_utils.rs 2006-07-23 21:21:28.000000000 -0400 ++++ icu_collections-1.5.0/src/iterator_utils.rs 2024-11-23 10:54:55.081320930 -0500 +@@ -59,6 +59,8 @@ + } + + #[cfg(test)] ++// Downstream-only: unconditionally disable these to avoid a circular dependency on the icu crate ++#[cfg(any())] + mod tests { + use core::fmt::Debug; + use icu::collections::codepointinvlist::CodePointInversionListBuilder; diff --git a/icu_collections-1.5.0-no-postcard.patch b/icu_collections-1.5.0-no-postcard.patch new file mode 100644 index 0000000..b780669 --- /dev/null +++ b/icu_collections-1.5.0-no-postcard.patch @@ -0,0 +1,24 @@ +diff -Naur icu_collections-1.5.0-original/src/codepointinvlist/cpinvlist.rs icu_collections-1.5.0/src/codepointinvlist/cpinvlist.rs +--- icu_collections-1.5.0-original/src/codepointinvlist/cpinvlist.rs 2006-07-23 21:21:28.000000000 -0400 ++++ icu_collections-1.5.0/src/codepointinvlist/cpinvlist.rs 2024-11-23 10:42:53.464004825 -0500 +@@ -1034,6 +1034,8 @@ + } + + #[test] ++ // Downstream-only: unconditionally disable this because we lack postcard ++ #[cfg(any())] + fn test_serde_with_postcard_roundtrip() -> Result<(), postcard::Error> { + let set = CodePointInversionList::bmp(); + let set_serialized: Vec = postcard::to_allocvec(&set).unwrap(); +diff -Naur icu_collections-1.5.0-original/src/codepointtrie/cptrie.rs icu_collections-1.5.0/src/codepointtrie/cptrie.rs +--- icu_collections-1.5.0-original/src/codepointtrie/cptrie.rs 2006-07-23 21:21:28.000000000 -0400 ++++ icu_collections-1.5.0/src/codepointtrie/cptrie.rs 2024-11-23 10:42:58.801073739 -0500 +@@ -1082,6 +1082,8 @@ + + #[test] + #[cfg(feature = "serde")] ++ // Downstream-only: unconditionally disable this because we lack postcard ++ #[cfg(any())] + fn test_serde_with_postcard_roundtrip() -> Result<(), postcard::Error> { + let trie = crate::codepointtrie::planes::get_planes_trie(); + let trie_serialized: Vec = postcard::to_allocvec(&trie).unwrap(); diff --git a/icu_collections-fix-metadata.diff b/icu_collections-fix-metadata.diff new file mode 100644 index 0000000..3aa20c6 --- /dev/null +++ b/icu_collections-fix-metadata.diff @@ -0,0 +1,9 @@ +--- icu_collections-1.5.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ icu_collections-1.5.0/Cargo.toml 2024-12-10T19:11:54.241538+00:00 +@@ -124,6 +124,3 @@ + "zerovec/serde", + ] + std = [] +- +-[target."cfg(not(target_arch = \"wasm32\"))".dev-dependencies.criterion] +-version = "0.5.0" diff --git a/rust-icu_collections.rpmlintrc b/rust-icu_collections.rpmlintrc new file mode 100644 index 0000000..2a74ae8 --- /dev/null +++ b/rust-icu_collections.rpmlintrc @@ -0,0 +1,4 @@ +# Feature metapackages are not supposed to have documentation! +addFilter(r"\+[-_\w]+-devel.noarch: W: no-documentation") +# Duplicate test data files are small and not worth attempting to hardlink +addFilter(r"files-duplicate .*/tests/data/") diff --git a/rust-icu_collections.spec b/rust-icu_collections.spec new file mode 100644 index 0000000..1db3317 --- /dev/null +++ b/rust-icu_collections.spec @@ -0,0 +1,142 @@ +# Generated by rust2rpm 27 +%bcond check 1 +%global debug_package %{nil} + +%global crate icu_collections + +Name: rust-icu_collections +Version: 1.5.0 +Release: %autorelease +Summary: Collection of API for use in ICU libraries + +License: Unicode-3.0 +URL: https://crates.io/crates/icu_collections +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# * Drop benchmark-only criterion dependency +Patch: icu_collections-fix-metadata.diff +# * Downstream-only: unconditionally skip compiling tests that would require +# postcard. +Patch10: icu_collections-1.5.0-no-postcard.patch +# * Downstream-only: unconditionally skip compiling tests that would require the +# circular (path-based) dev-dependency on the icu crate. +Patch11: icu_collections-1.5.0-no-icu-dev-dependency.patch + +BuildRequires: cargo-rpm-macros >= 24 +BuildRequires: tomcli + +%global _description %{expand: +Collection of API for use in ICU libraries.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+bench-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+bench-devel %{_description} + +This package contains library source intended for building other packages which +use the "bench" feature of the "%{crate}" crate. + +%files -n %{name}+bench-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+databake-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+databake-devel %{_description} + +This package contains library source intended for building other packages which +use the "databake" feature of the "%{crate}" crate. + +%files -n %{name}+databake-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+serde-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+serde-devel %{_description} + +This package contains library source intended for building other packages which +use the "serde" feature of the "%{crate}" crate. + +%files -n %{name}+serde-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+std-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+std-devel %{_description} + +This package contains library source intended for building other packages which +use the "std" feature of the "%{crate}" crate. + +%files -n %{name}+std-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +# Do not depend on postcard; it is needed only for one (skipped) test. +tomcli set Cargo.toml del dev-dependencies.postcard +# Avoid a dependency on the internal icu_benchmark_macros crate +rm -rv examples/ +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires -f databake,serde + +%build +%cargo_build -f databake,serde + +%install +%cargo_install -f databake,serde + +%if %{with check} +%check +# * All doc tests use icu::collections, which would require the circular +# (path-based) dev-dependency on the icu crate. +# * Tests using databake may fail due to trivial differences in the string +# representations of generated code, such as trailing commas without semantic +# significance. +%{cargo_test -f databake,serde -- --lib -- --exact %{shrink: + --skip codepointinvlist::cpinvlist::tests::databake + --skip codepointtrie::cptrie::tests::databake +}} +%{cargo_test -f databake,serde -- --tests -- --exact %{shrink: + --skip codepointinvlist::cpinvlist::tests::databake + --skip codepointtrie::cptrie::tests::databake +}} +%endif + +%changelog +%autochangelog diff --git a/rust2rpm.toml b/rust2rpm.toml new file mode 100644 index 0000000..190c113 --- /dev/null +++ b/rust2rpm.toml @@ -0,0 +1,68 @@ +[package] +cargo-toml-patch-comments = [ + # This would be a candidate for automated patching with tomcli if it were + # an unconditional dependency, but given it is + # target.'cfg(not(target_arch = \"wasm32\"))', manual patching is easier. + "Drop benchmark-only criterion dependency", +] + +[[package.extra-patches]] +number = 10 +file = "icu_collections-1.5.0-no-postcard.patch" +comments = [ + """\ + Downstream-only: unconditionally skip compiling tests that would require \ + postcard.\ + """ +] +[[package.extra-patches]] +number = 11 +file = "icu_collections-1.5.0-no-icu-dev-dependency.patch" +comments = [ + """\ + Downstream-only: unconditionally skip compiling tests that would require \ + the circular (path-based) dev-dependency on the icu crate.\ + """ +] + +[features] +enable = [ + # Required for tests: + "databake", + "serde", +] + +[tests] +comments = [ + """\ + All doc tests use icu::collections, which would require the circular \ + (path-based) dev-dependency on the icu crate.\ + """, + """\ + Tests using databake may fail due to trivial differences in the string \ + representations of generated code, such as trailing commas without semantic \ + significance.\ + """, +] +run = [ + "lib", + "tests", +] +skip-exact = true +skip = [ + "codepointinvlist::cpinvlist::tests::databake", + "codepointtrie::cptrie::tests::databake", +] + +[requires] +build = [ + "tomcli", +] + +[scripts.prep] +pre = [ + "# Do not depend on postcard; it is needed only for one (skipped) test.", + "tomcli set Cargo.toml del dev-dependencies.postcard", + "# Avoid a dependency on the internal icu_benchmark_macros crate", + "rm -rv examples/", +] diff --git a/sources b/sources new file mode 100644 index 0000000..1e3a700 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (icu_collections-1.5.0.crate) = 127f1c91101ba69405b10a2590579606df766166fcf1fe6aa9a74c4900296425cba5c47a391a53a01b02026af5581f068fce4a7a400179809f7ed9922b94c0db