From 07077f9d0b7274cc730886835c99603cc05f886e Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Nov 13 2017 20:45:24 +0000 Subject: initial import Signed-off-by: Igor Gnatenko --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ca392d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/ripgrep-0.7.1.crate diff --git a/0001-Update-to-memmap-0.6.patch b/0001-Update-to-memmap-0.6.patch new file mode 100644 index 0000000..1d3031d --- /dev/null +++ b/0001-Update-to-memmap-0.6.patch @@ -0,0 +1,39 @@ +From e7e087a5eee08454e4d90f2fb4e0714c7d38a905 Mon Sep 17 00:00:00 2001 +From: Dan Burkert +Date: Sat, 28 Oct 2017 15:32:43 -0700 +Subject: [PATCH] Update to memmap 0.6 + +`memmap` 0.6.0 introduces major API changes in anticipation of a 1.0 +release. See https://github.com/danburkert/memmap-rs/releases/tag/0.6.0 +for more information. CC danburkert/memmap-rs#33. +--- + src/worker.rs | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/worker.rs b/src/worker.rs +index 51b7f64..9aa0fdc 100644 +--- a/src/worker.rs ++++ b/src/worker.rs +@@ -5,7 +5,7 @@ use std::path::Path; + use encoding_rs::Encoding; + use grep::Grep; + use ignore::DirEntry; +-use memmap::{Mmap, Protection}; ++use memmap::Mmap; + use termcolor::WriteColor; + + use decoder::DecodeReader; +@@ -290,8 +290,8 @@ impl Worker { + // regular read calls. + return self.search(printer, path, file); + } +- let mmap = try!(Mmap::open(file, Protection::Read)); +- let buf = unsafe { mmap.as_slice() }; ++ let mmap = unsafe { try!(Mmap::map(file)) }; ++ let buf = &*mmap; + if buf.len() >= 3 && Encoding::for_bom(buf).is_some() { + // If we have a UTF-16 bom in our memory map, then we need to fall + // back to the stream reader, which will do transcoding. +-- +2.15.0 + diff --git a/ripgrep-0.7.1-fix-metadata.diff b/ripgrep-0.7.1-fix-metadata.diff new file mode 100644 index 0000000..58ea58b --- /dev/null +++ b/ripgrep-0.7.1-fix-metadata.diff @@ -0,0 +1,24 @@ +--- ripgrep-0.7.1/Cargo.toml 1970-01-01T01:00:00+01:00 ++++ ripgrep-0.7.1/Cargo.toml 2017-11-13T19:08:07.316443+01:00 +@@ -57,10 +57,10 @@ + version = "0.1.7" + + [dependencies.memmap] +-version = "0.5" ++version = "0.6" + + [dependencies.bytecount] +-version = "0.1.4" ++version = "0.2" + + [dependencies.num_cpus] + version = "1" +@@ -90,8 +90,6 @@ + version = "0.2" + + [features] +-simd-accel = ["bytecount/simd-accel", "regex/simd-accel", "encoding_rs/simd-accel"] +-avx-accel = ["bytecount/avx-accel"] + [badges.travis-ci] + repository = "BurntSushi/ripgrep" + diff --git a/rust-ripgrep.spec b/rust-ripgrep.spec new file mode 100644 index 0000000..a2dd01f --- /dev/null +++ b/rust-ripgrep.spec @@ -0,0 +1,113 @@ +# Generated by rust2rpm +%bcond_without check + +%global crate ripgrep + +Name: rust-%{crate} +Version: 0.7.1 +Release: 1%{?dist} +Summary: Line oriented search tool using Rust's regex library + +License: Unlicense or MIT +URL: https://crates.io/crates/ripgrep +Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate +# Initial patched metadata +# * No simd +# * Bump memmap to 0.6, https://github.com/BurntSushi/ripgrep/pull/657 +# * Bump bytecount to 0.2, https://github.com/BurntSushi/ripgrep/pull/679 +Patch0: ripgrep-0.7.1-fix-metadata.diff +# Really make code compatible with memmap v0.6 +Patch1: 0001-Update-to-memmap-0.6.patch + +ExclusiveArch: %{rust_arches} + +BuildRequires: rust-packaging +# [dependencies] +BuildRequires: (crate(atty) >= 0.2.2 with crate(atty) < 0.3.0) +BuildRequires: (crate(bytecount) >= 0.2.0 with crate(bytecount) < 0.3.0) +BuildRequires: (crate(clap) >= 2.26.0 with crate(clap) < 3.0.0) +BuildRequires: (crate(encoding_rs) >= 0.7.0 with crate(encoding_rs) < 0.8.0) +BuildRequires: (crate(env_logger) >= 0.4.0 with crate(env_logger) < 0.5.0) +BuildRequires: (crate(grep) >= 0.1.7 with crate(grep) < 0.2.0) +BuildRequires: (crate(ignore) >= 0.3.1 with crate(ignore) < 0.4.0) +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) +BuildRequires: (crate(libc) >= 0.2.0 with crate(libc) < 0.3.0) +BuildRequires: (crate(log) >= 0.3.0 with crate(log) < 0.4.0) +BuildRequires: (crate(memchr) >= 2.0.0 with crate(memchr) < 3.0.0) +BuildRequires: (crate(memmap) >= 0.6.0 with crate(memmap) < 0.7.0) +BuildRequires: (crate(num_cpus) >= 1.0.0 with crate(num_cpus) < 2.0.0) +BuildRequires: (crate(regex) >= 0.2.1 with crate(regex) < 0.3.0) +BuildRequires: (crate(same-file) >= 1.0.0 with crate(same-file) < 2.0.0) +BuildRequires: (crate(termcolor) >= 0.3.3 with crate(termcolor) < 0.4.0) +# [build-dependencies] +BuildRequires: (crate(clap) >= 2.26.0 with crate(clap) < 3.0.0) +BuildRequires: (crate(lazy_static) >= 0.2.0 with crate(lazy_static) < 0.3.0) + +%description +%{summary}. + +%package -n %{crate} +Summary: %{summary} + +%description -n %{crate} +Line oriented search tool using Rust's regex library. Combines +the raw performance of grep with the usability of the silver searcher. + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%build +%cargo_build + +%install +%cargo_install +%{__install} -Dpm0644 -t %{buildroot}%{_mandir}/man1 doc/rg.1 + +%if %{with check} +%check +%cargo_test +%endif + +%files -n %{crate} +%license LICENSE-MIT UNLICENSE COPYING +%doc README.md CHANGELOG.md +%{_bindir}/rg +%{_mandir}/man1/rg.1* + +%changelog +* Mon Nov 13 2017 Igor Gnatenko - 0.7.1-1 +- Update to 0.7.1 + +* Wed Jul 05 2017 Igor Gnatenko - 0.5.2-3 +- Rebuild for clap + +* Thu Jun 15 2017 Igor Gnatenko - 0.5.2-2 +- Bump encoding_rs to 0.6 + +* Wed Jun 14 2017 Igor Gnatenko - 0.5.2-1 +- Update to 0.5.2 + +* Wed Jun 14 2017 Igor Gnatenko - 0.5.0-2 +- Port to use rust-packaging + +* Wed Mar 15 2017 Igor Gnatenko - 0.5.0-1 +- Update to 0.5.0 + +* Sat Mar 11 2017 Igor Gnatenko - 0.4.0-6 +- Rename with rust prefix + +* Sun Feb 26 2017 Igor Gnatenko - 0.4.0-5 +- Rebuild + +* Sun Feb 26 2017 Igor Gnatenko - 0.4.0-4 +- Ship manpage + +* Sun Feb 26 2017 Igor Gnatenko - 0.4.0-3 +- Rebuild (termcolor) + +* Sun Feb 26 2017 Igor Gnatenko - 0.4.0-2 +- Rebuild (memmap) + +* Sun Feb 26 2017 Igor Gnatenko - 0.4.0-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..3749167 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (ripgrep-0.7.1.crate) = e8f84241b464c83599ca5162e5dec71a052689795140414dfa631945c258237b02cf22e87851daaa4a450be90f14270ac7d1372119488038cc8c449318e19e40