File partisan.spec of Package partisan

%define bname partisan
Name: %bname
Version: 2.1.0
Release: 1
Summary: TCP-based membership system for Erlang/Elixir
License: Apache-2.0
Group: Development/Tools/Other
URL: https://github.com/lasp-lang/%bname
Source: %bname-%version.tar.xz
#Patch0: %bname-%version-git.patch
Patch1: %bname-2.1.0-doc.patch
Patch11: 0011-remove-rand_compat-and-time_compat-deps.patch
Provides: erlang-%bname = %version-%release
BuildArch: noarch

BuildRequires: rpm-macros-erlang rpm-build-erlang
BuildRequires: rebar >= 2.6.1-7
BuildRequires: erlang-lager-devel >= 3.5
BuildRequires: acceptor_pool >= 1.0.0
# check
#BuildRequires: epmd erlang-common_test erlang-lager erlang-ssl erlang-types erlang-crypto

%description
Partisan is a flexible, TCP-based membership system for Erlang/Elixir.
Partisan features:
  - Single node testing, facilitated by a disterl control channel for figuring
    out which ports the peer service is operating at.
  - Messages are sent via TCP connections that are maintained to all cluster
    members.
  - Failure detection is performed TCP.
  - Connections are verified at each gossip round.
  - Configurable fanout.
  - On join, gossip is performed immediately, instead of having to wait for the
    next gossip round.
  - HyParView implementation.
Partisan has many available peer service managers:
  - Full membership with TCP-based failure detection:
    partisan_default_peer_service_manager.
  - Client/server topology: partisan_client_server_peer_service_manager.
  - HyParView, hybrid partial view membership protocol, with TCP-based failure
    detection: partisan_hyparview_peer_service_manager.
  - Static topology: partisan_static_peer_service_manager.
  - AMQP topology: partisan_amqp_peer_service_manager.


%package devel
Summary: Headers of %bname
Group: Development/Tools/Other
Provides: erlang-%bname-devel = %version-%release

%description devel
Headers of %bname.


%package doc
Summary: Documentation of %bname
Group: Documentation/HTML
Provides: erlang-%bname-doc = %version-%release

%description doc
Documentation of %bname.


%prep
%setup -q -n %bname-%version
#patch0 -p1
%patch1 -p1
%patch11 -p1


%build
erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
file:write_file("%bname.rebar.config",
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end, 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/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/%bname-%version/doc %buildroot%_docdir/%name/html
install -p -m 0644 *.md %buildroot%_docdir/%name/


%check
ERL_COMPILER_OPTIONS="[nowarn_export_all,inline,verbose]" rebar eunit -v
#ERL_COMPILER_OPTIONS="[inline,verbose]" rebar ct


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


%files devel
%defattr(-,root,root)
%dir %_otplibdir/%bname-*
%_otplibdir/%bname-*/include


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


%changelog
* Mon Jun 11 2018 Led <ledest@gmail.com> 2.1.0-1
- 2.1.0
- update patches:
  + partisan-2.1.0-doc.patch
  + 0011-remove-rand_compat-and-time_compat-deps.patch

* Sun Dec 17 2017 Led <ledest@gmail.com> 1.4.1-2
- add nowarn_export_all to %%check

* Tue Dec 12 2017 Led <ledest@gmail.com> 1.4.1-1
- initial build
openSUSE Build Service is sponsored by