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