mongodb/mongodb.spec

192 lines
6.2 KiB
RPMSpec
Raw Normal View History

%global mongodb_gid 65059
%global mongodb_group mongodb
%global mongodb_uid 65059
%global mongodb_user mongodb
Name: mongodb
Version: 3.2.6
Release: 1mamba
Summary: A cross-platform, high-performance, schema-free document-oriented database
Group: Applications/Databases
Vendor: openmamba
Distribution: openmamba
Packager: Davide Madrisan <davide.madrisan@gmail.com>
URL: https://www.mongodb.org/
Source: http://fastdl.mongodb.org/src/mongodb-src-r%{version}.tar.gz
Source1: mongod.service
Source2: mongod.conf
Source3: mongod.sysconf
Source4: mongos.service
Source5: mongos.conf
Source6: mongos.sysconf
Source7: %{name}.logrotate
License: Affero GNU Public License, Apache License 2.0
## AUTOBUILDREQ-BEGIN
## note: run 'autospec -u -a6 mongodb' to get the list of build requirements.
## AUTOBUILDREQ-END
BuildRequires: glibc-devel
BuildRequires: libboost-devel
BuildRequires: libgcc
BuildRequires: libopenssl-devel
BuildRequires: libpcap-devel
BuildRequires: libpcre-devel
BuildRequires: libstdc++6-devel
BuildRequires: libyaml-cpp-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: scons
BuildRequires: gcc-c++
BuildRequires: gcc-go
BuildRequires: libsnappy-devel
BuildRequires: valgrind-devel
%{?systemd_requires}
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling.
MongoDB obviates the need for an Object Relational Mapping (ORM) to facilitate development.
MongoDB stores documents in collections. Collections are analogous to tables in relational databases.
Unlike a table, however, a collection does not require its documents to have the same schema.
In MongoDB, documents stored in a collection must have a unique _id field that acts as a primary key.
%package server
Group: Applications/Databases
Summary: MongoDB server
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
%description server
This package provides the mongo server software, mongo sharding server software, default configuration files, and init scripts.
%prep
%setup -q -n %{name}-src-r%{version}
%build
# see: https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
# note: MongoDB uses a customized built-in version of tcmalloc to achieve
# significant performance gains. Building with --use-system-tcmalloc
# produces binaries that lack these performance gains.
# note: WiredTiger is not supported on 32-bit platforms
# Re-run scons with --wiredtiger=off to build on 32-bit platforms
scons all \
%ifnarch x86_64
--wiredtiger=off \
%endif
%{?_smp_mflags} \
--use-system-pcre \
--use-system-boost \
--use-system-valgrind \
--use-system-zlib \
--use-system-yaml \
--ssl \
--disable-warnings-as-errors
# --use-system-snappy
# --use-system-stemmer
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
scons install \
%ifnarch x86_64
--wiredtiger=off \
%endif
%{?_smp_mflags} \
--use-system-pcre \
--use-system-boost \
--use-system-valgrind \
--use-system-zlib \
--use-system-yaml \
--ssl \
--disable-warnings-as-errors \
--prefix=%{buildroot}%{_prefix}
install -p -D -m 644 "%{SOURCE1}" %{buildroot}%{_unitdir}/mongod.service
install -p -D -m 644 "%{SOURCE2}" %{buildroot}%{_sysconfdir}/mongod.conf
install -p -D -m 644 "%{SOURCE3}" %{buildroot}%{_sysconfdir}/sysconfig/mongod
install -p -D -m 644 "%{SOURCE4}" %{buildroot}%{_unitdir}/mongos.service
install -p -D -m 644 "%{SOURCE5}" %{buildroot}%{_sysconfdir}/mongos.conf
install -p -D -m 644 "%{SOURCE6}" %{buildroot}%{_sysconfdir}/sysconfig/mongos
install -p -D -m 644 "%{SOURCE7}" %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -d %{buildroot}%{_localstatedir}/lib/%{name}
install -d %{buildroot}%{_localstatedir}/log/%{name}
install -d %{buildroot}%{_localstatedir}/run/%{name}
install -d -m 755 %{buildroot}%{_mandir}/man1
install -p -m 644 debian/mongo{,perf,sniff,d,s}.1 \
%{buildroot}%{_mandir}/man1/
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre server
getent group %{mongodb_group} >/dev/null || groupadd -g %{mongodb_gid} %{mongodb_group}
getent passwd %{mongodb_user} >/dev/null || useradd -g %{mongodb_gid} -u %{mongodb_uid} \
-d %{_localstatedir}/lib/%{name} -s /sbin/nologin \
-c "MongoDB Database Server" %{mongodb_user}
exit 0
%post server
%systemd_post mongod.service
%systemd_post mongos.service
exit 0
%preun server
%systemd_preun mongod.service
%systemd_preun mongos.service
if [ $1 -eq 0 ]; then
userdel %{mongodb_user} 2>/dev/null
groupdel %{mongodb_group} 2>/dev/null
fi
exit 0
%postun server
%systemd_postun_with_restart mongod.service
%systemd_postun_with_restart mongos.service
exit 0
%files
%defattr(-,root,root)
%{_bindir}/mongo
%{_bindir}/mongoperf
%{_bindir}/mongosniff
%{_mandir}/man1/mongo.1*
%{_mandir}/man1/mongoperf.1*
%{_mandir}/man1/mongosniff.1*
%files server
%defattr(-,root,root)
%{_bindir}/mongod
%{_bindir}/mongos
%{_unitdir}/*.service
%config(noreplace) %{_sysconfdir}/*.conf
%config(noreplace) %{_sysconfdir}/sysconfig/mongo*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755, %{mongodb_user}, root) %{_localstatedir}/lib/%{name}
%dir %attr(0755, %{mongodb_user}, root) %{_localstatedir}/log/%{name}
%dir %attr(0755, %{mongodb_user}, root) %{_localstatedir}/run/%{name}
%{_mandir}/man1/mongod.1*
%{_mandir}/man1/mongos.1*
%changelog
* Mon May 02 2016 Automatic Build System <autodist@mambasoft.it> 3.2.6-1mamba
- automatic version update by autodist
* Sat Apr 30 2016 Automatic Build System <autodist@mambasoft.it> 3.2.5-1mamba
- automatic version update by autodist
* Sat Feb 27 2016 Davide Madrisan <davide.madrisan@gmail.com> 3.2.3-2mamba
- update the installation scripts and systemd configuration files
%changelog
* Mon May 02 2016 Automatic Build System <autodist@mambasoft.it> 3.2.6-1mamba
- automatic version update by autodist
* Sat Apr 30 2016 Automatic Build System <autodist@mambasoft.it> 3.2.5-1mamba
- automatic version update by autodist
* Fri Feb 26 2016 Davide Madrisan <davide.madrisan@gmail.com> 3.2.3-1mamba
- package created using the webbuild interface