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