]>
Commit | Line | Data |
---|---|---|
fa9e9502 JP |
1 | %define crates_ver 12.1.1 |
2 | ||
3 | Summary: Line oriented search tool using Rust's regex library | |
4 | Name: ripgrep | |
5 | Version: 12.1.1 | |
6 | Release: 1 | |
7 | License: MIT or Unlicense | |
8 | Group: Applications | |
9 | Source0: https://github.com/BurntSushi/ripgrep/archive/%{version}/%{name}-%{version}.tar.gz | |
10 | # Source0-md5: d3190853d47d51ad077a65aadbf55448 | |
11 | # ./create-crates.sh | |
12 | Source1: %{name}-crates-%{crates_ver}.tar.xz | |
13 | # Source1-md5: 9edecedd92d2a028eff4d41fb3d8a800 | |
14 | URL: https://github.com/BurntSushi/ripgrep | |
15 | BuildRequires: cargo | |
16 | BuildRequires: rpmbuild(macros) >= 2.004 | |
17 | BuildRequires: rust | |
18 | BuildRequires: tar >= 1:1.22 | |
19 | BuildRequires: xz | |
20 | ExclusiveArch: %{rust_arches} | |
21 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
22 | ||
23 | %description | |
24 | ripgrep is a line-oriented search tool that recursively searches your | |
25 | current directory for a regex pattern. By default, ripgrep will | |
26 | respect your .gitignore and automatically skip hidden | |
27 | files/directories and binary files. | |
28 | ||
59fdbee3 JP |
29 | %package -n bash-completion-ripgrep |
30 | Summary: Bash completion for ripgrep | |
31 | Group: Applications/Shells | |
32 | Requires: %{name} = %{version}-%{release} | |
33 | Requires: bash-completion >= 2.0 | |
34 | BuildArch: noarch | |
35 | ||
36 | %description -n bash-completion-ripgrep | |
37 | Bash completion for ripgrep. | |
38 | ||
39 | %package -n fish-completion-ripgrep | |
40 | Summary: fish-completion for ripgrep | |
41 | Group: Applications/Shells | |
42 | Requires: %{name} = %{version}-%{release} | |
43 | Requires: fish | |
44 | BuildArch: noarch | |
45 | ||
46 | %description -n fish-completion-ripgrep | |
47 | fish-completion for ripgrep. | |
48 | ||
fa9e9502 JP |
49 | %prep |
50 | %setup -q -a1 | |
51 | ||
52 | %{__mv} %{name}-%{crates_ver}/* . | |
53 | sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock | |
54 | ||
55 | # use our offline registry | |
56 | export CARGO_HOME="$(pwd)/.cargo" | |
57 | ||
58 | mkdir -p "$CARGO_HOME" | |
59 | cat >.cargo/config <<EOF | |
60 | [source.crates-io] | |
61 | registry = 'https://github.com/rust-lang/crates.io-index' | |
62 | replace-with = 'vendored-sources' | |
63 | ||
64 | [source.vendored-sources] | |
65 | directory = '$PWD/vendor' | |
66 | EOF | |
67 | ||
68 | %build | |
69 | export CARGO_HOME="$(pwd)/.cargo" | |
70 | ||
71 | %cargo_build --frozen | |
72 | ||
73 | %install | |
74 | rm -rf $RPM_BUILD_ROOT | |
75 | export CARGO_HOME="$(pwd)/.cargo" | |
76 | ||
77 | %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD | |
59fdbee3 JP |
78 | install -D target/release/build/%{name}-*/out/rg.1 $RPM_BUILD_ROOT%{_mandir}/man1/rg.1 |
79 | install -D target/release/build/%{name}-*/out/rg.bash $RPM_BUILD_ROOT%{bash_compdir}/rg | |
80 | install -D target/release/build/%{name}-*/out/rg.fish $RPM_BUILD_ROOT%{fish_compdir}/rg.fish | |
81 | ||
fa9e9502 JP |
82 | %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates* |
83 | ||
84 | %clean | |
85 | rm -rf $RPM_BUILD_ROOT | |
86 | ||
87 | %files | |
88 | %defattr(644,root,root,755) | |
89 | %doc CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md UNLICENSE | |
90 | %attr(755,root,root) %{_bindir}/rg | |
59fdbee3 JP |
91 | %{_mandir}/man1/rg.1* |
92 | ||
93 | %files -n bash-completion-ripgrep | |
94 | %defattr(644,root,root,755) | |
95 | %{bash_compdir}/rg | |
96 | ||
97 | %files -n fish-completion-ripgrep | |
98 | %defattr(644,root,root,755) | |
99 | %{fish_compdir}/rg.fish |