File kvc.spec of Package kvc

%define bname kvc
Name: %bname
Version: 1.7.0
Release: 2
Summary: Key Value Coding for Erlang data structures
License: MIT
Group: Development/Tools/Other
Source: %bname-%version.tar.xz
#Patch: %bname-%version-git.patch
Provides: erlang-%bname = %version-%release
BuildArch: noarch

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

kvc supports Key Value Coding-like queries on common Erlang data structures.
A common use case for kvc is to quickly access one or more deep values in decoded
JSON, or some other nested data structure. It can also help with some aggregate
operations. It solves similar problems that you might want to use a tool like
XPath or jQuery for, but it is far simpler and strictly less powerful. It's
inspired by Apple's NSKeyValueCoding protocol from Objective-C.

%setup -q -n %bname-%version
#patch -p1

erl -noshell -eval '
{ok, L} = file:consult("rebar.config"),
                lists:map(fun(E) -> [io_lib:print(E), ".\n"] end,
                          [{erl_opts, [slim, inline, no_debug_info|lists:delete(debug_info, proplists:get_value(erl_opts, L, []))]},
                           {edoc_opts, [{preprocess, true}|proplists:get_value(edoc_opts, L, [])]}
                           |lists:foldl(fun proplists:delete/2, L, [erl_opts, edoc_opts, deps, cover_enabled])]),
rebar %{?_smp_mflags} -C %bname.rebar.config compile -v
rebar %{?_smp_mflags} -C %bname.rebar.config doc -v

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

rebar -C %bname.rebar.config eunit -v

%doc %_docdir/%name

* Sat Aug 19 2017 Led <> 1.7.0-2
- update spec

* Thu Mar 24 2016 Led <> 1.7.0-1
- initial build