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.1 |
8 |
Release: %mkrel 3 |
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 |
Requires(post): systemd >= %{systemd_required_version} |
51 |
|
52 |
%description bin |
53 |
Apache CouchDB is a distributed, fault-tolerant and schema-free |
54 |
document-oriented database accessible via a RESTful HTTP/JSON API. |
55 |
Among other features, it provides robust, incremental replication |
56 |
with bi-directional conflict detection and resolution, and is |
57 |
queryable and indexable using a table-oriented view engine with |
58 |
JavaScript acting as the default view definition language. |
59 |
|
60 |
This package contains the binary needed to run a CouchDB instance. |
61 |
|
62 |
|
63 |
%prep |
64 |
%setup -q -n %{tarname}-%{version} |
65 |
|
66 |
# fix build with new automake 1.13 |
67 |
sed -i -e 's,AM_CONFIG_HEADER,AC_CONFIG_HEADERS,g' configure.* |
68 |
|
69 |
%build |
70 |
autoreconf -fi |
71 |
%configure2_5x \ |
72 |
--with-js-include=%{_includedir}/js \ |
73 |
--with-erlang=%{_libdir}/erlang%{_includedir} |
74 |
|
75 |
%make |
76 |
|
77 |
|
78 |
%install |
79 |
%makeinstall_std |
80 |
|
81 |
# Libdir for systemd unit |
82 |
sed -i -e 's|@LIBDIR@|%{_libdir}|' %{SOURCE1} |
83 |
|
84 |
# Install systemd unit |
85 |
install -D -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service |
86 |
|
87 |
# Install tmpfiles entry |
88 |
install -D -m 644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf |
89 |
|
90 |
# Create /var/log/couchdb |
91 |
mkdir -p %{buildroot}%{_localstatedir}/log/%{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' -delete |
114 |
|
115 |
|
116 |
%pre bin |
117 |
%_pre_useradd %{couchdb_user} %{couchdb_home} /bin/bash |
118 |
|
119 |
|
120 |
%post |
121 |
%_post_service %{name} |
122 |
|
123 |
%post bin |
124 |
# (cg) NB This should really be before the _post_service above... but packaging |
125 |
# here seems really bizare with it's split... |
126 |
%_tmpfilescreate %{name} |
127 |
|
128 |
%postun bin |
129 |
%_postun_userdel %{couchdb_user} |
130 |
|
131 |
|
132 |
%preun |
133 |
%_preun_service %{name} |
134 |
|
135 |
|
136 |
%files |
137 |
%doc AUTHORS BUGS CHANGES LICENSE NEWS NOTICE README THANKS |
138 |
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
139 |
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
140 |
%{_unitdir}/%{name}.service |
141 |
|
142 |
%files bin |
143 |
%{_bindir}/* |
144 |
%dir %{_sysconfdir}/%{name} |
145 |
%dir %{_sysconfdir}/%{name}/local.d |
146 |
%dir %{_sysconfdir}/%{name}/default.d |
147 |
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/default.ini |
148 |
%config(noreplace) %attr(0644,%{couchdb_user},root) %{_sysconfdir}/%{name}/local.ini |
149 |
%{_tmpfilesdir}/%{name}.conf |
150 |
%{_libdir}/%{name} |
151 |
%{_datadir}/%{name} |
152 |
%{_mandir}/man1/* |
153 |
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/log/%{name} |
154 |
%dir %attr(0755,%{couchdb_user},root) %{_localstatedir}/lib/%{name} |