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