[mongodb] Initial import (#526567)

Ionuț Arțăriși mapleoin at fedoraproject.org
Mon Sep 6 10:55:55 UTC 2010


commit 983e3493bc77e1e8e078db3ec37e367ad0e23fcd
Author: Ionuț C. Arțăriși <mapleoin at lavabit.com>
Date:   Mon Sep 6 13:53:43 2010 +0300

    Initial import (#526567)

 .gitignore             |    1 +
 mongodb-cppflags.patch |   42 +++++++++
 mongodb.conf           |   91 +++++++++++++++++++
 mongodb.init           |   93 ++++++++++++++++++++
 mongodb.logrotate      |   12 +++
 mongodb.spec           |  225 ++++++++++++++++++++++++++++++++++++++++++++++++
 sources                |    1 +
 7 files changed, 465 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..89904a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/mongodb-src-r1.6.2.tar.gz
diff --git a/mongodb-cppflags.patch b/mongodb-cppflags.patch
new file mode 100644
index 0000000..4f210d9
--- /dev/null
+++ b/mongodb-cppflags.patch
@@ -0,0 +1,42 @@
+diff -up mongodb-src-r1.6.1/SConstruct.cppflags mongodb-src-r1.6.1/SConstruct
+--- mongodb-src-r1.6.1/SConstruct.cppflags	2010-09-01 15:54:52.456271054 +0300
++++ mongodb-src-r1.6.1/SConstruct	2010-09-01 17:13:02.507181298 +0300
+@@ -110,6 +110,13 @@ AddOption('--asio',
+           action="store",
+           help="Use Asynchronous IO (NOT READY YET)" )
+ 
++AddOption('--cppflags',
++          dest='cppflags',
++          type="string",
++          nargs=1,
++          action="store",
++          help="set custom cppflags, overriding everything else")
++
+ AddOption( "--d",
+            dest="debugBuild",
+            type="string",
+@@ -744,8 +751,13 @@ else:
+     print( "No special config for [" + os.sys.platform + "] which probably means it won't work" )
+ 
+ if nix:
+-    env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" )
+-    if linux:
++    cppflags = GetOption("cppflags")
++    if cppflags:
++        env.Append( CPPFLAGS= cppflags )
++    else:
++        env.Append( CPPFLAGS="-fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch" )
++
++    if linux and not cppflags:
+         env.Append( CPPFLAGS=" -Werror " )
+     env.Append( CXXFLAGS=" -Wnon-virtual-dtor " )
+     env.Append( LINKFLAGS=" -fPIC -pthread -rdynamic" )
+@@ -757,7 +769,7 @@ if nix:
+     if debugBuild:
+         env.Append( CPPFLAGS=" -O0 -fstack-protector " );
+         env['ENV']['GLIBCXX_FORCE_NEW'] = 1; # play nice with valgrind
+-    else:
++    elif not cppflags:
+         env.Append( CPPFLAGS=" -O3" )
+ 
+     if debugLogging:
diff --git a/mongodb.conf b/mongodb.conf
new file mode 100644
index 0000000..727c84d
--- /dev/null
+++ b/mongodb.conf
@@ -0,0 +1,91 @@
+# mongodb.conf
+
+#where to log
+logpath=/var/log/mongodb/mongodb.log
+
+# fork and run in background
+fork = true
+
+#port = 27017
+
+dbpath=/var/lib/mongodb
+
+pidfilepath=/var/run/mongodb/mongodb.pid
+
+# Enables periodic logging of CPU utilization and I/O wait
+#cpu = true
+
+# Turn on/off security.  Off is currently the default
+#noauth = true
+#auth = true
+
+# Verbose logging output.
+#verbose = true
+
+# Inspect all client data for validity on receipt (useful for
+# developing drivers)
+#objcheck = true
+
+# Enable db quota management
+#quota = true
+
+# Set oplogging level where n is
+#   0=off (default)
+#   1=W
+#   2=R
+#   3=both
+#   7=W+some reads
+#oplog = 0
+
+# Diagnostic/debugging option
+#nocursors = true
+
+# Ignore query hints
+#nohints = true
+
+# Disable the HTTP interface (Defaults to localhost:27018).
+#nohttpinterface = true
+
+# Turns off server-side scripting.  This will result in greatly limited
+# functionality
+#noscripting = true
+
+# Turns off table scans.  Any query that would do a table scan fails.
+#notablescan = true
+
+# Disable data file preallocation.
+#noprealloc = true
+
+# Specify .ns file size for new databases.
+# nssize = <size>
+
+# Accout token for Mongo monitoring server.
+#mms-token = <token>
+
+# Server name for Mongo monitoring server.
+#mms-name = <server-name>
+
+# Ping interval for Mongo monitoring server.
+#mms-interval = <seconds>
+
+# Replication Options
+
+# in replicated mongo databases, specify here whether this is a slave or master
+#slave = true
+#source = master.example.com
+# Slave only: specify a single database to replicate
+#only = master.example.com
+# or
+#master = true
+#source = slave.example.com
+
+# Address of a server to pair with.
+#pairwith = <server:port>
+# Address of arbiter server.
+#arbiter = <server:port>
+# Automatically resync if slave data is stale
+#autoresync
+# Custom size for replication operation log.
+#oplogSize = <MB>
+# Size limit for in-memory storage of op ids.
+#opIdMem = <bytes>
diff --git a/mongodb.init b/mongodb.init
new file mode 100644
index 0000000..c8c1cda
--- /dev/null
+++ b/mongodb.init
@@ -0,0 +1,93 @@
+#!/bin/sh
+#
+# mongodb      init file for starting up the MongoDB server
+#
+# chkconfig:   - 20 80
+# description: Starts and stops the MongDB daemon that handles all \
+#              database requests.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+exec="/usr/bin/mongod"
+prog="mongod"
+logfile="/var/log/mongodb/mongodb.log"
+options=" -f /etc/mongodb.conf"
+
+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
+
+lockfile="/var/lock/subsys/mongod"
+
+start() {
+    [ -x $exec ] || exit 5
+    echo -n $"Starting $prog: "
+    daemon --user mongodb "$exec --quiet $options run >> $logfile 2>&1 &"
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    echo -n $"Stopping $prog: "
+    killproc $prog
+    retval=$?
+    echo
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    restart
+}
+
+force_reload() {
+    restart
+}
+
+rh_status() {
+    # run checks to determine if the service is running or use generic status
+    status $prog
+}
+
+rh_status_q() {
+    rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        rh_status_q || exit 7
+        $1
+        ;;
+    force-reload)
+        force_reload
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+        exit 2
+esac
+exit $?
diff --git a/mongodb.logrotate b/mongodb.logrotate
new file mode 100644
index 0000000..862d57b
--- /dev/null
+++ b/mongodb.logrotate
@@ -0,0 +1,12 @@
+/var/log/mongodb/*.log {
+       weekly
+       rotate 10
+       copytruncate
+       delaycompress
+       compress
+       notifempty
+       missingok
+       postrotate
+          /bin/kill -USR1 `cat /var/run/mongodb/mongodb.pid 2>/dev/null` 2> /dev/null|| true
+       endscript
+}
\ No newline at end of file
diff --git a/mongodb.spec b/mongodb.spec
new file mode 100644
index 0000000..2bbfccd
--- /dev/null
+++ b/mongodb.spec
@@ -0,0 +1,225 @@
+%global         daemon mongod
+Name:           mongodb
+Version:        1.6.2
+Release:        1%{?dist}
+Summary:        High-performance, schema-free document-oriented database
+Group:          Applications/Databases
+License:        AGPLv3 and zlib and ASL 2.0
+# util/md5 is under the zlib license
+# manpages and bson are under ASL 2.0
+# everything else is AGPLv3
+URL:            http://www.mongodb.org
+
+Source0:        http://fastdl.mongodb.org/src/%{name}-src-r%{version}.tar.gz
+Source1:        %{name}.init
+Source2:        %{name}.logrotate
+Source3:        %{name}.conf
+Patch0:         %{name}-cppflags.patch
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires:  python-devel
+BuildRequires:  scons
+BuildRequires:  boost-devel
+BuildRequires:  pcre-devel
+BuildRequires:  js-devel
+BuildRequires:  readline-devel
+BuildRequires:  libpcap-devel
+# to run tests
+BuildRequires:  unittest
+
+Requires:       js
+Requires(post): chkconfig
+Requires(preun): chkconfig
+
+Requires(pre):  shadow-utils
+
+# This is for /sbin/service
+Requires(postun): initscripts
+
+
+%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}
+Provides:       %{name}-static = %{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.
+
+%package server
+Summary:        MongoDB server, sharding server and support scripts
+Group:          Applications/Databases
+Requires:       %{name} = %{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 mongodb-src-r%{version}
+
+# allow cppflags overriding
+%patch0 -p1 -b .cppflags
+
+# spurious permissions
+chmod -x README
+chmod -x db/repl/rs_exception.h
+chmod -x db/resource.h
+
+# wrong end-of-file encoding
+sed -i 's/\r//' db/repl/rs_exception.h
+sed -i 's/\r//' db/resource.h
+sed -i 's/\r//' README
+
+%build
+scons %{?_smp_mflags} --cppflags="%{optflags}"  .
+
+
+%install
+rm -rf %{buildroot}
+scons install . --prefix=%{buildroot}%{_prefix} --nostrip --full
+
+mkdir -p %{buildroot}%{_sharedstatedir}/%{name}
+
+mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
+install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{daemon}
+install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/mongodb.conf
+
+mkdir -p %{buildroot}%{_mandir}/man1
+cp -p debian/*.1 %{buildroot}%{_mandir}/man1/
+
+mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
+
+%clean
+rm -rf %{buildroot}
+
+
+%pre server
+getent group %{name} >/dev/null || groupadd -r %{name}
+getent passwd %{name} >/dev/null || \
+useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s /sbin/nologin \
+-c "MongoDB Database Server" %{name}
+exit 0
+
+
+%post server
+/sbin/chkconfig --add %{daemon}
+
+
+%preun server
+if [ $1 = 0 ] ; then
+    /sbin/service  stop >/dev/null 2>&1
+    /sbin/chkconfig --del %{daemon}
+fi
+
+
+%postun server
+if [ "$1" -ge "1" ] ; then
+    /sbin/service %{daemon} condrestart >/dev/null 2>&1 || :
+fi
+
+
+%files
+%defattr(-,root,root,-)
+%doc README GNU-AGPL-3.0.txt APACHE-2.0.txt
+%{_bindir}/mongo
+%{_bindir}/mongodump
+%{_bindir}/mongoexport
+%{_bindir}/mongofiles
+%{_bindir}/mongoimport
+%{_bindir}/mongorestore
+%{_bindir}/mongostat
+%{_bindir}/mongosniff
+%{_bindir}/bsondump
+
+%{_mandir}/man1/mongo.1*
+%{_mandir}/man1/mongod.1*
+%{_mandir}/man1/mongodump.1*
+%{_mandir}/man1/mongoexport.1*
+%{_mandir}/man1/mongofiles.1*
+%{_mandir}/man1/mongoimport.1*
+%{_mandir}/man1/mongosniff.1*
+%{_mandir}/man1/mongostat.1*
+%{_mandir}/man1/mongorestore.1*
+
+%files server
+%defattr(-,root,root,-)
+%{_initddir}/%{daemon}
+%{_bindir}/mongod
+%{_bindir}/mongos
+%{_mandir}/man1/mongod.1*
+%{_mandir}/man1/mongos.1*
+%dir %attr(0755, %{name}, root) %{_sharedstatedir}/%{name}
+%dir %attr(0755, %{name}, root) %{_localstatedir}/log/%{name}
+%dir %attr(0755, %{name}, root) %{_localstatedir}/run/%{name}
+%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+%config(noreplace) %{_sysconfdir}/mongodb.conf
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/mongo
+%{_libdir}/libmongoclient.a
+
+%changelog
+* Fri Sep  3 2010 Ionuț C. Arțăriși <mapleoin at fedoraproject.org> - 1.6.2-1
+- new upstream release 1.6.2
+- send mongod the USR1 signal when doing logrotate
+- use config options when starting the daemon from the initfile
+- removed dbpath patch: rely on config
+- added pid directory to config file and created the dir in the spec
+- made the init script use options from the config file
+- changed logpath in mongodb.conf
+
+* Wed Sep  1 2010 Ionuț C. Arțăriși <mapleoin at fedoraproject.org> - 1.6.1-1
+- new upstream release 1.6.1
+- patched SConstruct to allow setting cppflags
+- stopped using sed and chmod macros
+
+* Fri Aug  6 2010 Ionuț C. Arțăriși <mapleoin at fedoraproject.org> - 1.6.0-1
+- new upstream release: 1.6.0
+- added -server package
+- added new license file to %%docs
+- fix spurious permissions and EOF encodings on some files
+
+* Tue Jun 15 2010 Ionuț C. Arțăriși <mapleoin at fedoraproject.org> - 1.4.3-2
+- added explicit js requirement
+- changed some names
+
+* Wed May 26 2010 Ionuț C. Arțăriși <mapleoin at fedoraproject.org> - 1.4.3-1
+- updated to 1.4.3
+- added zlib license for util/md5
+- deleted upstream deb/rpm recipes
+- made scons not strip binaries
+- made naming more consistent in logfile, lockfiles, init scripts etc.
+- included manpages and added corresponding license
+- added mongodb.conf to sources
+
+* Fri Oct  2 2009 Ionuț Arțăriși <mapleoin at fedoraproject.org> - 1.0.0-3
+- fixed libpath issue for 64bit systems
+
+* Thu Oct  1 2009 Ionuț Arțăriși <mapleoin at fedoraproject.org> - 1.0.0-2
+- added virtual -static package
+
+* Mon Aug 31 2009 Ionuț Arțăriși <mapleoin at fedoraproject.org> - 1.0.0-1
+- Initial release.
diff --git a/sources b/sources
index e69de29..3908b12 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+358bfc52855a66d3c954e7f6f51bcd12  mongodb-src-r1.6.2.tar.gz


More information about the scm-commits mailing list