1 |
%define tarname apache-couchdb |
2 |
%define couchdb_user couchdb |
3 |
%define couchdb_group couchdb |
4 |
%define couchdb_home %{_localstatedir}/lib/couchdb |
5 |
|
6 |
Name: couchdb |
7 |
Version: 1.2.0 |
8 |
Release: %mkrel 2 |
9 |
Summary: A document database server, accessible via a RESTful JSON API |
10 |
Group: Databases |
11 |
License: Apache License |
12 |
URL: http://couchdb.apache.org/ |
13 |
Source0: http://www.apache.org/dist/%{name}/releases/%{version}/%{tarname}-%{version}.tar.gz |
14 |
Source1: %{name}.service |
15 |
Source2: %{name}.tmpfiles.conf |
16 |
|
17 |
BuildRequires: erlang-devel erlang-compiler erlang-crypto erlang-eunit |
18 |
BuildRequires: libicu-devel |
19 |
BuildRequires: js-devel |
20 |
BuildRequires: help2man |
21 |
BuildRequires: curl-devel |
22 |
|
23 |
Requires: couchdb-bin |
24 |
|
25 |
Requires(pre): shadow-utils |
26 |
|
27 |
%description |
28 |
Apache CouchDB is a distributed, fault-tolerant and schema-free |
29 |
document-oriented database accessible via a RESTful HTTP/JSON API. |
30 |
Among other features, it provides robust, incremental replication |
31 |
with bi-directional conflict detection and resolution, and is |
32 |
queryable and indexable using a table-oriented view engine with |
33 |
JavaScript acting as the default view definition language. |
34 |
|
35 |
This package contains the systemd unit needed to start a systemwide |
36 |
instance of CouchDB. |
37 |
|
38 |
%package bin |
39 |
Group: Databases |
40 |
Summary: Binary for Couchdb, a document database server |
41 |
|
42 |
Requires: erlang |
43 |
Requires: erlang-crypto |
44 |
Requires: erlang-ssl |
45 |
Requires: erlang-xmerl |
46 |
Requires: erlang-inets |
47 |
Requires: erlang-tools |
48 |
Requires: erlang-public_key |
49 |
Requires: erlang-os_mon |
50 |
|
51 |
%description bin |
52 |
Apache CouchDB is a distributed, fault-tolerant and schema-free |
53 |
document-oriented database accessible via a RESTful HTTP/JSON API. |
54 |
Among other features, it provides robust, incremental replication |
55 |
with bi-directional conflict detection and resolution, and is |
56 |
queryable and indexable using a table-oriented view engine with |
57 |
JavaScript acting as the default view definition language. |
58 |
|
59 |
This package contains the binary needed to run a CouchDB instance. |
60 |
|
61 |
|
62 |
%prep |
63 |
%setup -q -n %{tarname}-%{version} |
64 |
|
65 |
|
66 |
%build |
67 |
autoreconf -fi |
68 |
%configure2_5x \ |
69 |
--with-js-include=%{_includedir}/js \ |
70 |
--with-erlang=%{_libdir}/erlang%{_includedir} |
71 |
|
72 |
%make |
73 |
|
74 |
|
75 |
%install |
76 |
%makeinstall_std |
77 |
|
78 |
# Libdir for systemd unit |
79 |
sed -i -e 's|@LIBDIR@|%{_libdir}|' %{SOURCE1} |
80 |
|
81 |
# Install systemd unit |
82 |
install -D -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service |
83 |
|
84 |
# Install /etc/tmpfiles.d entry |
85 |
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf |
86 |
|
87 |
# Create /var/log/couchdb |
88 |
mkdir -p %{buildroot}%{_localstatedir}/log/%{name} |
89 |
|
90 |
# Create /var/run/couchdb |
91 |
mkdir -p %{buildroot}%{_localstatedir}/run/%{name} |
92 |
|
93 |
# Create /var/lib/couchdb |
94 |
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name} |
95 |
|
96 |
# Create /etc/couchdb/default.d |
97 |
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/default.d |
98 |
|
99 |
# Create /etc/couchdb/local.d |
100 |
mkdir -p %{buildroot}%{_sysconfdir}/%{name}/local.d |
101 |
|
102 |
## Use /etc/sysconfig instead of /etc/default |
103 |
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig |
104 |
mv %{buildroot}%{_sysconfdir}/default/couchdb \ |
105 |
%{buildroot}%{_sysconfdir}/sysconfig/%{name} |
106 |
rm -rf %{buildroot}%{_sysconfdir}/default |
107 |
|
108 |
# Remove unecessary files |
109 |
rm %{buildroot}%{_sysconfdir}/rc.d/couchdb |
110 |
rm -rf %{buildroot}%{_datadir}/doc/couchdb |
111 |
|
112 |
# clean-up .la archives |
113 |
find %{buildroot} -name '*.la' -exec rm -f {} ';' |
114 |
|
115 |
|
116 |
%pre bin |
117 |
%_pre_useradd %{couchdb_user} %{couchdb_home} /bin/bash |
118 |
|
119 |
|
120 |
%post |
121 |
%_post_service %{name} |
122 |
|
123 |
|
124 |
%postun bin |
125 |
%_postun_userdel %{couchdb_user} |
126 |
|
127 |
|
128 |
%preun |
129 |
%_preun_service %{name} |
130 |
|
131 |
|
132 |
%files |
133 |
%doc AUTHORS BUGS CHANGES LICENSE NEWS NOTICE README THANKS |
134 |
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
135 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
136 |
%{_unitdir}/%{name}.service |
137 |
|
138 |
%files bin |
139 |
%{_bindir}/* |
140 |
%dir %{_sysconfdir}/%{name} |
141 |
%dir %{_sysconfdir}/%{name}/local.d |
142 |
%dir %{_sysconfdir}/%{name}/default.d |
143 |
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/default.ini |
144 |
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/local.ini |
145 |
%{_sysconfdir}/tmpfiles.d/%{name}.conf |
146 |
%{_libdir}/%{name} |
147 |
%{_datadir}/%{name} |
148 |
%{_mandir}/man1/* |
149 |
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/log/%{name} |
150 |
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/run/%{name} |
151 |
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/lib/%{name} |