From 966a49d9c995789e14dbe52aba176bdb7e3cc5ee Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 4 Nov 2022 21:26:03 +0100 Subject: [PATCH] Drop unused, benchmark-only criterion dev-dependency --- 0001-quickcheck-1.0-port.patch | 50 ++++++++++++++++++++++++++ radix_trie-fix-metadata.diff | 66 +++++----------------------------- rust-radix_trie.spec | 46 ++++++++++++------------ 3 files changed, 81 insertions(+), 81 deletions(-) create mode 100644 0001-quickcheck-1.0-port.patch diff --git a/0001-quickcheck-1.0-port.patch b/0001-quickcheck-1.0-port.patch new file mode 100644 index 0000000..c5c218e --- /dev/null +++ b/0001-quickcheck-1.0-port.patch @@ -0,0 +1,50 @@ +diff --git a/src/qc_test.rs b/src/qc_test.rs +index bc76d65..1e02159 100644 +--- a/src/qc_test.rs ++++ b/src/qc_test.rs +@@ -16,18 +16,18 @@ const KEY_RUN_LEN: usize = 8; + const KEY_MAX_VAL: u8 = 4; + + impl Arbitrary for Key { +- fn arbitrary(g: &mut G) -> Key { +- let len = g.gen::() % KEY_RUN_LEN; ++ fn arbitrary(g: &mut Gen) -> Key { ++ let len = usize::arbitrary(g) % KEY_RUN_LEN; + let mut key = Vec::with_capacity(len); + for _ in 0..len { +- key.push(g.gen::() % KEY_MAX_VAL); ++ key.push(u8::arbitrary(g) % KEY_MAX_VAL); + } + Key(key) + } + } + + impl Key { +- fn extend_random(&self, g: &mut G) -> Key { ++ fn extend_random(&self, g: &mut Gen) -> Key { + self.extend(Key::arbitrary(g)) + } + +@@ -49,18 +49,18 @@ impl TrieKey for Key { + } + + impl Arbitrary for RandomKeys { +- fn arbitrary(g: &mut G) -> RandomKeys { +- let num_keys = g.gen::() % MAX_KEYS; ++ fn arbitrary(g: &mut Gen) -> RandomKeys { ++ let num_keys = usize::arbitrary(g) % MAX_KEYS; + let mut keys = Vec::with_capacity(num_keys); + keys.push(Key::arbitrary(g)); + + for _ in 0..num_keys { +- match g.gen::() % 10 { ++ match u8::arbitrary(g) % 10 { + // Generate a new random key. + 1 => keys.push(Key::arbitrary(g)), + // Extend an existing key. + _ => { +- let i = g.gen::() % keys.len(); ++ let i = usize::arbitrary(g) % keys.len(); + let key = keys[i].extend_random(g); + keys.push(key); + } diff --git a/radix_trie-fix-metadata.diff b/radix_trie-fix-metadata.diff index 7c21f38..471a377 100644 --- a/radix_trie-fix-metadata.diff +++ b/radix_trie-fix-metadata.diff @@ -1,8 +1,11 @@ -diff -Naur a/Cargo.toml b/Cargo.toml ---- a/Cargo.toml 2020-10-22 03:41:51.000000000 -0700 -+++ b/Cargo.toml 2021-06-25 11:28:55.575860642 -0700 -@@ -42,10 +42,10 @@ - version = "0.3" +--- radix_trie-0.2.1/Cargo.toml 2020-10-22T10:41:51+00:00 ++++ radix_trie-0.2.1/Cargo.toml 2022-11-04T20:21:08.133287+00:00 +@@ -38,14 +38,12 @@ + [dependencies.serde] + version = "1.0" + optional = true +-[dev-dependencies.criterion] +-version = "0.3" [dev-dependencies.quickcheck] -version = "0.4" @@ -14,56 +17,3 @@ diff -Naur a/Cargo.toml b/Cargo.toml [dev-dependencies.serde_test] version = "1.0" -diff -Naur a/src/qc_test.rs b/src/qc_test.rs ---- a/src/qc_test.rs 2019-11-16 23:50:28.000000000 -0800 -+++ b/src/qc_test.rs 2021-06-25 11:28:40.618805434 -0700 -@@ -13,21 +13,21 @@ - - const MAX_KEYS: usize = 512; - const KEY_RUN_LEN: usize = 8; --const KEY_MAX_VAL: u8 = 4; -+const KEY_MAX_VAL: usize = 4; - - impl Arbitrary for Key { -- fn arbitrary(g: &mut G) -> Key { -- let len = g.gen::() % KEY_RUN_LEN; -+ fn arbitrary(g: &mut Gen) -> Key { -+ let len = g.size() % KEY_RUN_LEN; - let mut key = Vec::with_capacity(len); - for _ in 0..len { -- key.push(g.gen::() % KEY_MAX_VAL); -+ key.push((g.size() % KEY_MAX_VAL) as u8); - } - Key(key) - } - } - - impl Key { -- fn extend_random(&self, g: &mut G) -> Key { -+ fn extend_random(&self, g: &mut Gen) -> Key { - self.extend(Key::arbitrary(g)) - } - -@@ -49,18 +49,18 @@ - } - - impl Arbitrary for RandomKeys { -- fn arbitrary(g: &mut G) -> RandomKeys { -- let num_keys = g.gen::() % MAX_KEYS; -+ fn arbitrary(g: &mut Gen) -> RandomKeys { -+ let num_keys = g.size() % MAX_KEYS; - let mut keys = Vec::with_capacity(num_keys); - keys.push(Key::arbitrary(g)); - - for _ in 0..num_keys { -- match g.gen::() % 10 { -+ match g.size() % 10 { - // Generate a new random key. - 1 => keys.push(Key::arbitrary(g)), - // Extend an existing key. - _ => { -- let i = g.gen::() % keys.len(); -+ let i = g.size() % keys.len(); - let key = keys[i].extend_random(g); - keys.push(key); - } diff --git a/rust-radix_trie.spec b/rust-radix_trie.spec index 219a14b..dbcaf4f 100644 --- a/rust-radix_trie.spec +++ b/rust-radix_trie.spec @@ -1,28 +1,27 @@ -# Generated by rust2rpm 17 +# Generated by rust2rpm 23 %bcond_without check %global debug_package %{nil} %global crate radix_trie -Name: rust-%{crate} +Name: rust-radix_trie Version: 0.2.1 Release: %autorelease Summary: Generic radix trie data-structure -# Upstream license specification: MIT License: MIT URL: https://crates.io/crates/radix_trie Source: %{crates_source} -# Bump rand to 0.8 and quickcheck to 1.0 -# https://github.com/michaelsproul/rust_radix_trie/pull/65 -Patch0: radix_trie-fix-metadata.diff +# Manually created patch for downstream crate metadata changes +# * bump quickcheck dev-dependency from 0.4 to 1.0 +# * bump rand dev-dependency from 0.3 to 0.8 +# * drop unused, benchmark-only criterion dev-dependency to speed up builds +Patch: radix_trie-fix-metadata.diff +# * port to quickcheck 1.0: +# https://github.com/michaelsproul/rust_radix_trie/commit/4618661 +Patch: 0001-quickcheck-1.0-port.patch -ExclusiveArch: %{rust_arches} -%if %{__cargo_skip_build} -BuildArch: noarch -%endif - -BuildRequires: rust-packaging +BuildRequires: rust-packaging >= 21 %global _description %{expand: Generic radix trie data-structure.} @@ -35,13 +34,14 @@ BuildArch: noarch %description devel %{_description} -This package contains library source intended for building other packages -which use "%{crate}" crate. +This package contains library source intended for building other packages which +use the "%{crate}" crate. %files devel -%license LICENSE -%doc examples README.md CHANGELOG.md -%{cargo_registry}/%{crate}-%{version_no_tilde}/ +%license %{crate_instdir}/LICENSE +%doc %{crate_instdir}/CHANGELOG.md +%doc %{crate_instdir}/README.md +%{crate_instdir}/ %package -n %{name}+default-devel Summary: %{summary} @@ -49,11 +49,11 @@ BuildArch: noarch %description -n %{name}+default-devel %{_description} -This package contains library source intended for building other packages -which use "default" feature of "%{crate}" crate. +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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %package -n %{name}+serde-devel Summary: %{summary} @@ -61,11 +61,11 @@ BuildArch: noarch %description -n %{name}+serde-devel %{_description} -This package contains library source intended for building other packages -which use "serde" feature of "%{crate}" crate. +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 %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml +%ghost %{crate_instdir}/Cargo.toml %prep %autosetup -n %{crate}-%{version_no_tilde} -p1