]> git.pld-linux.org Git - packages/mongodb.git/blobdiff - mongodb.spec
- rebuild with boost 1.56.0
[packages/mongodb.git] / mongodb.spec
index 636c0719805dbd56e0adc2f8c9ddbb46a3ee2bea..c0c5ac02fc2cd751d8a28e169acc89a115f1a8a1 100644 (file)
@@ -1,29 +1,41 @@
-# TODO
-# - pld useradd/groupadd (register uid/gid)
+# TODO:
+#      - add support for sharding server (init scripts, systemd units, sample config)
+#
 Summary:       MongoDB client shell and tools
+Summary(pl.UTF-8):     Powłoka kliencka i narzędzia dla bazy danych MongoDB
 Name:          mongodb
-Version:       1.6.2
-Release:       0.1
-License:       AGPL 3.0
+Version:       2.2.4
+Release:       3
+License:       AGPL v3
 Group:         Applications/Databases
-URL:           http://www.mongodb.org/
 Source0:       http://downloads.mongodb.org/src/%{name}-src-r%{version}.tar.gz
-# Source0-md5: 358bfc52855a66d3c954e7f6f51bcd12
+# Source0-md5: 033354c543c053f5d539b573ac8c28b0
 Source1:       %{name}.logrotate
 Source2:       %{name}.init
-# BuildRequires:  libpcap-devel
-BuildRequires: boost-devel >= 1.42
-BuildRequires: gcc >= 6:4.0
-BuildRequires: libstdc++-devel
-BuildRequires: libstdc++-devel >= 4.0
+Source3:       mongod-default.conf
+Source4:       mongod@.service
+Patch0:                %{name}-cflags.patch
+Patch1:                %{name}-system-libs.patch
+Patch2:                boost-1.50.patch
+Patch3:                %{name}-install.patch
+Patch4:                %{name}-shared.patch
+URL:           http://www.mongodb.org/
+BuildRequires: boost-devel >= 1.50
+BuildRequires: libpcap-devel
+BuildRequires: libstdc++-devel >= 6:4.0
+%ifarch %{x8664}
+BuildRequires: libtcmalloc-devel
+%endif
 BuildRequires: pcre-cxx-devel
-BuildRequires: pcre-devel
+BuildRequires: pcre-devel >= 8.30
 BuildRequires: readline-devel
+BuildRequires: rpmbuild(macros) >= 1.644
 BuildRequires: scons >= 1.2
+BuildRequires: sed >= 4.0
+BuildRequires: snappy-devel
 BuildRequires: v8-devel
-Requires:      libstdc++
+Requires:      %{name}-libs = %{version}-%{release}
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-Requires(pre): pwdutils
 
 %description
 Mongo (from "huMONGOus") is a schema-free document-oriented database.
@@ -34,106 +46,227 @@ and auto-sharding.
 This package provides the mongo shell, import/export tools, and other
 client utilities.
 
-%package server
-Summary:       MongoDB server, sharding server, and support scripts
-Group:         Applications/Databases
-Requires:      %{name} = %{version}
-Requires:      logrotate
+%description -l pl.UTF-8
+Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
+pozbawione schematu. Obsługuje dynamicznie profilowane zapytania,
+pełne indeksowanie, replikację i fail-over, wydajne składowanie dużych
+obiektów danych binarnych oraz automatyczne dzielenie.
 
-%description server
+Ten pakiet zawiera powłokę mongo, narzędzia do eksportu/importu danych
+oraz inne narzędzia klienckie.
+
+%package libs
+Summary:       MongoDB client library
+Summary(pl.UTF-8):     Biblioteka kliencka MongoDB
+Group:         Libraries
+
+%description libs
 Mongo (from "huMONGOus") is a schema-free document-oriented database.
 
-This package provides the mongo server software, mongo sharding server
-softwware, default configuration files, and init.d scripts.
+This package provides the mongo client library.
+
+%description libs -l pl.UTF-8
+Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
+pozbawione schematu.
+
+Ten pakiet zawiera bibliotekę kliencką mongo.
 
 %package devel
