File redo.spec of Package redo

%define bname redo
Name: %bname
Version: 2.0.0
Release: 3
Summary: A pipelined redis client written in Erlang
License: MIT
Group: Development/Tools/Other
#URL: https://github.com/jkvor/%bname
URL: https://github.com/heroku/%bname
Source: %bname-%version.tar.xz
Patch0: %bname-%version-git.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
# check
BuildRequires: redis

%description
Redo is a pipelined redis client written in Erlang. It lacks any sort of
syntactic sugar. The only API function is redo:cmd, which takes a raw redis
command.


%package doc
Summary: Documentation of %bname
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release
Conflicts: %name < 2.0.0-3

%description doc
Documentation of %bname.


%prep
%setup -q -n %bname-%version
%patch0 -p1
mv src/bench.erl src/redo_concurrency_test.erl test/


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config", [[io_lib:print(E), ".\n"] || E <- lists:keydelete(deps, 1, L)], [raw]),
init:stop().'
ERL_COMPILER_OPTIONS="[inline,verbose]" rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
rebar %{?_smp_mflags} -C %bname.rebar.config doc -v


%install
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/ebin
install -p -m 0644 ebin/* %buildroot%_otplibdir/%bname-%version/ebin/
install -d -m 0755 %buildroot%_otplibdir/%bname-%version/doc
install -p -m 0644 doc/*.{css,html,png} %buildroot%_otplibdir/%bname-%version/doc/
install -d -m 0755 %buildroot%_docdir/%name
install -p -m 0644 README* %buildroot%_docdir/%name/
ln -sf %_otplibdir/%bname-%version/doc %buildroot%_docdir/%name/html


%check
PATH=%_sbindir${PATH:+:$PATH} redis-server &
rebar -C %bname.rebar.config eunit && rc=0 || rc=1
kill %%1
exit $rc


%files
%defattr(-,root,root)
%_otplibdir/*
%exclude %_otplibdir/%bname-*/doc


%files doc
%defattr(-,root,root)
%doc %_docdir/%name
%doc %dir %_otplibdir/%bname-*
%doc %_otplibdir/%bname-*/doc


%changelog
* Thu Sep 10 2020 Led <ledest@gmail.com> 2.0.0-4
- git 456c700
- remove patches:
  + 0001-replace-erlang-now-0-to-os-timestamp-0.patch
  + 0002-add-rebar.config.patch
  + 0003-redo_concurrency_test-using-module-rand-for-Erlang-O.patch

* Fri Sep 28 2018 Led <ledest@gmail.com> 2.0.0-3
- move docs to separate subpackage

* Sat Jun 24 2017 Led <ledest@gmail.com> 2.0.0-2
- add patches:
  + 0001-replace-erlang-now-0-to-os-timestamp-0.patch
  + 0002-add-rebar.config.patch
  + 0003-redo_concurrency_test-using-module-rand-for-Erlang-O.patch

* Sat Jun 24 2017 Led <ledest@gmail.com> 2.0.0-1
- 2.0.0
- update URL

* Tue Mar 22 2016 Led <ledest@gmail.com> 1.1.0-2
- clean up BuildRequires

* Mon Apr 20 2015 Led <ledest@gmail.com> 1.1.0-1
- initial build
openSUSE Build Service is sponsored by