File mongodb.spec of Package mongodb

Name:           mongodb
Version:        20091215
Release:        0
Summary:        High-performance, schema-free document-oriented database
Group:          Applications/Databases
License:        AGPLv3
URL:            http://www.mongodb.org
Source0:        mongo-%{version}.tar.bz2
# init-script:
Source1:        mongodb.init
Source2:        mongodb.logrotate
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc-c++
BuildRequires:  python-devel >= 2.6
BuildRequires:  scons
BuildRequires:  boost-devel
BuildRequires:  pcre-devel
BuildRequires:  libreadline6
BuildRequires:  readline-devel
BuildRequires:  libjs-devel
BuildRequires:  libpcap-devel
# to run tests
#BuildRequires:  unittest-devel
Requires(post): aaa_base
Requires(preun): aaa_base

#Requires(post): chkconfig
#Requires(preun): chkconfig

#Requires(pre):  shadow-utils
Requires(pre):   pwdutils
# This is for /sbin/service
Requires(postun): aaa_base


%description
Mongo (from "humongous") is a high-performance, open source, schema-free
document-oriented database. MongoDB is written in C++ and offers the following
features:
    * Collection oriented storage: easy storage of object/JSON-style data
    * Dynamic queries
    * Full index support, including on inner objects and embedded arrays
    * Query profiling
    * Replication and fail-over support
    * Efficient storage of binary data including large objects (e.g. photos
    and videos)
    * Auto-sharding for cloud-level scalability (currently in early alpha)
    * Commercial Support Available

A key goal of MongoDB is to bridge the gap between key/value stores (which are
fast and highly scalable) and traditional RDBMS systems (which are deep in
functionality).

%package devel
Summary:        MongoDB header files
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description devel
This package provides the header files and C++ driver for MongoDB. MongoDB is
a high-performance, open source, schema-free document-oriented database.

%prep
%setup -q -n mongo-%{version}
# change dbpath
%{__sed} -i 's|/data/db/|/var/lib/%{name}/|' db/pdfile.cpp db/db.cpp

%build
#scons %{?_smp_mflags} .
scons .

%install
rm -rf %{buildroot}
scons %{?_smp_mflags} install --prefix=%{buildroot}

mkdir -p %{buildroot}/usr
mv %{buildroot}/lib %{buildroot}/bin %{buildroot}/include %{buildroot}%{_prefix}

mkdir -p %{buildroot}/var/lib/%{name}

mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}

install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

%clean
rm -rf %{buildroot}


%pre
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || \
useradd -r -g %{name} -d /var/lib/%{name} -s /sbin/nologin \
-c "MongoDB Database Server" %{name}
exit 0


%post
/sbin/chkconfig --add %{name}

%preun
if [ $1 = 0 ] ; then
    /sbin/service %{name} stop >/dev/null 2>&1
    /sbin/chkconfig --del %{name}
fi


%postun
if [ "$1" -ge "1" ] ; then
    /sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi

%files
%defattr(-,root,root,-)
%doc README GNU-AGPL-3.0.txt
%dir %attr(0755, mongodb, root) /var/lib/%{name}
%dir %attr(0755, mongodb, root) %{_localstatedir}/log/%{name}
%config(noreplace) /etc/logrotate.d/%{name}
%{_bindir}/mongo*
/var/lib/%{name}
%{_initddir}/%{name}


%files devel
%defattr(-,root,root,-)
%{_includedir}/mongo
%{_libdir}/libmongoclient.a

%changelog
* Tue Dec 15 2009 Ciaran Farrell <cfarrell1980@gmail.com> 
- build for openSUSE

* Mon Aug 31 2009 Ionuț Arțăriși <mapleoin@lavabit.com> - 1.0.0-1
- Initial release.
openSUSE Build Service is sponsored by