1 %define crates_ver 0.7.1
3 Summary: A viewer for git and diff output
9 Source0: https://github.com/dandavison/delta/archive/%{version}/%{name}-%{version}.tar.gz
10 # Source0-md5: a606fdeaf7c689aba27da79b13362f89
12 Source1: %{name}-crates-%{crates_ver}.tar.xz
13 # Source1-md5: 88f9be8b3bf03d2651690a010cc27766
14 URL: https://github.com/dandavison/delta
16 BuildRequires: rpmbuild(macros) >= 2.004
18 BuildRequires: tar >= 1:1.22
20 ExclusiveArch: %{rust_arches}
21 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24 Delta aims to make studying diffs both efficient and enjoyable: it
25 allows you to make extensive changes to the layout and styling of
26 diffs, as well as allowing you to stay arbitrarily close to the
27 default git/diff output, changing just the aspects that you want to
30 Delta's main features are:
32 - Language syntax highlighting with color themes
33 - Within-line highlights based on a Levenshtein edit inference
35 - Style (foreground color, background color, font attributes) can be
36 configured independently for more than 20 different sections of the
38 - Stylable box/line decorations to draw attention to commit, file and
40 - Line numbering (`-n`)
41 - `--diff-highlight` and `--diff-so-fancy` emulation modes
42 - Code can be copied directly from the diff (`-/+` markers are removed
44 - `n` and `N` keybindings to move between files in large diffs, and
45 between diffs in `log -p` views (`--navigate`) A viewer for git and
51 %{__mv} delta-%{crates_ver}/* .
52 sed -i -e 's/@@VERSION@@/%{version}/' Cargo.lock
54 # use our offline registry
55 export CARGO_HOME="$(pwd)/.cargo"
57 mkdir -p "$CARGO_HOME"
58 cat >.cargo/config <<EOF
60 registry = 'https://github.com/rust-lang/crates.io-index'
61 replace-with = 'vendored-sources'
63 [source.vendored-sources]
64 directory = '$PWD/vendor'
68 export CARGO_HOME="$(pwd)/.cargo"
73 rm -rf $RPM_BUILD_ROOT
74 export CARGO_HOME="$(pwd)/.cargo"
76 %cargo_install --frozen --root $RPM_BUILD_ROOT%{_prefix} --path $PWD
77 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
80 rm -rf $RPM_BUILD_ROOT
83 %defattr(644,root,root,755)
85 %attr(755,root,root) %{_bindir}/delta