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