-Summary:       Headers and libraries for mongo development
+Summary:       Header files for MongoDB client library
+Summary(pl.UTF-8):     Pliki nagłówkowe biblioteki klienckiej MongoDB
 Group:         Development/Libraries
-Requires:      %{name} = %{version}
+Requires:      %{name}-libs = %{version}-%{release}
 
 %description devel
 Mongo (from "huMONGOus") is a schema-free document-oriented database.
 
-This package provides the mongo static library and header files needed
-to develop mongo client software.
+This package provides the header files needed to develop MongoDB
+client software.
+
+%description devel -l pl.UTF-8
+Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
+pozbawione schematu.
+
+Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia
+oprogramowania klienckiego dla MongoDB.
+
+%package static
+Summary:       Static MongoDB client library
+Summary(pl.UTF-8):     Statyczna biblioteka kliencka MongoDB
+Group:         Development/Libraries
+Requires:      %{name}-devel = %{version}-%{release}
+
+%description static
+Mongo (from "huMONGOus") is a schema-free document-oriented database.
+
+This package provides the MongoDB static client library.
+
+%description static -l pl.UTF-8
+Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
+pozbawione schematu.
+
+Ten pakiet zawiera statyczną bibliotekę kliencką MongoDB.
+
+%package server
+Summary:       MongoDB server, sharding server, and support scripts
+Summary(pl.UTF-8):     Serwer MongoDB, serwer dzielący oraz skrypty pomocnicze
+Group:         Applications/Databases
+Requires:      %{name} = %{version}-%{release}
+Requires:      systemd-units >= 38
+Requires(post,preun):  /sbin/chkconfig
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires:      rc-scripts
+Provides:      group(mongod)
+Provides:      user(mongod)
+Conflicts:     logrotate < 3.8.0
+
+%description server
+Mongo (from "huMONGOus") is a schema-free document-oriented database.
+
+This package provides the mongo server software, mongo sharding server
+software, default configuration files, and init.d scripts.
+
+%description server -l pl.UTF-8
+Mongo (od "huMONGOus") to baza danych zorientowana na dokumenty
+pozbawione schematu.
+
+Ten pakiet zawiera serwer mongo, serwer dzielący, pliki domyślnej
+konfiguracji oraz skrypty init.d.
 
 %prep
 %setup -q -n %{name}-src-r%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 # Fix permissions
 find -type f -executable | xargs chmod a-x
 
+# force system pcre/js/snappy
+%{__rm} -r src/third_party/{js-1.7,pcre-8.30,snappy,boost}
+
 %build
 %scons \
+       CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
+       --use-system-all=yes \
+       --extralib=pcrecpp,pcre,snappy \
        --prefix=$RPM_BUILD_ROOT%{_prefix} \
+       --full=all \
        --sharedclient \
-       --full all \
-       --usev8
-
-# XXX really should have shared library here
+       --usev8 \
+       --cxx=%{__cxx}
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_mandir}/man1} \
-       $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d} \
-       $RPM_BUILD_ROOT%{_var}/{lib,log}/mongo
+       $RPM_BUILD_ROOT/etc/{logrotate.d,rc.d/init.d,sysconfig,mongod} \
+       $RPM_BUILD_ROOT%{_var}/{lib,log{,/archive}}/mongodb \
+       $RPM_BUILD_ROOT%{systemdunitdir}
+
+# XXX: scons is so great, recompiles everything here!
 %scons install \
+       CPPFLAGS="%{rpmcppflags} -DXP_UNIX" \
+       --use-system-all=yes \
+       --extralib=pcrecpp,pcre,snappy \
        --prefix=$RPM_BUILD_ROOT%{_prefix} \
+       --full=all \
        --sharedclient \
