diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc68abe --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/sha1-0.2.0.crate diff --git a/0001-Update-openssl-dependency-from-0.7-to-0.9.patch b/0001-Update-openssl-dependency-from-0.7-to-0.9.patch new file mode 100644 index 0000000..e777b0f --- /dev/null +++ b/0001-Update-openssl-dependency-from-0.7-to-0.9.patch @@ -0,0 +1,36 @@ +From 04c65ea41ddd2fb20ae56517ed6ce9be2e5d3d8f Mon Sep 17 00:00:00 2001 +From: Casey Rodarmor +Date: Fri, 24 Feb 2017 17:07:53 -0800 +Subject: [PATCH] Update openssl dependency from 0.7 to 0.9 + +--- + src/lib.rs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index 33f24d1..738f95c 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -319,8 +319,8 @@ mod tests { + let mut bytes = [0; 512]; + + for _ in 0..20 { +- let ty = openssl::crypto::hash::Type::SHA1; +- let mut r = openssl::crypto::hash::Hasher::new(ty); ++ let ty = openssl::hash::MessageDigest::sha1(); ++ let mut r = openssl::hash::Hasher::new(ty).unwrap(); + m.reset(); + for _ in 0..50 { + let len = rng.gen::() % bytes.len(); +@@ -328,7 +328,7 @@ mod tests { + m.update(&bytes[..len]); + r.write(&bytes[..len]).unwrap(); + } +- assert_eq!(r.finish(), m.digest().bytes()); ++ assert_eq!(r.finish().unwrap(), m.digest().bytes()); + } + } + } +-- +2.15.0 + diff --git a/rust-sha1.spec b/rust-sha1.spec new file mode 100644 index 0000000..6fd50d5 --- /dev/null +++ b/rust-sha1.spec @@ -0,0 +1,71 @@ +# Generated by rust2rpm +%bcond_without check +%global debug_package %{nil} + +%global crate sha1 + +Name: rust-%{crate} +Version: 0.2.0 +Release: 3%{?dist} +Summary: Minimal implementation of SHA1 for Rust + +License: BSD +URL: https://crates.io/crates/sha1 +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * Bump openssl to 0.9, https://github.com/mitsuhiko/rust-sha1/pull/19 +Patch0: sha1-0.2.0-fix-metadata.diff +# Make it work with new openssl +Patch1: 0001-Update-openssl-dependency-from-0.7-to-0.9.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +%if %{with check} +# [dev-dependencies] +BuildRequires: (crate(openssl) >= 0.9.0 with crate(openssl) < 0.10.0) +BuildRequires: (crate(rand) >= 0.3.0 with crate(rand) < 0.4.0) +%endif + +%description +%{summary}. + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel +Minimal implementation of SHA1 for Rust. + +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 +%doc README.md +%{cargo_registry}/%{crate}-%{version}/ + +%changelog +* Wed Nov 29 2017 Igor Gnatenko - 0.2.0-3 +- Update patch + +* Wed Jun 14 2017 Igor Gnatenko - 0.2.0-2 +- Port to use rust-packaging + +* Mon Apr 03 2017 Igor Gnatenko - 0.2.0-1 +- Initial package diff --git a/sha1-0.2.0-fix-metadata.diff b/sha1-0.2.0-fix-metadata.diff new file mode 100644 index 0000000..efa3bba --- /dev/null +++ b/sha1-0.2.0-fix-metadata.diff @@ -0,0 +1,9 @@ +--- sha1-0.2.0/Cargo.toml 2016-07-13T16:22:04+02:00 ++++ sha1-0.2.0/Cargo.toml 2017-11-29T18:04:05.810482+01:00 +@@ -8,5 +8,5 @@ + repository = "https://github.com/mitsuhiko/rust-sha1" + + [dev-dependencies] +-openssl = "0.7" ++openssl = "0.9" + rand = "0.3" diff --git a/sources b/sources new file mode 100644 index 0000000..a5e883f --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (sha1-0.2.0.crate) = 2b0a48e1c0e498e2148b6c78245a3db3e2d825fc76257f78d85dcc730235c415a25943b9ab639e10e11d0a5c18528fea81830314c685bc120e8e8b613d27e8ac