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