File lager.spec of Package lager

%define bname lager
Name: %bname
Version: 3.2.0
Release: 2
Summary: A logging framework for Erlang/OTP
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/basho/%bname
Source: %bname-%version.tar.xz
Patch0: %bname-%version-git.patch
Patch1: lager-3.2.0-filtermap.patch
BuildArch: noarch
Provides: erlang-%bname = %version-%release

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: erlang >= R14B03
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang-otp-base-devel

%description
Lager (as in the beer) is a logging framework for Erlang. Its purpose is to
provide a more traditional way to perform logging in an erlang application that
plays nicely with traditional UNIX logging tools like logrotate and syslog.


%prep
%setup -q -n %bname-%version
%patch0 -p1
%patch1 -p1
erl -noshell -eval '
A = "src/%bname.app.src",
{ok, [{application, %bname, L}]} = file:consult(A),
file:write_file(A, io_lib:format("{application, %bname, ~p}.~n", [lists:keystore(vsn, 1, L, {vsn, "%version"})])),
halt().'


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config",
                lists:map(fun(E) -> io_lib:format("~p.~n", [E]) end,
                          [lists:keystore(erl_opts, 1, proplists:delete(deps, L),
                                          {erl_opts,
                                           [no_debug_info, slim, inline|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]})])),
halt().'
for c in compile doc; do
	rebar -C %bname.rebar.config $c -v
done


%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/include
install -p -m 0644 include/* %buildroot%_otplibdir/%bname-%version/include/
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
ln -sf %_otplibdir/%name-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 README* TODO %buildroot%_docdir/%name/

%add_erlang_req_beam_skiplist lager_default_tracer


%if 0
%check
rebar -C %bname.rebar.config eunit
%endif


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


%changelog
* Sun May 30 2016 Led <ledest@gmail.com> 3.2.0-2
- git 154dfe6

* Sat Apr 09 2016 Led <ledest@gmail.com> 3.2.0-1
- 3.2.0
- remove patches:
  + Export-configure_sink-2-for-runtime-sink-config.patch
- add patches:
  + lager-3.2.0-filtermap.patch

* Mon Apr 04 2016 Led <ledest@gmail.com> 3.1.0-1
- 3.1.0
- update BuildRequires
- add patches:
  + Export-configure_sink-2-for-runtime-sink-config.patch

* Mon Feb 15 2016 Led <ledest@gmail.com> 3.0.3-1
- 3.0.3

* Sat Dec 05 2015 Led <ledest@gmail.com> 3.0.2-1
- 3.0.2
- remove patches:
  + lager-3.0.1-git.patch
- add patches:
  + 0001-Forward-port-292-to-3.x-branch.patch

* Sun Oct 11 2015 Led <ledest@gmail.com> 3.0.1-2
- fix BuildRequires

* Sun Oct 11 2015 Led <ledest@gmail.com> 3.0.1-1
- 3.0.1

* Sat Jul 25 2015 Led <ledest@gmail.com> 3.0.0-3
- ignore requires of lager_default_tracer module

* Sat Jul 25 2015 Led <ledest@gmail.com> 3.0.0-2
- fix URL

* Sat Jul 25 2015 Led <ledest@gmail.com> 3.0.0-1
- initial build
openSUSE Build Service is sponsored by