2 # - add support for sharding server (init scripts, systemd units, sample config)
4 Summary: MongoDB client shell and tools
5 Summary(pl.UTF-8): Powłoka kliencka i narzędzia dla bazy danych MongoDB
10 Group: Applications/Databases
11 Source0: http://downloads.mongodb.org/src/%{name}-src-r%{version}.tar.gz
12 # Source0-md5: 033354c543c053f5d539b573ac8c28b0
13 Source1: %{name}.logrotate
15 Source3: mongod-default.conf
16 Source4: mongod@.service
17 Patch0: %{name}-cflags.patch
18 Patch1: %{name}-system-libs.patch
19 Patch2: boost-1.50.patch
20 Patch3: %{name}-install.patch
21 Patch4: %{name}-shared.patch
23 URL: http://www.mongodb.org/
24 BuildRequires: boost-devel >= 1.50
25 BuildRequires: libpcap-devel
26 BuildRequires: libstdc++-devel >= 6:4.0
28 BuildRequires: libtcmalloc-devel
30 BuildRequires: pcre-cxx-devel
31 BuildRequires: pcre-devel >= 8.30
32 BuildRequires: readline-devel
33 BuildRequires: rpmbuild(macros) >= 1.644
34 BuildRequires: scons >= 1.2
35 BuildRequires: sed >= 4.0
36 BuildRequires: snappy-devel
37 BuildRequires: v8-devel
38 Requires: %{name}-libs = %{version}-%{release}
40 ExclusiveArch: %{ix86} %{x8664} arm mips
41 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
44 Mongo (from "huMONGOus") is a schema-free document-oriented database.
45 It features dynamic profileable queries, full indexing, replication
46 and fail-over support, efficient storage of large binary data objects,
49 This package provides the mongo shell, import/export tools, and other
52 %description -l pl.UTF-8
53 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
54 pozbawione schematu. Obsługuje dynamicznie profilowane zapytania,
55 pełne indeksowanie, replikację i fail-over, wydajne składowanie dużych
56 obiektów danych binarnych oraz automatyczne dzielenie.
58 Ten pakiet zawiera powłokę mongo, narzędzia do eksportu/importu danych
59 oraz inne narzędzia klienckie.
62 Summary: MongoDB client library
63 Summary(pl.UTF-8): Biblioteka kliencka MongoDB
67 Mongo (from "huMONGOus") is a schema-free document-oriented database.
69 This package provides the mongo client library.
71 %description libs -l pl.UTF-8
72 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
75 Ten pakiet zawiera bibliotekę kliencką mongo.
78 Summary: Header files for MongoDB client library
79 Summary(pl.UTF-8): Pliki nagłówkowe biblioteki klienckiej MongoDB
80 Group: Development/Libraries
81 Requires: %{name}-libs = %{version}-%{release}
84 Mongo (from "huMONGOus") is a schema-free document-oriented database.
86 This package provides the header files needed to develop MongoDB
89 %description devel -l pl.UTF-8
90 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
93 Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia
94 oprogramowania klienckiego dla MongoDB.
97 Summary: Static MongoDB client library
98 Summary(pl.UTF-8): Statyczna biblioteka kliencka MongoDB
99 Group: Development/Libraries
100 Requires: %{name}-devel = %{version}-%{release}
103 Mongo (from "huMONGOus") is a schema-free document-oriented database.
105 This package provides the MongoDB static client library.
107 %description static -l pl.UTF-8
108 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
111 Ten pakiet zawiera statyczną bibliotekę kliencką MongoDB.
114 Summary: MongoDB server, sharding server, and support scripts
115 Summary(pl.UTF-8): Serwer MongoDB, serwer dzielący oraz skrypty pomocnicze
116 Group: Applications/Databases
117 Requires: %{name} = %{version}-%{release}
118 Requires: systemd-units >= 38
119 Requires(post,preun): /sbin/chkconfig
120 Requires(postun): /usr/sbin/groupdel
121 Requires(postun): /usr/sbin/userdel
122 Requires(pre): /bin/id
123 Requires(pre): /usr/bin/getgid
124 Requires(pre): /usr/sbin/groupadd
125 Requires(pre): /usr/sbin/useradd
127 Provides: group(mongod)
128 Provides: user(mongod)
129 Conflicts: logrotate < 3.8.0
132 Mongo (from "huMONGOus") is a schema-free document-oriented database.
134 This package provides the mongo server software, mongo sharding server
135 software, default configuration files, and init.d scripts.
137 %description server -l pl.UTF-8
138 Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
141 Ten pakiet zawiera serwer mongo, serwer dzielący, pliki domyślnej
142 konfiguracji oraz skrypty init.d.
145 %setup -q -n %{name}-src-r%{version}
154 find -type f -executable | xargs chmod a-x
156 # force system pcre/js/snappy
157 %{__rm} -r src/third_party/{js-1.7,pcre-8.30,snappy,boost}
161 CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
162 --use-system-all=yes \
163 --extralib=pcrecpp,pcre,snappy \
164 --prefix=$RPM_BUILD_ROOT%{_prefix} \
171 rm -rf $RPM_BUILD_ROOT
172 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1} \
173 $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mongod} \
174 $RPM_BUILD_ROOT%{_var}/{lib,log{,/archive}}/mongodb \
175 $RPM_BUILD_ROOT%{systemdunitdir}
177 # XXX: scons is so great, recompiles everything here!
179 CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
180 --use-system-all=yes \
181 --extralib=pcrecpp,pcre,snappy \
182 --prefix=$RPM_BUILD_ROOT%{_prefix} \
188 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/mongod
189 install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
190 cp -p rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod
191 cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mongod/default.conf
192 cp -p debian/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
194 # mask out the LSB service
195 ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/mongod.service
196 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/mongod@.service
198 touch $RPM_BUILD_ROOT%{_var}/log/mongodb/mongod.log
200 # for some reason these are installed twice, remove unwanted copies
201 for f in $RPM_BUILD_ROOT%{_includedir}/mongo/*; do
202 rm -r "$RPM_BUILD_ROOT%{_includedir}/$(basename $f)" || :
206 chmod -R a+rX $RPM_BUILD_ROOT/usr/lib
207 %{__rm} -r $RPM_BUILD_ROOT/usr/lib
211 rm -rf $RPM_BUILD_ROOT
213 %post libs -p /sbin/ldconfig
214 %postun libs -p /sbin/ldconfig
217 %groupadd -g 258 -r mongod
218 %useradd -u 258 -r -g mongod -d %{_var}/lib/mongodb -s /bin/false -c "MongoDB Database Server" mongod
221 /sbin/chkconfig --add mongod
222 %service mongod restart
223 # our systemd macros cannot handle template (multi-instance) units yet
224 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
225 /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || :
226 if [ $1 -eq 1 ]; then
227 /bin/systemctl --quiet enable mongod@.service || :
228 /bin/systemd_booted && echo 'Run "/bin/systemctl start mongod@default.service" to start mongod.' || :
230 /bin/systemd_booted && /bin/systemctl --quiet try-restart mongod@default.service || :
234 if [ "$1" = "0" ]; then
235 %service -q mongod stop
236 /sbin/chkconfig --del mongod
237 export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
238 /bin/systemd_booted && /bin/systemctl --quiet stop mongod@default.service || :
239 /bin/systemctl --quiet disable mongod@.service || :
243 if [ "$1" = "0" ]; then
249 %triggerpostun server -- %{name}-server < 2.0.6-3
250 if [ -f %{_sysconfdir}/mongod.conf.rpmsave ] ; then
251 cp -f %{_sysconfdir}/mongod/default.conf{,.rpmnew} || :
252 echo "Moving %{_sysconfdir}/mongod.conf to %{_sysconfdir}/mongod/default.conf"
253 mv -f %{_sysconfdir}/mongod.conf.rpmsave %{_sysconfdir}/mongod/default.conf
254 %service mongod restart
258 %defattr(644,root,root,755)
259 %doc README GNU-AGPL-3.0.txt
260 %attr(755,root,root) %{_bindir}/bsondump
261 %attr(755,root,root) %{_bindir}/mongo
262 %attr(755,root,root) %{_bindir}/mongodump
263 %attr(755,root,root) %{_bindir}/mongoexport
264 %attr(755,root,root) %{_bindir}/mongofiles
265 %attr(755,root,root) %{_bindir}/mongoimport
266 %attr(755,root,root) %{_bindir}/mongooplog
267 %attr(755,root,root) %{_bindir}/mongoperf
268 %attr(755,root,root) %{_bindir}/mongorestore
269 %attr(755,root,root) %{_bindir}/mongosniff
270 %attr(755,root,root) %{_bindir}/mongostat
271 %attr(755,root,root) %{_bindir}/mongotop
272 %{_mandir}/man1/bsondump.1*
273 %{_mandir}/man1/mongo.1*
274 %{_mandir}/man1/mongodump.1*
275 %{_mandir}/man1/mongoexport.1*
276 %{_mandir}/man1/mongofiles.1*
277 %{_mandir}/man1/mongoimport.1*
278 %{_mandir}/man1/mongosniff.1*
279 %{_mandir}/man1/mongostat.1*
280 %{_mandir}/man1/mongorestore.1*
283 %defattr(644,root,root,755)
284 %attr(755,root,root) %{_libdir}/libmongoclient.so
287 %defattr(644,root,root,755)
291 %defattr(644,root,root,755)
292 %{_libdir}/libmongoclient.a
295 %defattr(644,root,root,755)
296 %dir %{_sysconfdir}/mongod
297 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mongod/default.conf
298 %attr(754,root,root) /etc/rc.d/init.d/mongod
299 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mongod
300 %config(noreplace) /etc/logrotate.d/mongod
301 %{systemdunitdir}/mongod.service
302 %{systemdunitdir}/mongod@.service
303 %attr(755,root,root) %{_bindir}/mongod
304 %attr(755,root,root) %{_bindir}/mongos
305 %{_mandir}/man1/mongod.1*
306 %{_mandir}/man1/mongos.1*
307 %attr(755,mongod,mongod) %dir %{_var}/lib/mongodb
308 %attr(775,root,mongod) %dir %{_var}/log/mongodb
309 %attr(775,root,mongod) %dir %{_var}/log/archive/mongodb
310 %attr(640,mongod,mongod) %config(noreplace) %verify(not md5 mtime size) %{_var}/log/mongodb/mongod.log