diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2746495 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/wu-diff-0.1.2.crate diff --git a/rust-wu-diff.spec b/rust-wu-diff.spec new file mode 100644 index 0000000..95e8f34 --- /dev/null +++ b/rust-wu-diff.spec @@ -0,0 +1,77 @@ +# Generated by rust2rpm 23 +%bcond_without check +%global debug_package %{nil} + +%global crate wu-diff + +Name: rust-wu-diff +Version: 0.1.2 +Release: %autorelease +Summary: Compute differences between two slices using wu(the O(NP)) algorithm + +License: MIT +URL: https://crates.io/crates/wu-diff +Source: %{crates_source} +# Manually created patch for downstream crate metadata changes +# - bump base64 to 0.13 +# - bump image to 0.24 +# - remove ancient clippy dependency +# - remove criterion which is only used for benchmarking +Patch: wu-diff-fix-metadata.diff +# fix test to compile against image >= 0.23 +# https://github.com/bokuweb/wu-diff-rs/pull/8 +Patch: wu-diff-fix-test-for-image-0.23-no-raw_pixels.diff + +BuildRequires: rust-packaging >= 21 + +%global _description %{expand: +Compute differences between two slices using wu(the O(NP)) algorithm.} + +%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 + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +%autochangelog diff --git a/sources b/sources new file mode 100644 index 0000000..1d63c9d --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (wu-diff-0.1.2.crate) = 6d93c8854dba66f48f736db3f9e997d11d07a0fef3e13219716e553c0f5936f1d00468b88d9164329cfd195271aa242ec7dfd58560074f1a41e8558719ba5af0 diff --git a/wu-diff-fix-metadata.diff b/wu-diff-fix-metadata.diff new file mode 100644 index 0000000..d303037 --- /dev/null +++ b/wu-diff-fix-metadata.diff @@ -0,0 +1,20 @@ +--- wu-diff-0.1.2/Cargo.toml 1970-01-01T00:00:00+00:00 ++++ wu-diff-0.1.2/Cargo.toml 2023-01-04T20:15:21.374005+00:00 +@@ -23,14 +23,9 @@ + [[bench]] + name = "benches" + harness = false +-[dependencies.clippy] +-version = "0.0.209" +-optional = true ++ + [dev-dependencies.base64] +-version = "0.9.0" +- +-[dev-dependencies.criterion] +-version = "0.2" ++version = "0.13" + + [dev-dependencies.image] +-version = "0.18.0" ++version = "0.24" diff --git a/wu-diff-fix-test-for-image-0.23-no-raw_pixels.diff b/wu-diff-fix-test-for-image-0.23-no-raw_pixels.diff new file mode 100644 index 0000000..9bd2ba0 --- /dev/null +++ b/wu-diff-fix-test-for-image-0.23-no-raw_pixels.diff @@ -0,0 +1,14 @@ +In `image` 0.23 and above, `raw_pixels` is now `to_bytes`: + +https://github.com/image-rs/image/commit/67a327b3aa83be00580cd8a4e8d2538c730f6cb2#diff-c5963e01c09615b1b65648d16468d47a95c8eaee3daf8e830665f48a0c17ad90 +--- a/tests/lib.rs ++++ b/tests/lib.rs +@@ -37,7 +37,7 @@ mod tests { + + fn create_encoded_rows(image: &DynamicImage) -> Vec { + image +- .raw_pixels() ++ .as_bytes().to_vec() + .chunks(image.dimensions().0 as usize * 4) + .map(|chunk| encode(chunk)) + .collect()