-       --full \
-       --usev8
+       --usev8 \
+       --cxx=%{__cxx}
+
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/mongod
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
+cp -p rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/mongod/default.conf
+cp -p debian/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
 
-cp -a debian/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
-#install -d $RPM_BUILD_ROOT%{_sysconfdir}/init.d
-#cp rpm/init.d-mongod $RPM_BUILD_ROOT%{_sysconfdir}/init.d/mongod
-#chmod a+x $RPM_BUILD_ROOT%{_sysconfdir}/init.d/mongod
+# mask out the LSB service
+ln -s /dev/null $RPM_BUILD_ROOT%{systemdunitdir}/mongod.service
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/mongod@.service
 
-cp -a rpm/mongod.conf $RPM_BUILD_ROOT%{_sysconfdir}/mongod.conf
-#install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
-#cp rpm/mongod.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/mongod
-#cp rpm/mongod.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/mongod
+touch $RPM_BUILD_ROOT%{_var}/log/mongodb/mongod.log
 
-touch $RPM_BUILD_ROOT%{_var}/log/mongo/mongod.log
-cp -a %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/mongod
-install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
+# for some reason these are installed twice, remove unwanted copies
+for f in $RPM_BUILD_ROOT%{_includedir}/mongo/*; do
+       rm -r "$RPM_BUILD_ROOT%{_includedir}/$(basename $f)" || :
+done
 
-#install -d $RPM_BUILD_ROOT%{_sbindir}
-#ln -s %{_sysconfdir}/init.d/mongod $RPM_BUILD_ROOT%{_sbindir}/rcmongod
-# XXX PFF?
-ln -s ../../etc/rc.d/init.d/mongod $RPM_BUILD_ROOT%{_sbindir}/rcmongod
+%ifarch %{x8664}
+chmod -R a+rX $RPM_BUILD_ROOT/usr/lib
+%{__rm} -r $RPM_BUILD_ROOT/usr/lib
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post  libs -p /sbin/ldconfig
+%postun        libs -p /sbin/ldconfig
+
 %pre server
-groupadd -r mongod 2>/dev/null || :
-useradd -r -g mongod -d %{_var}/lib/mongo -s /sbin/nologin -c "user for MongoDB Database Server" mongod 2>/dev/null || :
+%groupadd -g 258 -r mongod
+%useradd -u 258 -r -g mongod -d %{_var}/lib/mongodb -s /bin/false -c "MongoDB Database Server" mongod
 
 %post server
-#%fillup_and_insserv -n mongod mongod
-#%restart_on_update mongod
+/sbin/chkconfig --add mongod
+%service mongod restart
+# our systemd macros cannot handle template (multi-instance) units yet
+export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
+/bin/systemd_booted && /bin/systemctl --quiet daemon-reload || :
+if [ $1 -eq 1 ]; then
+       /bin/systemctl --quiet enable mongod@.service || : 
+       /bin/systemd_booted && echo 'Run "/bin/systemctl start mongod@default.service" to start mongod.' || :
+else
+       /bin/systemd_booted && /bin/systemctl --quiet try-restart mongod@default.service || :
+fi
 
 %preun server
-#%stop_on_removal mongod
+if [ "$1" = "0" ]; then
+       %service -q mongod stop
+       /sbin/chkconfig --del mongod
+       export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog
+       /bin/systemd_booted && /bin/systemctl --quiet stop mongod@default.service || :
+       /bin/systemctl --quiet disable mongod@.service || :
+fi
 
 %postun server
+if [ "$1" = "0" ]; then
+       %userremove mongod
+       %groupremove mongod
+fi
+%systemd_reload
 
-%post  devel -p /sbin/ldconfig
-%postun        devel -p /sbin/ldconfig
+%triggerpostun server -- %{name}-server < 2.0.6-3
+if [ -f %{_sysconfdir}/mongod.conf.rpmsave ] ; then
+       cp -f %{_sysconfdir}/mongod/default.conf{,.rpmnew} || :
+       echo "Moving %{_sysconfdir}/mongod.conf to %{_sysconfdir}/mongod/default.conf"
+       mv -f %{_sysconfdir}/mongod.conf.rpmsave %{_sysconfdir}/mongod/default.conf
+       %service mongod restart
+fi
 
 %files
 %defattr(644,root,root,755)
 %doc README GNU-AGPL-3.0.txt
+%attr(755,root,root) %{_bindir}/bsondump
 %attr(755,root,root) %{_bindir}/mongo
 %attr(755,root,root) %{_bindir}/mongodump
 %attr(755,root,root) %{_bindir}/mongoexport
 %attr(755,root,root) %{_bindir}/mongofiles
 %attr(755,root,root) %{_bindir}/mongoimport
+%attr(755,root,root) %{_bindir}/mongooplog
+%attr(755,root,root) %{_bindir}/mongoperf
 %attr(755,root,root) %{_bindir}/mongorestore
+%attr(755,root,root) %{_bindir}/mongosniff
 %attr(755,root,root) %{_bindir}/mongostat
-%attr(755,root,root) %{_bindir}/bsondump
+%attr(755,root,root) %{_bindir}/mongotop
+%{_mandir}/man1/bsondump.1*
 %{_mandir}/man1/mongo.1*
-%{_mandir}/man1/mongod.1*
 %{_mandir}/man1/mongodump.1*
 %{_mandir}/man1/mongoexport.1*
 %{_mandir}/man1/mongofiles.1*
@@ -142,23 +275,32 @@ useradd -r -g mongod -d %{_var}/lib/mongo -s /sbin/nologin -c "user for MongoDB
 %{_mandir}/man1/mongostat.1*
 %{_mandir}/man1/mongorestore.1*
 
-%files server
+%files libs
 %defattr(644,root,root,755)
-%config(noreplace) %{_sysconfdir}/mongod.conf
-%config(noreplace) /etc/logrotate.d/mongod
-%attr(754,root,root) %config /etc/rc.d/init.d/mongod
-%attr(755,root,root) %{_sbindir}/rcmongod
-%config %{_var}/adm/fillup-templates/sysconfig.mongod
-%attr(755,root,root) %{_bindir}/mongod
-%attr(755,root,root) %{_bindir}/mongos
-%{_mandir}/man1/mongos.1*
-%attr(755,mongod,mongod) %dir %{_var}/lib/mongo
-%attr(755,mongod,mongod) %dir %{_var}/log/mongo
-%attr(640,mongod,mongod) %config(noreplace) %verify(not md5 mtime size) %{_var}/log/mongo/mongod.log
+%attr(755,root,root) %{_libdir}/libmongoclient.so
 
 %files devel
 %defattr(644,root,root,755)
 %{_includedir}/mongo
+
+%files static
+%defattr(644,root,root,755)
 %{_libdir}/libmongoclient.a
-%{_libdir}/libmongoclient.so
-#%{_libdir}/libmongotestfiles.a
+
+%files server
+%defattr(644,root,root,755)
+%dir %{_sysconfdir}/mongod
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mongod/default.conf
+%attr(754,root,root) /etc/rc.d/init.d/mongod
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/mongod
+%config(noreplace) /etc/logrotate.d/mongod
+%{systemdunitdir}/mongod.service
+%{systemdunitdir}/mongod@.service
+%attr(755,root,root) %{_bindir}/mongod
+%attr(755,root,root) %{_bindir}/mongos
+%{_mandir}/man1/mongod.1*
+%{_mandir}/man1/mongos.1*
+%attr(755,mongod,mongod) %dir %{_var}/lib/mongodb
+%attr(775,root,mongod) %dir %{_var}/log/mongodb
+%attr(775,root,mongod) %dir %{_var}/log/archive/mongodb
+%attr(640,mongod,mongod) %config(noreplace) %verify(not md5 mtime size) %{_var}/log/mongodb/mongod.log
This page took 0.082003 seconds and 4 git commands to generate.