]> git.pld-linux.org Git - packages/mongodb.git/blob - mongodb.spec
8deb20bb2c630a627e592246dee32b081fb483b8
[packages/mongodb.git] / mongodb.spec
1 # TODO:
2 #       - add support for sharding server (init scripts, systemd units, sample config)
3 #   - \> escape not liked?
4 #  Sep 11 00:20:18 blodnatt systemd[1]: [/lib/systemd/system/mongod@.service:8] Invalid escape sequences in command line: "/bin/sh -c "if grep -q '^[ \t]*fork\>' /etc/mongod/%i.conf ; then echo there must be no 'fork' in /etc/mongod/%i.conf >&2 ; exit 1 ; fi""
5 # TODO
6 #
7 Summary:        MongoDB client shell and tools
8 Summary(pl.UTF-8):      Powłoka kliencka i narzędzia dla bazy danych MongoDB
9 Name:           mongodb
10 Version:        2.2.4
11 Release:        10
12 License:        AGPL v3
13 Group:          Applications/Databases
14 Source0:        http://downloads.mongodb.org/src/%{name}-src-r%{version}.tar.gz
15 # Source0-md5:  033354c543c053f5d539b573ac8c28b0
16 Source1:        %{name}.logrotate
17 Source2:        %{name}.init
18 Source3:        mongod-default.conf
19 Source4:        mongod@.service
20 Patch0:         %{name}-cflags.patch
21 Patch1:         %{name}-system-libs.patch
22 Patch2:         boost-1.50.patch
23 Patch3:         %{name}-install.patch
24 Patch4:         %{name}-shared.patch
25 Patch5:         gcc4.patch
26 Patch6:         no-Werror.patch
27 Patch7:         gcc6.patch
28 Patch8:         %{name}-pcap.patch
29 URL:            http://www.mongodb.org/
30 BuildRequires:  boost-devel >= 1.50
31 BuildRequires:  libpcap-devel
32 BuildRequires:  libstdc++-devel >= 6:4.0
33 %ifarch %{x8664}
34 BuildRequires:  libtcmalloc-devel
35 %endif
36 BuildRequires:  pcre-cxx-devel
37 BuildRequires:  pcre-devel >= 8.30
38 BuildRequires:  readline-devel
39 BuildRequires:  rpmbuild(macros) >= 1.644
40 BuildRequires:  scons >= 1.2
41 BuildRequires:  sed >= 4.0
42 BuildRequires:  snappy-devel
43 BuildRequires:  v8-devel
44 Requires:       %{name}-libs = %{version}-%{release}
45 # matching v8-devel
46 ExclusiveArch:  %{ix86} %{x8664} arm mips
47 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
48
49 %description
50 Mongo (from "huMONGOus") is a schema-free document-oriented database.
51 It features dynamic profileable queries, full indexing, replication
52 and fail-over support, efficient storage of large binary data objects,
53 and auto-sharding.
54
55 This package provides the mongo shell, import/export tools, and other
56 client utilities.
57
58 %description -l pl.UTF-8
59 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
60 pozbawione schematu. Obsługuje dynamicznie profilowane zapytania,
61 pełne indeksowanie, replikację i fail-over, wydajne składowanie dużych
62 obiektów danych binarnych oraz automatyczne dzielenie.
63
64 Ten pakiet zawiera powłokę mongo, narzędzia do eksportu/importu danych
65 oraz inne narzędzia klienckie.
66
67 %package libs
68 Summary:        MongoDB client library
69 Summary(pl.UTF-8):      Biblioteka kliencka MongoDB
70 Group:          Libraries
71
72 %description libs
73 Mongo (from "huMONGOus") is a schema-free document-oriented database.
74
75 This package provides the mongo client library.
76
77 %description libs -l pl.UTF-8
78 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
79 pozbawione schematu.
80
81 Ten pakiet zawiera bibliotekę kliencką mongo.
82
83 %package devel
84 Summary:        Header files for MongoDB client library
85 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki klienckiej MongoDB
86 Group:          Development/Libraries
87 Requires:       %{name}-libs = %{version}-%{release}
88
89 %description devel
90 Mongo (from "huMONGOus") is a schema-free document-oriented database.
91
92 This package provides the header files needed to develop MongoDB
93 client software.
94
95 %description devel -l pl.UTF-8
96 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
97 pozbawione schematu.
98
99 Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia
100 oprogramowania klienckiego dla MongoDB.
101
102 %package static
103 Summary:        Static MongoDB client library
104 Summary(pl.UTF-8):      Statyczna biblioteka kliencka MongoDB
105 Group:          Development/Libraries
106 Requires:       %{name}-devel = %{version}-%{release}
107
108 %description static
109 Mongo (from "huMONGOus") is a schema-free document-oriented database.
110
111 This package provides the MongoDB static client library.
112
113 %description static -l pl.UTF-8
114 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
115 pozbawione schematu.
116
117 Ten pakiet zawiera statyczną bibliotekę kliencką MongoDB.
118
119 %package server
120 Summary:        MongoDB server, sharding server, and support scripts
121 Summary(pl.UTF-8):      Serwer MongoDB, serwer dzielący oraz skrypty pomocnicze
122 Group:          Applications/Databases
123 Requires:       %{name} = %{version}-%{release}
124 Requires:       systemd-units >= 38
125 Requires(post,preun):   /sbin/chkconfig
126 Requires(postun):       /usr/sbin/groupdel
127 Requires(postun):       /usr/sbin/userdel
128 Requires(pre):  /bin/id
129 Requires(pre):  /usr/bin/getgid
130 Requires(pre):  /usr/sbin/groupadd
131 Requires(pre):  /usr/sbin/useradd
132 Requires:       rc-scripts
133 Provides:       group(mongod)
134 Provides:       user(mongod)
135 Conflicts:      logrotate < 3.8.0
136
137 %description server
138 Mongo (from "huMONGOus") is a schema-free document-oriented database.
139
140 This package provides the mongo server software, mongo sharding server
141 software, default configuration files, and init.d scripts.
142
143 %description server -l pl.UTF-8
144 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
145 pozbawione schematu.
146
147 Ten pakiet zawiera serwer mongo, serwer dzielący, pliki domyślnej
148 konfiguracji oraz skrypty init.d.
149
150 %prep
151 %setup -q -n %{name}-src-r%{version}
152 %patch0 -p1
153 %patch1 -p1
154 %patch2 -p1
155 %patch3 -p1
156 %patch4 -p1
157 %patch5 -p1
158 %patch6 -p1
159 %patch7 -p1
160 %patch8 -p1
161
162 # Fix permissions
163 find -type f -executable | xargs chmod a-x
164
165 # force system pcre/js/snappy
166 %{__rm} -r src/third_party/{js-1.7,pcre-8.30,snappy,boost}
167
168 %build
169 %scons \
170         CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
171         --use-system-all=yes \
172         --extralib=pcrecpp,pcre,snappy \
173         --prefix=$RPM_BUILD_ROOT%{_prefix} \
174         --full=all \
175         --sharedclient \
176         --usev8 \
177         --cxx=%{__cxx}
178
179 %install
180 rm -rf $RPM_BUILD_ROOT
181 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1} \
182         $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mongod} \
183         $RPM_BUILD_ROOT%{_var}/{lib,log{,/archive}}/mongodb \
184         $RPM_BUILD_ROOT%{systemdunitdir}
185
186 # XXX: scons is so great, recompiles everything here!
187 %scons install \
188         CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
189         --use-system-all=yes \
190         --extralib=pcrecpp,pcre,snappy \
191         --prefix=$RPM_BUILD_ROOT%{_prefix} \
192         --full=all \
193         --sharedclient \
194         --usev8 \
195         --cxx=%{__cxx}
196
197 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/mongod
198 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
199 cp -p rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod
200 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mongod/default.conf
201 cp -p debian/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
202
203 # mask out the LSB service
204 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/mongod.service
205 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/mongod@.service
206
207 touch $RPM_BUILD_ROOT%{_var}/log/mongodb/mongod.log
208
209 # for some reason these are installed twice, remove unwanted copies
210 for f in $RPM_BUILD_ROOT%{_includedir}/mongo/*; do
211         rm -r "$RPM_BUILD_ROOT%{_includedir}/$(basename $f)" || :
212 done
213
214 %ifarch %{x8664}
215 chmod -R a+rX $RPM_BUILD_ROOT/usr/lib
216 %{__rm} -r $RPM_BUILD_ROOT/usr/lib
217 %endif
218
219 %clean
220 rm -rf $RPM_BUILD_ROOT
221
222 %post   libs -p /sbin/ldconfig
223 %postun libs -p /sbin/ldconfig
224
225 %pre server
226 %groupadd -g 258 -r mongod
227 %useradd -u 258 -r -g mongod -d %{_var}/lib/mongodb -s /bin/false -c "MongoDB Database Server" mongod
228
229 %post server
230 /sbin/chkconfig --add mongod
231 %service mongod restart
232 # our systemd macros cannot handle template (multi-instance) units yet
233 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
234 /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || :
235 if [ $1 -eq 1 ]; then
236         /bin/systemctl --quiet enable mongod@.service || : 
237         /bin/systemd_booted && echo 'Run "/bin/systemctl start mongod@default.service" to start mongod.' || :
238 else
239         /bin/systemd_booted && /bin/systemctl --quiet try-restart mongod@default.service || :
240 fi
241
242 %preun server
243 if [ "$1" = "0" ]; then
244         %service -q mongod stop
245         /sbin/chkconfig --del mongod
246         export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
247         /bin/systemd_booted && /bin/systemctl --quiet stop mongod@default.service || :
248         /bin/systemctl --quiet disable mongod@.service || :
249 fi
250
251 %postun server
252 if [ "$1" = "0" ]; then
253         %userremove mongod
254         %groupremove mongod
255 fi
256 %systemd_reload
257
258 %triggerpostun server -- %{name}-server < 2.0.6-3
259 if [ -f %{_sysconfdir}/mongod.conf.rpmsave ] ; then
260         cp -f %{_sysconfdir}/mongod/default.conf{,.rpmnew} || :
261         echo "Moving %{_sysconfdir}/mongod.conf to %{_sysconfdir}/mongod/default.conf"
262         mv -f %{_sysconfdir}/mongod.conf.rpmsave %{_sysconfdir}/mongod/default.conf
263         %service mongod restart
264 fi
265
266 %files
267 %defattr(644,root,root,755)
268 %doc README GNU-AGPL-3.0.txt
269 %attr(755,root,root) %{_bindir}/bsondump
270 %attr(755,root,root) %{_bindir}/mongo
271 %attr(755,root,root) %{_bindir}/mongodump
272 %attr(755,root,root) %{_bindir}/mongoexport
273 %attr(755,root,root) %{_bindir}/mongofiles
274 %attr(755,root,root) %{_bindir}/mongoimport
275 %attr(755,root,root) %{_bindir}/mongooplog
276 %attr(755,root,root) %{_bindir}/mongoperf
277 %attr(755,root,root) %{_bindir}/mongorestore
278 %attr(755,root,root) %{_bindir}/mongosniff
279 %attr(755,root,root) %{_bindir}/mongostat
280 %attr(755,root,root) %{_bindir}/mongotop
281 %{_mandir}/man1/bsondump.1*
282 %{_mandir}/man1/mongo.1*
283 %{_mandir}/man1/mongodump.1*
284 %{_mandir}/man1/mongoexport.1*
285 %{_mandir}/man1/mongofiles.1*
286 %{_mandir}/man1/mongoimport.1*
287 %{_mandir}/man1/mongosniff.1*
288 %{_mandir}/man1/mongostat.1*
289 %{_mandir}/man1/mongorestore.1*
290
291 %files libs
292 %defattr(644,root,root,755)
293 %attr(755,root,root) %{_libdir}/libmongoclient.so
294
295 %files devel
296 %defattr(644,root,root,755)
297 %{_includedir}/mongo
298
299 %files static
300 %defattr(644,root,root,755)
301 %{_libdir}/libmongoclient.a
302
303 %files server
304 %defattr(644,root,root,755)
305 %dir %{_sysconfdir}/mongod
306 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mongod/default.conf
307 %attr(754,root,root) /etc/rc.d/init.d/mongod
308 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mongod
309 %config(noreplace) /etc/logrotate.d/mongod
310 %{systemdunitdir}/mongod.service
311 %{systemdunitdir}/mongod@.service
312 %attr(755,root,root) %{_bindir}/mongod
313 %attr(755,root,root) %{_bindir}/mongos
314 %{_mandir}/man1/mongod.1*
315 %{_mandir}/man1/mongos.1*
316 %attr(755,mongod,mongod) %dir %{_var}/lib/mongodb
317 %attr(775,root,mongod) %dir %{_var}/log/mongodb
318 %attr(775,root,mongod) %dir %{_var}/log/archive/mongodb
319 %attr(640,mongod,mongod) %config(noreplace) %verify(not md5 mtime size) %{_var}/log/mongodb/mongod.log
This page took 0.083739 seconds and 2 git commands to generate.