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