From 95e3abd87251bb4a5618d6e63edcad95a124a728 Mon Sep 17 00:00:00 2001 From: Randy Barlow Date: Tue, 11 Feb 2020 16:47:22 -0500 Subject: [PATCH] Initial import Signed-off-by: Randy Barlow --- .gitignore | 1 + 0000-Update-to-rand-0.7.patch | 51 ++++++++++++++++++++++ rust-float-ord.spec | 79 +++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 132 insertions(+) create mode 100644 .gitignore create mode 100644 0000-Update-to-rand-0.7.patch create mode 100644 rust-float-ord.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce0693d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/float-ord-0.2.0.crate diff --git a/0000-Update-to-rand-0.7.patch b/0000-Update-to-rand-0.7.patch new file mode 100644 index 0000000..493b293 --- /dev/null +++ b/0000-Update-to-rand-0.7.patch @@ -0,0 +1,51 @@ +diff -ru float-ord-0.2.0/Cargo.toml float-ord-0.2.0.patched/Cargo.toml +--- float-ord-0.2.0/Cargo.toml 1969-12-31 19:00:00.000000000 -0500 ++++ float-ord-0.2.0.patched/Cargo.toml 2020-01-28 16:36:06.742269458 -0500 +@@ -20,6 +20,6 @@ + license = "MIT / Apache-2.0" + repository = "https://github.com/notriddle/rust-float-ord" + [dev-dependencies.rand] +-version = "0.3" ++version = "0.7" + [badges.travis-ci] + repository = "notriddle/rust-float-ord" +diff -ru float-ord-0.2.0/src/lib.rs float-ord-0.2.0.patched/src/lib.rs +--- float-ord-0.2.0/src/lib.rs 2018-01-30 14:28:28.000000000 -0500 ++++ float-ord-0.2.0.patched/src/lib.rs 2020-01-28 17:08:50.441756013 -0500 +@@ -78,6 +78,7 @@ + extern crate rand; + + use self::rand::{Rng, thread_rng}; ++ use self::std::iter; + use self::std::prelude::v1::*; + use self::std::collections::hash_map::DefaultHasher; + use self::std::hash::{Hash, Hasher}; +@@ -108,8 +109,8 @@ + let mut rng = thread_rng(); + for n in 0..16 { + for l in 0..16 { +- let v = rng.gen_iter::() +- .map(|x| x % (1 << l) as i64 as f64) ++ let v = iter::repeat(()).map(|()| rng.gen()) ++ .map(|x: f64| x % (1 << l) as i64 as f64) + .take((1 << n)) + .collect::>(); + assert!(v.windows(2).all(|w| (w[0] <= w[1]) == (FloatOrd(w[0]) <= FloatOrd(w[1])))); +@@ -140,14 +141,14 @@ + let mut rng = thread_rng(); + for n in 0..16 { + for l in 0..16 { +- let mut v = rng.gen_iter::() +- .map(|x| x % (1 << l) as i64 as f64) ++ let mut v = iter::repeat(()).map(|()| rng.gen()) ++ .map(|x: f64| x % (1 << l) as i64 as f64) + .take((1 << n)) + .collect::>(); + let mut v1 = v.clone(); + + super::sort(&mut v); +- assert!(v.windows(2).all(|w| w[0] <= w[1])); ++ assert!(v.windows(2).all(|w: &[f64]| w[0] <= w[1])); + + v1.sort_by(|a, b| a.partial_cmp(b).unwrap()); + assert!(v1.windows(2).all(|w| w[0] <= w[1])); diff --git a/rust-float-ord.spec b/rust-float-ord.spec new file mode 100644 index 0000000..e67a157 --- /dev/null +++ b/rust-float-ord.spec @@ -0,0 +1,79 @@ +# Generated by rust2rpm 13 +%bcond_without check +%global debug_package %{nil} + +%global crate float-ord + +Name: rust-%{crate} +Version: 0.2.0 +Release: 1%{?dist} +Summary: Total ordering for floating-point numbers + +# Upstream license specification: MIT / Apache-2.0 +License: MIT or ASL 2.0 +URL: https://crates.io/crates/float-ord +Source: %{crates_source} +# https://github.com/notriddle/rust-float-ord/pull/7 +Patch0: 0000-Update-to-rand-0.7.patch + +ExclusiveArch: %{rust_arches} +%if %{__cargo_skip_build} +BuildArch: noarch +%endif + +BuildRequires: dos2unix +BuildRequires: rust-packaging + +%global _description %{expand: +Total ordering for floating-point numbers.} + +%description %{_description} + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages +which use "%{crate}" crate. + +%files devel +%license LICENSE-APACHE LICENSE-MIT +%doc README.md +%{cargo_registry}/%{crate}-%{version_no_tilde}/ + +%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 "default" feature of "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version_no_tilde} -p1 +dos2unix README.md +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%changelog +* Wed Jan 22 09:44:50 EST 2020 Randy Barlow - 0.2.0-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..f92f163 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (float-ord-0.2.0.crate) = 10049cd4331b0330267a1f0959e453077f94d4b99c4c4450f0967618ccdc8514a45ef75a243f57aa225a1ac125cee4d03e1e3416a8928ccff977af7fe7927093