diff options
Diffstat (limited to 'databases/mongodb/files')
7 files changed, 121 insertions, 322 deletions
diff --git a/databases/mongodb/files/mongod.in b/databases/mongodb/files/mongod.in index 272ecbea3ca7..a06b88ff5226 100644 --- a/databases/mongodb/files/mongod.in +++ b/databases/mongodb/files/mongod.in @@ -7,45 +7,55 @@ # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # -# mongod_enable (bool): Set to NO by default. -# Set it to YES to enable mongod. +# mongod_enable (bool): Set to "NO" by default. +# Set it to "YES" to enable mongod. +# mongod_limits (bool): Set to "NO" by default. +# Set it to yes to run `limits -e -U mongodb` +# just before mongod starts. +# mongod_dbpath (str): Default to "/var/db/mongodb" +# Base database directory. +# mongod_pidfile (str): Custum PID file path and name. +# Default to "${mongod_dbpath}/mongod.pid". +# mongod_flags (str): Custom additional arguments to be passed to mongod. +# Default to "--logpath ${mongod_dbpath}/mongod.log --logappend". # -# Additional configurable variables: -# mongod_config (path): Set to %%PREFIX%%/etc/mongodb.conf -# by default. Additional configuration. You -# can also use mongod_flags for additional -# command line arguments. -# mongod_dbpath (path): Set to /var/db/mongodb by default -# mongod_user (username): Set to "mongodb" by default . /etc/rc.subr name="mongod" rcvar=mongod_enable -command=%%PREFIX%%/bin/${name} - load_rc_config $name : ${mongod_enable="NO"} -: ${mongod_config="%%PREFIX%%/etc/mongodb.conf"} +: ${mongod_limits="NO"} : ${mongod_dbpath="/var/db/mongodb"} +: ${mongod_flags="--logpath ${mongod_dbpath}/mongod.log --logappend"} : ${mongod_user="mongodb"} +: ${mongod_group="mongodb"} -# Note: if you use a config file for mongodb, -# the parameters passed on cl override the config file -# ie, dbpath, logappend, logpath etc in the command_args below. -# This means that your config file will be ignored unless -# you comment out remove the cl parameters. -# -# Using config file: uncomment the following line AND comment out -# the next line. - -# command_args="-f $mongod_config" - -command_args="-f $mongod_config --dbpath $mongod_dbpath --logappend --logpath $mongod_dbpath/mongod.log --fork" - -required_dirs=${mongod_dbpath} +pidfile=${mongod_pidfile:-"${mongod_dbpath}/mongod.pid"} +command=%%PREFIX%%/bin/${name} +command_args="--config %%PREFIX%%/etc/mongodb.conf --dbpath $mongod_dbpath --pidfilepath ${pidfile} --fork" +start_precmd="${name}_prestart" + +mongod_create_dbpath() +{ + mkdir ${mongod_dbpath} >/dev/null 2>/dev/null + [ $? -eq 0 ] && chown -R ${mongod_user}:${mongod_group} ${mongod_dbpath} +} + + +mongod_prestart() +{ + if [ ! -d ${mongod_dbpath} ]; then + mongod_create_dbpath || return 1 + fi + if checkyesno mongod_limits; then + eval `/usr/bin/limits -e -U ${mongod_user}` 2>/dev/null + else + return 0 + fi +} run_rc_command "$1" - diff --git a/databases/mongodb/files/patch-SConstruct b/databases/mongodb/files/patch-SConstruct index 1afbf3cc91db..7fccb9f6a9fb 100644 --- a/databases/mongodb/files/patch-SConstruct +++ b/databases/mongodb/files/patch-SConstruct @@ -1,7 +1,15 @@ -diff -ru ./SConstruct ../../mongodb-src-r2.2.0/SConstruct ---- ./SConstruct 2012-08-28 09:28:11.000000000 +0400 -+++ ../../mongodb-src-r2.2.0/SConstruct 2012-10-14 14:04:31.000000000 +0400 -@@ -790,6 +790,20 @@ +--- SConstruct.orig 2013-03-22 20:55:25.000000000 +0100 ++++ SConstruct 2013-03-26 20:22:38.000000000 +0100 +@@ -702,7 +702,7 @@ + env.Append( LIBS=[] ) + + #make scons colorgcc friendly +- for key in ('HOME', 'TERM'): ++ for key in ('HOME', 'TERM', 'PATH', 'CCACHE_DIR'): + try: + env['ENV'][key] = os.environ[key] + except KeyError: +@@ -805,6 +805,20 @@ print( "c++ compiler not installed!" ) Exit(1) @@ -15,85 +23,10 @@ diff -ru ./SConstruct ../../mongodb-src-r2.2.0/SConstruct + if not conf.CheckLib("snappy"): + Exit(1) + -+ if use_system_version_of_library("js"): ++ if usesm and use_system_version_of_library("js"): + if not conf.CheckLib("js"): + Exit(1) + if use_system_version_of_library("boost"): if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ): print( "can't find boost headers" ) -@@ -1100,7 +1114,7 @@ - Export("has_option use_system_version_of_library") - Export("installSetup") - Export("usesm usev8") --Export("darwin windows solaris linux nix") -+Export("darwin windows solaris linux nix freebsd") - - env.SConscript( 'src/SConscript', variant_dir='$BUILD_DIR', duplicate=False ) - env.SConscript( 'src/SConscript.client', variant_dir='$BUILD_DIR/client_build', duplicate=False ) -diff -ru ./src/SConscript.client ../../mongodb-src-r2.2.0/src/SConscript.client ---- ./src/SConscript.client 2012-08-28 09:28:11.000000000 +0400 -+++ ../../mongodb-src-r2.2.0/src/SConscript.client 2012-10-14 16:48:25.000000000 +0400 -@@ -134,7 +134,7 @@ - # install - prefix = GetOption("prefix") - --env.Install(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}') -+env.InstallAs(prefix + "/lib", '${LIBPREFIX}mongoclient${LIBSUFFIX}') - - for x in clientHeaderDirectories: - env.Install(prefix + "/include/mongo/" + x, -diff -ru ./src/mongo/SConscript ../../mongodb-src-r2.2.0/src/mongo/SConscript ---- ./src/mongo/SConscript 2012-08-28 09:28:11.000000000 +0400 -+++ ../../mongodb-src-r2.2.0/src/mongo/SConscript 2012-10-14 21:34:12.000000000 +0400 -@@ -11,7 +11,7 @@ - Import("has_option") - Import("usesm usev8") - Import("installSetup") --Import("darwin windows solaris linux nix") -+Import("darwin windows solaris linux nix freebsd") - - env.SConscript(['platform/SConscript', - 'unittest/SConscript']) -@@ -170,7 +170,7 @@ - - if usesm: - env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp'], -- LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js', 'bson_template_evaluator']) -+ LIBDEPS=['bson_template_evaluator'], CPPDEFINES=["XP_UNIX"]) - elif usev8: - env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_v8.cpp', - 'scripting/v8_db.cpp', -@@ -519,7 +519,7 @@ - if (not has_option( "no-glibc-check" ) and linux and "s3dist" in COMMAND_LINE_TARGETS): - e.AddPostAction( name, checkGlibc ) - -- if (solaris or linux) and (not has_option("nostrip")): -+ if (solaris or linux or freebsd) and (not has_option("nostrip")): - name = e.Command('stripped/%s' % name, name, Copy('$TARGET', '$SOURCE'))[0] - e.AddPostAction(name, 'strip $TARGET') - -diff -ru ./src/mongo/scripting/engine_spidermonkey.cpp ../../mongodb-src-r2.2.0/src/mongo/scripting/engine_spidermonkey.cpp ---- ./src/mongo/scripting/engine_spidermonkey.cpp 2012-08-28 09:28:11.000000000 +0400 -+++ ../../mongodb-src-r2.2.0/src/mongo/scripting/engine_spidermonkey.cpp 2012-10-14 21:34:33.000000000 +0400 -@@ -25,7 +25,7 @@ - #include <boost/date_time/posix_time/posix_time.hpp> - #endif - --#include <third_party/js-1.7/jsdate.h> -+#include <jsdate.h> - - #include "mongo/util/mongoutils/str.h" - -diff -ru ./src/mongo/scripting/engine_spidermonkey.h ../../mongodb-src-r2.2.0/src/mongo/scripting/engine_spidermonkey.h ---- ./src/mongo/scripting/engine_spidermonkey.h 2012-08-28 09:28:11.000000000 +0400 -+++ ../../mongodb-src-r2.2.0/src/mongo/scripting/engine_spidermonkey.h 2012-10-14 21:35:21.000000000 +0400 -@@ -29,7 +29,7 @@ - #define JS_PUBLIC_DATA(t) t - #endif - --#include <third_party/js-1.7/jsapi.h> -+#include <jsapi.h> - - // END inc hacking - diff --git a/databases/mongodb/files/patch-boost-1.52 b/databases/mongodb/files/patch-boost-1.52 deleted file mode 100644 index 60bb474f93f6..000000000000 --- a/databases/mongodb/files/patch-boost-1.52 +++ /dev/null @@ -1,215 +0,0 @@ ---- src/mongo/db/db.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/db/db.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -348,7 +348,7 @@ - boost::filesystem::path path( dbpath ); - for ( boost::filesystem::directory_iterator i( path ); - i != boost::filesystem::directory_iterator(); ++i ) { -- string fileName = boost::filesystem::path(*i).leaf(); -+ string fileName = boost::filesystem::path(*i).leaf().string(); - if ( boost::filesystem::is_directory( *i ) && - fileName.length() && fileName[ 0 ] == '$' ) - boost::filesystem::remove_all( *i ); -@@ -748,11 +748,11 @@ - dbExecCommand = argv[0]; - - srand(curTimeMicros()); --#if( BOOST_VERSION >= 104500 ) -- boost::filesystem::path::default_name_check( boost::filesystem2::no_check ); --#else -- boost::filesystem::path::default_name_check( boost::filesystem::no_check ); --#endif -+// #if( BOOST_VERSION >= 104500 ) -+// boost::filesystem::path::default_name_check( boost::filesystem2::no_check ); -+// #else -+// boost::filesystem::path::default_name_check( boost::filesystem::no_check ); -+// #endif - - { - unsigned x = 0x12345678; -@@ -1083,7 +1083,7 @@ - if (params.count("shutdown")){ - bool failed = false; - -- string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string(); -+ string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).string(); - if ( !boost::filesystem::exists( name ) || boost::filesystem::file_size( name ) == 0 ) - failed = true; - ---- src/mongo/db/dur.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/db/dur.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -770,7 +770,7 @@ - - bool samePartition = true; - try { -- const string dbpathDir = boost::filesystem::path(dbpath).native_directory_string(); -+ const string dbpathDir = boost::filesystem::path(dbpath).string(); - samePartition = onSamePartition(getJournalDir().string(), dbpathDir); - } - catch(...) { ---- src/mongo/db/dur_journal.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/db/dur_journal.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -176,7 +176,7 @@ - for ( boost::filesystem::directory_iterator i( getJournalDir() ); - i != boost::filesystem::directory_iterator(); - ++i ) { -- string fileName = boost::filesystem::path(*i).leaf(); -+ string fileName = boost::filesystem::path(*i).leaf().string(); - if( anyFiles || str::startsWith(fileName, "j._") ) - return true; - } -@@ -194,7 +194,7 @@ - for ( boost::filesystem::directory_iterator i( getJournalDir() ); - i != boost::filesystem::directory_iterator(); - ++i ) { -- string fileName = boost::filesystem::path(*i).leaf(); -+ string fileName = boost::filesystem::path(*i).leaf().string(); - if( str::startsWith(fileName, "j._") ) { - try { - removeOldJournalFile(*i); ---- src/mongo/db/dur_recover.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/db/dur_recover.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -72,7 +72,7 @@ - i != boost::filesystem::directory_iterator(); - ++i ) { - boost::filesystem::path filepath = *i; -- string fileName = boost::filesystem::path(*i).leaf(); -+ string fileName = boost::filesystem::path(*i).leaf().string(); - if( str::startsWith(fileName, "j._") ) { - unsigned u = str::toUnsigned( str::after(fileName, '_') ); - if( m.count(u) ) { -@@ -85,7 +85,7 @@ - if( i != m.begin() && m.count(i->first - 1) == 0 ) { - uasserted(13532, - str::stream() << "unexpected file in journal directory " << dir.string() -- << " : " << boost::filesystem::path(i->second).leaf() << " : can't find its preceeding file"); -+ << " : " << boost::filesystem::path(i->second).leaf().string() << " : can't find its preceeding file"); - } - files.push_back(i->second); - } ---- src/mongo/db/instance.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ work/mongodb-src-r2.2.0/src/mongo/db/instance.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -833,13 +833,13 @@ - i != boost::filesystem::directory_iterator(); ++i ) { - if ( directoryperdb ) { - boost::filesystem::path p = *i; -- string dbName = p.leaf(); -+ string dbName = p.leaf().string(); - p /= ( dbName + ".ns" ); - if ( exists( p ) ) - names.push_back( dbName ); - } - else { -- string fileName = boost::filesystem::path(*i).leaf(); -+ string fileName = boost::filesystem::path(*i).leaf().string(); - if ( fileName.length() > 3 && fileName.substr( fileName.length() - 3, 3 ) == ".ns" ) - names.push_back( fileName.substr( 0, fileName.length() - 3 ) ); - } -@@ -1102,7 +1102,7 @@ - } - - void acquirePathLock(bool doingRepair) { -- string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string(); -+ string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).string(); - - bool oldFile = false; - ---- src/mongo/db/pdfile.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/db/pdfile.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -1675,7 +1675,7 @@ - virtual bool apply( const Path &p ) { - if ( !boost::filesystem::exists( p ) ) - return false; -- boostRenameWrapper( p, newPath_ / ( p.leaf() + ".bak" ) ); -+ boostRenameWrapper( p, newPath_ / ( p.leaf().string() + ".bak" ) ); - return true; - } - virtual const char * op() const { -@@ -1783,7 +1783,7 @@ - uniqueReservedPath( ( preserveClonedFilesOnFailure || backupOriginalFiles ) ? - "backup" : "_tmp" ); - MONGO_ASSERT_ON_EXCEPTION( boost::filesystem::create_directory( reservedPath ) ); -- string reservedPathString = reservedPath.native_directory_string(); -+ string reservedPathString = reservedPath.string(); - - bool res; - { ---- src/mongo/dbtests/framework.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/dbtests/framework.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -199,7 +199,7 @@ - boost::filesystem::create_directory(p); - } - -- string dbpathString = p.native_directory_string(); -+ string dbpathString = p.string(); - dbpath = dbpathString.c_str(); - - cmdLine.prealloc = false; ---- src/mongo/pch.h 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/pch.h 2012-10-21 18:25:50.000000000 +0300 -@@ -44,7 +44,7 @@ - #include "string.h" - #include "limits.h" - --#define BOOST_FILESYSTEM_VERSION 2 -+#define BOOST_FILESYSTEM_VERSION 3 - #include <boost/shared_ptr.hpp> - #include <boost/smart_ptr.hpp> - #include <boost/function.hpp> ---- src/mongo/shell/shell_utils_launcher.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/shell/shell_utils_launcher.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -184,7 +184,7 @@ - } - #endif - -- _argv.push_back( programPath.native_file_string() ); -+ _argv.push_back( programPath.string() ); - - _port = -1; - ---- src/mongo/tools/restore.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/tools/restore.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -174,7 +174,7 @@ - log(2) << "drillDown: " << root.string() << endl; - - // skip hidden files and directories -- if (root.leaf()[0] == '.' && root.leaf() != ".") -+ if (root.leaf().string()[0] == '.' && root.leaf().string() != ".") - return; - - if ( is_directory( root ) ) { -@@ -255,7 +255,7 @@ - - verify( ns.size() ); - -- string oldCollName = root.leaf(); // Name of the collection that was dumped from -+ string oldCollName = root.leaf().string(); // Name of the collection that was dumped from - oldCollName = oldCollName.substr( 0 , oldCollName.find_last_of( "." ) ); - if (use_coll) { - ns += "." + _coll; -@@ -287,7 +287,7 @@ - if (!boost::filesystem::exists(metadataFile.string())) { - // This is fine because dumps from before 2.1 won't have a metadata file, just print a warning. - // System collections shouldn't have metadata so don't warn if that file is missing. -- if (!startsWith(metadataFile.leaf(), "system.")) { -+ if (!startsWith(metadataFile.leaf().string(), "system.")) { - log() << metadataFile.string() << " not found. Skipping." << endl; - } - } else { ---- src/mongo/tools/tool.cpp 2012-08-28 08:28:11.000000000 +0300 -+++ src/mongo/tools/tool.cpp 2012-10-21 18:25:50.000000000 +0300 -@@ -118,11 +118,11 @@ - // we want durability to be disabled. - cmdLine.dur = false; - --#if( BOOST_VERSION >= 104500 ) -- boost::filesystem::path::default_name_check( boost::filesystem2::no_check ); --#else -- boost::filesystem::path::default_name_check( boost::filesystem::no_check ); --#endif -+// #if( BOOST_VERSION >= 104500 ) -+// boost::filesystem::path::default_name_check( boost::filesystem2::no_check ); -+// #else -+// boost::filesystem::path::default_name_check( boost::filesystem::no_check ); -+// #endif - - _name = argv[0]; diff --git a/databases/mongodb/files/patch-src_mongo_SConscript b/databases/mongodb/files/patch-src_mongo_SConscript new file mode 100644 index 000000000000..5e65400269ca --- /dev/null +++ b/databases/mongodb/files/patch-src_mongo_SConscript @@ -0,0 +1,29 @@ +--- src/mongo/SConscript.orig 2013-03-22 20:55:25.000000000 +0100 ++++ src/mongo/SConscript 2013-03-25 17:46:04.000000000 +0100 +@@ -13,7 +13,7 @@ Import("has_option") + Import("usesm usev8") + Import("installSetup") + Import("enforce_glibc") +-Import("darwin windows solaris linux nix") ++Import("darwin windows solaris linux freebsd nix") + + env.SConscript(['base/SConscript', + 'db/auth/SConscript', +@@ -310,7 +310,7 @@ env.CppUnitTest('bson_template_evaluator + if usesm: + env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp', + 'scripting/sm_db.cpp'], +- LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js', 'bson_template_evaluator']) ++ LIBDEPS=['bson_template_evaluator'], CPPDEFINES=["XP_UNIX"]) + elif usev8: + env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_v8.cpp', + 'scripting/v8_db.cpp', +@@ -765,7 +765,7 @@ def installBinary( e, name ): + if enforce_glibc: + e.AddPostAction( name, checkGlibc ) + +- if (solaris or linux) and (not has_option("nostrip")): ++ if (solaris or linux or freebsd) and (not has_option("nostrip")): + name = e.Command('stripped/%s' % name, name, Copy('$TARGET', '$SOURCE'))[0] + e.AddPostAction(name, 'strip $TARGET') + diff --git a/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.cpp b/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.cpp new file mode 100644 index 000000000000..4dc52b78869f --- /dev/null +++ b/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.cpp @@ -0,0 +1,11 @@ +--- src/mongo/scripting/engine_spidermonkey.cpp.orig 2013-03-15 19:59:55.000000000 +0100 ++++ src/mongo/scripting/engine_spidermonkey.cpp 2013-03-22 17:54:19.000000000 +0100 +@@ -25,7 +25,7 @@ + #include <boost/date_time/posix_time/posix_time.hpp> + #endif + +-#include <third_party/js-1.7/jsdate.h> ++#include <jsdate.h> + + #include "mongo/scripting/engine_spidermonkey_internal.h" + #include "mongo/util/mongoutils/str.h" diff --git a/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.h b/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.h new file mode 100644 index 000000000000..0f9a5a4d92f3 --- /dev/null +++ b/databases/mongodb/files/patch-src_mongo_scripting_engine_spidermonkey.h @@ -0,0 +1,11 @@ +--- src/mongo/scripting/engine_spidermonkey.h.orig 2013-03-15 19:59:55.000000000 +0100 ++++ src/mongo/scripting/engine_spidermonkey.h 2013-03-22 17:54:19.000000000 +0100 +@@ -29,7 +29,7 @@ + #define JS_PUBLIC_DATA(t) t + #endif + +-#include <third_party/js-1.7/jsapi.h> ++#include <jsapi.h> + + // END inc hacking + diff --git a/databases/mongodb/files/patch-src_mongo_util_net_ssl_manager.cpp b/databases/mongodb/files/patch-src_mongo_util_net_ssl_manager.cpp new file mode 100644 index 000000000000..7877107aa5d4 --- /dev/null +++ b/databases/mongodb/files/patch-src_mongo_util_net_ssl_manager.cpp @@ -0,0 +1,20 @@ +--- src/mongo/util/net/ssl_manager.cpp.orig 2013-03-25 17:59:54.000000000 +0100 ++++ src/mongo/util/net/ssl_manager.cpp 2013-03-25 18:03:11.000000000 +0100 +@@ -183,6 +183,7 @@ namespace mongo { + } + + void SSLManager::_setupFIPS() { ++#ifdef OPENSSL_FIPS + // Turn on FIPS mode if requested. + int status = FIPS_mode_set(1); + if (!status) { +@@ -191,6 +192,9 @@ namespace mongo { + fassertFailed(16703); + } + log() << "FIPS 140-2 mode activated" << endl; ++#else ++ error() << "can't activate FIPS mode: OpenSSL not built with FIPS support" << endl; ++#endif + } + + bool SSLManager::_setupPEM(const std::string& keyFile , const std::string& password) { |