243 lines
8.2 KiB
RPMSpec
243 lines
8.2 KiB
RPMSpec
%global mongodb_gid 65059
|
|
%global mongodb_group mongodb
|
|
|
|
%global mongodb_uid 65059
|
|
%global mongodb_user mongodb
|
|
|
|
Name: mongodb
|
|
Version: 4.2.4
|
|
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: https://github.com/mongodb/mongo.git/r%{version}/mongo-%{version}.tar.bz2
|
|
#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
|
|
Source8: mongodb-tmpfiles.d
|
|
License: Affero GNU Public License, Apache License 2.0
|
|
## AUTOBUILDREQ-BEGIN
|
|
BuildRequires: glibc-devel
|
|
BuildRequires: ldconfig
|
|
BuildRequires: libboost-devel
|
|
BuildRequires: libcurl-devel
|
|
BuildRequires: libgcc
|
|
BuildRequires: libgperftools-devel
|
|
BuildRequires: libopenssl-devel
|
|
BuildRequires: libsasl2-devel
|
|
BuildRequires: libsnappy-devel
|
|
BuildRequires: libstdc++6-devel
|
|
BuildRequires: libstemmer-devel
|
|
BuildRequires: libz-devel
|
|
## AUTOBUILDREQ-END
|
|
BuildRequires: scons
|
|
BuildRequires: gcc-c++
|
|
BuildRequires: gcc-go
|
|
BuildRequires: libyaml-cpp-devel >= 0.6.2
|
|
BuildRequires: valgrind-devel
|
|
BuildRequires: python-Cheetah3-py3
|
|
BuildRequires: python-psutil-py3
|
|
BuildRequires: libgperftools-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.
|
|
|
|
%debug_package
|
|
|
|
%prep
|
|
%setup -q -n mongo-%{version}
|
|
#-D -T
|
|
#:<< _EOF
|
|
|
|
# keep historical paths and user
|
|
sed -i 's|dbPath: /var/lib/mongo|dbPath: /var/lib/mongodb|' rpm/mongod.conf
|
|
sed -i 's/User=mongod/User=mongodb/' rpm/mongod.service
|
|
sed -i 's/Group=mongod/Group=mongodb/' rpm/mongod.service
|
|
sed -i 's|/var/run|/run|' rpm/mongod.service
|
|
sed -i 's|/usr/bin/mkdir|/bin/mkdir|' rpm/mongod.service
|
|
sed -i 's|/usr/bin/chmod|/bin/chmod|' rpm/mongod.service
|
|
sed -i 's|/usr/bin/chown|/bin/chown|' rpm/mongod.service
|
|
sed -i 's/chown mongod:mongod/chown mongodb:mongodb/' rpm/mongod.service
|
|
|
|
# GCC 6.1.0 build fix
|
|
sed -e 's|-std=c++11|-std=gnu++11|g' -i SConstruct
|
|
|
|
# Make systemd wait as long as it takes for MongoDB to start
|
|
# If MongoDB needs a long time to start, prevent systemd from restarting it every 90 seconds
|
|
# See: https://jira.mongodb.org/browse/SERVER-38086
|
|
sed -i 's/\[Service]/[Service]\nTimeoutStartSec=infinity/' rpm/mongod.service
|
|
|
|
# Prevent building using debug symbols, since binaries will be stripped anyway
|
|
# Reduces makepkg -- which fully runs check() -- build size from 259GB to 2.3GB, and time by at least 37%
|
|
# See: https://jira.mongodb.org/browse/SERVER-44038
|
|
sed -i '/"-ggdb" if not env.TargetOSIs/d' SConstruct
|
|
|
|
%build
|
|
#:<< _EOF
|
|
# --use-system-pcre # wait for pcre 8.44+ https://jira.mongodb.org/browse/SERVER-40836 and https://jira.mongodb.org/browse/SERVER-42990
|
|
# --use-system-yaml # https://jira.mongodb.org/browse/SERVER-43980
|
|
#--use-system-wiredtiger # https://jira.mongodb.org/browse/SERVER-42813 upstream broke this in 4.2.0, says in meantime not to use it
|
|
# --use-system-asio # https://jira.mongodb.org/browse/SERVER-21839 marked as fixed, but still doesn't compile. MongoDB uses custom patches.
|
|
# --use-system-icu # Doesn't compile
|
|
# --use-system-valgrind # Compiles, but namcap says not used
|
|
# --use-system-sqlite # "
|
|
# --use-system-mongo-c # Doesn't compile
|
|
|
|
scons core tools \
|
|
MONGO_VERSION=%{version} \
|
|
%ifnarch x86_64
|
|
--wiredtiger=off \
|
|
%endif
|
|
--use-system-snappy \
|
|
--use-system-zlib \
|
|
--use-system-stemmer \
|
|
--use-sasl-client \
|
|
--ssl \
|
|
--disable-warnings-as-errors \
|
|
--use-system-tcmalloc \
|
|
--use-system-boost \
|
|
%{?_smp_mflags}
|
|
|
|
%install
|
|
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
|
|
scons install \
|
|
MONGO_VERSION=%{version} \
|
|
%ifnarch x86_64
|
|
--wiredtiger=off \
|
|
%endif
|
|
--use-system-snappy \
|
|
--use-system-zlib \
|
|
--use-system-stemmer \
|
|
--use-sasl-client \
|
|
--ssl \
|
|
--disable-warnings-as-errors \
|
|
--use-system-tcmalloc \
|
|
--use-system-boost \
|
|
%{?_smp_mflags} \
|
|
--prefix=%{buildroot}%{_prefix}
|
|
|
|
install -D -m644 rpm/mongod.conf %{buildroot}%{_sysconfdir}/mongod.conf
|
|
install -D -m644 rpm/mongod.service %{buildroot}%{_unitdir}/mongod.service
|
|
|
|
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 -p -D -m 644 "%{SOURCE8}" %{buildroot}%{_tmpfilesdir}/mongod.conf
|
|
|
|
install -d %{buildroot}%{_localstatedir}/lib/%{name}
|
|
install -d %{buildroot}%{_localstatedir}/log/%{name}
|
|
|
|
install -d -m 755 %{buildroot}%{_mandir}/man1
|
|
install -p -m 644 debian/mongo{,d,s}.1 \
|
|
%{buildroot}%{_mandir}/man1/
|
|
|
|
rm -f %{buildroot}%{_bindir}/install_compass
|
|
|
|
%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}
|
|
:
|
|
|
|
%post server
|
|
%tmpfiles_create mongod.conf
|
|
%systemd_post mongod.service
|
|
#% systemd_post mongos.service
|
|
:
|
|
|
|
%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
|
|
:
|
|
|
|
%postun server
|
|
%systemd_postun_with_restart mongod.service
|
|
#% systemd_postun_with_restart mongos.service
|
|
:
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%{_bindir}/mongo
|
|
%{_mandir}/man1/mongo.1*
|
|
|
|
%files server
|
|
%defattr(-,root,root)
|
|
%{_bindir}/mongod
|
|
%{_bindir}/mongos
|
|
%{_unitdir}/*.service
|
|
%{_tmpfilesdir}/mongod.conf
|
|
%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}
|
|
%{_mandir}/man1/mongod.1*
|
|
%{_mandir}/man1/mongos.1*
|
|
|
|
%changelog
|
|
* Wed Mar 18 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 4.2.4-1mamba
|
|
- update to 4.2.4
|
|
|
|
* Thu Jul 04 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 4.0.10-1mamba
|
|
- update to 4.0.10
|
|
|
|
* Thu Jul 04 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 3.2.22-1mamba
|
|
- update to 3.2.22
|
|
- rebuilt with libyaml-cpp 0.6.2
|
|
|
|
* Mon Oct 31 2016 Automatic Build System <autodist@mambasoft.it> 3.2.10-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Sat Aug 20 2016 Automatic Build System <autodist@mambasoft.it> 3.2.9-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Thu Jul 28 2016 Automatic Build System <autodist@mambasoft.it> 3.2.8-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* Mon Jul 25 2016 Automatic Build System <autodist@mambasoft.it> 3.2.7-1mamba
|
|
- automatic version update by autodist
|
|
|
|
* 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
|