File erlang-pkix.spec of Package erlang-pkix

#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%define app_name pkix

Name:           erlang-%{app_name}
Version:        0
Release:        0
%define app_ver %(echo "%{version}" | cut -d "+" -f1)
License:        GPL-2.0
Summary:        PKIX certificates management library for Erlang
Url:            http://github.com/processone/zlib
Group:          Development/Libraries/Other
Source:         %{app_name}-%{version}.tar.xz
Requires:       erlang
BuildRequires:  erlang
BuildRequires:  erlang-rebar
Provides:       %{name}-devel = %{version}-%{release}
%description
The idea of the library is to simplify certificates configuration in Erlang programs.
Typically an Erlang program which needs certificates (for HTTPS/MQTT/XMPP/etc)
provides a bunch of options such as `certfile`, `chainfile`, `privkey`, etc.
The situation becomes even more complicated when a server supports so called `virtual domains`
because a program is typically required to match a virtual domain with its certificate.
If a user has plenty of virtual domains (stored somewhere in `/etc/letsencrypt/live/*/*.pem`)
it's quickly becoming a nightmare for them to configure all this. The complexity also leads to
errors: a single configuration mistake and a program generates obscure log messages,
unreadable Erlang tracebacks or, even worse, just silently ignores the errors. Fortunately,
the large part of certificates configuration can be automated, reducing a user configuration
to something as simple as:
```yaml
certfiles:
  - /etc/letsencrypt/live/*/*.pem
```
The purpose of the library is to do this dirty job under the hood.

%prep
%setup -q -n %{app_name}-%{version}

%build
%rebar compile

%install
for dir in ebin ; do
  mkdir -p %{buildroot}%{erlang_libdir}/%{app_name}-%{app_ver}/${dir}
  cp -r ${dir}/* %{buildroot}%{erlang_libdir}/%{app_name}-%{app_ver}/${dir}/
done

%check
%rebar eunit

%files
%defattr(-,root,root)
%doc LICENSE *.md
%dir %{erlang_libdir}/%{app_name}-%{app_ver}
%dir %{erlang_libdir}/%{app_name}-%{app_ver}/ebin
%{erlang_libdir}/%{app_name}-%{app_ver}/ebin/%{app_name}.app
%{erlang_libdir}/%{app_name}-%{app_ver}/ebin/*.beam

%changelog
openSUSE Build Service is sponsored by