[dev-db/mongodb] add newer

This commit is contained in:
Robert Förster 2023-03-03 18:59:39 +01:00
parent 6d67032b2b
commit 3ef1c19c85
32 changed files with 1457 additions and 0 deletions

2
dev-db/mongodb/Manifest Normal file
View File

@ -0,0 +1,2 @@
DIST mongodb-src-r4.4.19.tar.gz 50865489 BLAKE2B 082956a1c64daca2ac1c8c59e5a2a14a773e2cdf9ca076589d4afd3914584e68bbae0101d05d90a6c51b10aa8cd07c96c589c13f5374948ad80c2db0838625a5 SHA512 70310d74072077c9470f1bf99389c14a21e8631374df2dae16e4a7e8d6d9ebcf260d4ce21d34174e1cca13d58802a5cc3990c3b2511c76de6d0e12e57d06bb6a
DIST mongodb-src-r5.0.15.tar.gz 56141122 BLAKE2B a1ac106b046499cd643fcbed6173a2a2c366be4e20b1a80e7ff604a192b35ce6f294f589c5c18b68c2b04b257d28eaf97366516f6e83a717da2e2b7c9615945d SHA512 1f3298bb92ebdeab3894257cf9d98e1a61601d418f0a30e3fada621dfcb530e642a861c8297b0d698cebef6e5027ea7bd07bfa5297d9a9b679a3580f2a365308

View File

@ -0,0 +1,30 @@
--- a/SConstruct 2019-08-21 09:25:00.980260318 +0200
+++ b/SConstruct 2019-08-21 09:27:53.653601283 +0200
@@ -1858,7 +1858,6 @@
# -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
env.Append( CCFLAGS=["-fno-omit-frame-pointer",
"-fno-strict-aliasing",
- "-ggdb" if not env.TargetOSIs('emscripten') else "-g",
"-pthread",
"-Wall",
"-Wsign-compare",
@@ -1870,6 +1869,8 @@
env.Append( CCFLAGS=["-Werror"] )
env.Append( CXXFLAGS=["-Woverloaded-virtual"] )
+ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] )
+ env.Append( LINKFLAGS=os.environ['LDFLAGS'] )
if env.ToolchainIs('clang'):
env.Append( CXXFLAGS=['-Werror=unused-result'] )
@@ -1890,8 +1891,8 @@
env.Append( LIBS=[] )
- #make scons colorgcc friendly
- for key in ('HOME', 'TERM'):
+ #make scons colorgcc, distcc, ccache friendly
+ for key in ('HOME', 'PATH', 'TERM'):
try:
env['ENV'][key] = os.environ[key]
except KeyError:

View File

@ -0,0 +1,45 @@
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 0379fcb0..1aabddba 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -808,32 +808,6 @@ for full_dir, archive_dir in list(env["ARCHIVE_ADDITION_DIR_MAP"].items()):
for target in env["DIST_BINARIES"]:
installBinary(env, "db/modules/" + target)
-compass_script = "install_compass"
-if env.TargetOSIs('windows'):
- # On windows the .in needs to be explicitly added to the file.
- compass_script = "Install-Compass.ps1"
-
-compass_installer = f"#/src/mongo/installer/compass/{compass_script}"
-
-distBinaries.append(compass_installer)
-
-if not hygienic:
- compass_script_installer = env.Install("$INSTALL_DIR/bin", compass_installer)
-else:
- compass_script_installer = env.AutoInstall(
- 'bin',
- source=[
- compass_installer,
- ],
- INSTALL_ALIAS=[
- 'tools',
- ],
- )
-
-if env.TargetOSIs('posix'):
- env.AddPostAction( compass_script_installer, 'chmod 755 $TARGET' )
- env.AddPostAction( compass_installer, 'chmod 755 $TARGET' )
-
# "dist" target is valid only when --use-new-tools is specified
# Attempts to build release artifacts without tools must fail
if has_option("use-new-tools"):
@@ -851,7 +825,6 @@ if has_option("use-new-tools"):
'--transform $BUILD_DIR/mongo=$SERVER_DIST_BASENAME/bin',
'--transform $BUILD_DIR/mongo/stripped/src/mongo-tools=$SERVER_DIST_BASENAME/bin',
'--transform src/mongo-tools=$SERVER_DIST_BASENAME/bin',
- '--transform src/mongo/installer/compass=$SERVER_DIST_BASENAME/bin',
'${TEMPFILE(SOURCES[1:])}'
],
),

View File

@ -0,0 +1,41 @@
https://bugs.gentoo.org/844235
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -51,6 +51,7 @@
#endif
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/none.hpp>
#include <boost/optional.hpp>
#include <fmt/format.h>
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -36,6 +36,7 @@
#include <limits>
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/base/simple_string_data_comparator.h"
--- a/src/mongo/shell/shell_utils_extended.cpp
+++ b/src/mongo/shell/shell_utils_extended.cpp
@@ -37,6 +37,7 @@
#endif
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <fstream>
#include "mongo/scripting/engine.h"
--- a/src/mongo/db/storage/storage_repair_observer.cpp
+++ b/src/mongo/db/storage/storage_repair_observer.cpp
@@ -41,6 +41,7 @@
#include <sys/types.h>
#endif
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/db/dbhelpers.h"

View File

@ -0,0 +1,21 @@
--- a/SConstruct
+++ b/SConstruct
@@ -3511,17 +3511,11 @@ def doConfigure(myenv):
"BOOST_LOG_NO_SHORTHAND_NAMES",
"BOOST_LOG_USE_NATIVE_SYSLOG",
"BOOST_LOG_WITHOUT_THREAD_ATTR",
+ "BOOST_LOG_DYN_LINK",
"ABSL_FORCE_ALIGNED_ACCESS",
]
)
- if link_model.startswith("dynamic") and not link_model == 'dynamic-sdk':
- conf.env.AppendUnique(
- CPPDEFINES=[
- "BOOST_LOG_DYN_LINK",
- ]
- )
-
if use_system_version_of_library("boost"):
if not conf.CheckCXXHeader( "boost/filesystem/operations.hpp" ):
myenv.ConfError("can't find boost headers")

View File

@ -0,0 +1,33 @@
diff --git a/SConstruct b/SConstruct
index 89c044ab..a6d02072 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2064,7 +2064,6 @@ if env.TargetOSIs('posix'):
env.Append( CCFLAGS=["-fno-omit-frame-pointer",
"-fno-strict-aliasing",
"-fasynchronous-unwind-tables",
- "-ggdb" if not env.TargetOSIs('emscripten') else "-g",
"-pthread",
"-Wall",
"-Wsign-compare",
@@ -2076,6 +2075,9 @@ if env.TargetOSIs('posix'):
env.Append( CCFLAGS=["-Werror"] )
env.Append( CXXFLAGS=["-Woverloaded-virtual"] )
+ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] )
+ env.Append( LINKFLAGS=os.environ['LDFLAGS'] )
+
if env.ToolchainIs('clang'):
env.Append( CXXFLAGS=['-Werror=unused-result'] )
@@ -2096,8 +2098,8 @@ if env.TargetOSIs('posix'):
env.Append( LIBS=[] )
- #make scons colorgcc friendly
- for key in ('HOME', 'TERM'):
+ #make scons colorgcc, distcc, ccache friendly
+ for key in ('HOME', 'PATH', 'TERM'):
try:
env['ENV'][key] = os.environ[key]
except KeyError:

View File

@ -0,0 +1,12 @@
https://bugs.gentoo.org/768339
--- a/src/mongo/db/exec/plan_stats.h
+++ b/src/mongo/db/exec/plan_stats.h
@@ -33,6 +33,7 @@
#include <cstdlib>
#include <string>
#include <vector>
+#include <optional>
#include "mongo/db/index/multikey_paths.h"

View File

@ -0,0 +1,71 @@
https://bugs.gentoo.org/844235
--- a/src/mongo/db/auth/security_key_test.cpp
+++ b/src/mongo/db/auth/security_key_test.cpp
@@ -30,6 +30,7 @@
#include "mongo/platform/basic.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include "mongo/base/string_data.h"
#include "mongo/db/auth/authorization_manager.h"
--- a/src/mongo/db/storage/storage_repair_observer.cpp
+++ b/src/mongo/db/storage/storage_repair_observer.cpp
@@ -41,6 +41,7 @@
#include <sys/types.h>
#endif
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/db/dbhelpers.h"
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/storage/kv/kv_engine_test_harness.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include <memory>
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -36,6 +36,7 @@
#include <limits>
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/base/simple_string_data_comparator.h"
--- a/src/mongo/shell/shell_utils_extended.cpp
+++ b/src/mongo/shell/shell_utils_extended.cpp
@@ -37,6 +37,7 @@
#endif
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <fstream>
#include "mongo/bson/bson_validate.h"
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -36,6 +36,7 @@
#include <iostream>
#include <malloc.h>
#include <pcrecpp.h>
+#include <fstream>
#include <sched.h>
#include <stdio.h>
#include <sys/mman.h>
--- a/src/mongo/util/stacktrace_threads.cpp
+++ b/src/mongo/util/stacktrace_threads.cpp
@@ -36,6 +36,7 @@
#include <array>
#include <atomic>
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <cctype>
#include <cstdint>
#include <cstdlib>

View File

@ -0,0 +1,317 @@
https://bugs.gentoo.org/887037
Workaround https://github.com/boostorg/container/commit/99091420ae553b27345e04279fd19fe24fb684c1
in Boost 1.81.
Upstream s2 (as in real upstream, not MongoDB) has deviated substantially
from the version vendored.
--- a/src/third_party/s2/base/stl_decl_msvc.h
+++ b/src/third_party/s2/base/stl_decl_msvc.h
@@ -118,8 +118,8 @@ namespace msvchash {
class hash_multimap;
} // end namespace msvchash
-using msvchash::hash_set;
-using msvchash::hash_map;
+using msvchash::hash_set = my_hash_set;
+using msvchash::hash_map = my_hash_map;
using msvchash::hash;
using msvchash::hash_multimap;
using msvchash::hash_multiset;
--- a/src/third_party/s2/base/stl_decl_osx.h
+++ b/src/third_party/s2/base/stl_decl_osx.h
@@ -68,8 +68,8 @@ using std::string;
using namespace std;
using __gnu_cxx::hash;
-using __gnu_cxx::hash_set;
-using __gnu_cxx::hash_map;
+using __gnu_cxx::hash_set = my_hash_set;
+using __gnu_cxx::hash_map = my_hash_map;
using __gnu_cxx::select1st;
/* On Linux (and gdrive on OSX), this comes from places like
--- a/src/third_party/s2/hash.h
+++ b/src/third_party/s2/hash.h
@@ -2,10 +2,10 @@
#define THIRD_PARTY_S2_HASH_H_
#include <unordered_map>
-#define hash_map std::unordered_map
+#define my_hash_map std::unordered_map
#include <unordered_set>
-#define hash_set std::unordered_set
+#define my_hash_set std::unordered_set
#define HASH_NAMESPACE_START namespace std {
#define HASH_NAMESPACE_END }
--- a/src/third_party/s2/s2_test.cc
+++ b/src/third_party/s2/s2_test.cc
@@ -10,7 +10,7 @@ using std::reverse;
#include <hash_set>
#include <hash_map>
-using __gnu_cxx::hash_set;
+using __gnu_cxx::hash_set = my_hash_map;
#include "s2.h"
#include "base/logging.h"
@@ -709,8 +709,8 @@ TEST(S2, Frames) {
#if 0
TEST(S2, S2PointHashSpreads) {
int kTestPoints = 1 << 16;
- hash_set<size_t> set;
- hash_set<S2Point> points;
+ my_hash_set<size_t> set;
+ my_hash_set<S2Point> points;
hash<S2Point> hasher;
S2Point base = S2Point(1, 1, 1);
for (int i = 0; i < kTestPoints; ++i) {
@@ -733,7 +733,7 @@ TEST(S2, S2PointHashCollapsesZero) {
double minus_zero = -zero;
EXPECT_NE(*reinterpret_cast<uint64 const*>(&zero),
*reinterpret_cast<uint64 const*>(&minus_zero));
- hash_map<S2Point, int> map;
+ my_hash_map<S2Point, int> map;
S2Point zero_pt(zero, zero, zero);
S2Point minus_zero_pt(minus_zero, minus_zero, minus_zero);
--- a/src/third_party/s2/s2cellid_test.cc
+++ b/src/third_party/s2/s2cellid_test.cc
@@ -10,7 +10,7 @@ using std::reverse;
#include <cstdio>
#include <hash_map>
-using __gnu_cxx::hash_map;
+using __gnu_cxx::hash_map = my_hash_map;
#include <sstream>
#include <vector>
@@ -170,7 +170,7 @@ TEST(S2CellId, Tokens) {
static const int kMaxExpandLevel = 3;
static void ExpandCell(S2CellId const& parent, vector<S2CellId>* cells,
- hash_map<S2CellId, S2CellId>* parent_map) {
+ my_hash_map<S2CellId, S2CellId>* parent_map) {
cells->push_back(parent);
if (parent.level() == kMaxExpandLevel) return;
int i, j, orientation;
@@ -194,7 +194,7 @@ static void ExpandCell(S2CellId const& parent, vector<S2CellId>* cells,
TEST(S2CellId, Containment) {
// Test contains() and intersects().
- hash_map<S2CellId, S2CellId> parent_map;
+ my_hash_map<S2CellId, S2CellId> parent_map;
vector<S2CellId> cells;
for (int face = 0; face < 6; ++face) {
ExpandCell(S2CellId::FromFacePosLevel(face, 0, 0), &cells, &parent_map);
--- a/src/third_party/s2/s2loop.cc
+++ b/src/third_party/s2/s2loop.cc
@@ -120,7 +120,7 @@ bool S2Loop::IsValid(string* err) const {
}
}
// Loops are not allowed to have any duplicate vertices.
- hash_map<S2Point, int> vmap;
+ my_hash_map<S2Point, int> vmap;
for (int i = 0; i < num_vertices(); ++i) {
if (!vmap.insert(make_pair(vertex(i), i)).second) {
VLOG(2) << "Duplicate vertices: " << vmap[vertex(i)] << " and " << i;
--- a/src/third_party/s2/s2polygon.cc
+++ b/src/third_party/s2/s2polygon.cc
@@ -117,7 +117,7 @@ HASH_NAMESPACE_END
bool S2Polygon::IsValid(const vector<S2Loop*>& loops, string* err) {
// If a loop contains an edge AB, then no other loop may contain AB or BA.
if (loops.size() > 1) {
- hash_map<S2PointPair, pair<int, int> > edges;
+ my_hash_map<S2PointPair, pair<int, int> > edges;
for (size_t i = 0; i < loops.size(); ++i) {
S2Loop* lp = loops[i];
for (int j = 0; j < lp->num_vertices(); ++j) {
--- a/src/third_party/s2/s2polygonbuilder.cc
+++ b/src/third_party/s2/s2polygonbuilder.cc
@@ -175,7 +175,7 @@ S2Loop* S2PolygonBuilder::AssembleLoop(S2Point const& v0, S2Point const& v1,
// This ensures that only CCW loops are constructed when possible.
vector<S2Point> path; // The path so far.
- hash_map<S2Point, int> index; // Maps a vertex to its index in "path".
+ my_hash_map<S2Point, int> index; // Maps a vertex to its index in "path".
path.push_back(v0);
path.push_back(v1);
index[v1] = 1;
@@ -361,7 +361,7 @@ void S2PolygonBuilder::BuildMergeMap(PointIndex* index, MergeMap* merge_map) {
// First, we build the set of all the distinct vertices in the input.
// We need to include the source and destination of every edge.
- hash_set<S2Point> vertices;
+ my_hash_set<S2Point> vertices;
for (EdgeSet::const_iterator i = edges_->begin(); i != edges_->end(); ++i) {
vertices.insert(i->first);
VertexSet const& vset = i->second;
@@ -370,7 +370,7 @@ void S2PolygonBuilder::BuildMergeMap(PointIndex* index, MergeMap* merge_map) {
}
// Build a spatial index containing all the distinct vertices.
- for (hash_set<S2Point>::const_iterator i = vertices.begin();
+ for (my_hash_set<S2Point>::const_iterator i = vertices.begin();
i != vertices.end(); ++i) {
index->Insert(*i);
}
@@ -378,7 +378,7 @@ void S2PolygonBuilder::BuildMergeMap(PointIndex* index, MergeMap* merge_map) {
// Next, we loop through all the vertices and attempt to grow a maximial
// mergeable group starting from each vertex.
vector<S2Point> frontier, mergeable;
- for (hash_set<S2Point>::const_iterator vstart = vertices.begin();
+ for (my_hash_set<S2Point>::const_iterator vstart = vertices.begin();
vstart != vertices.end(); ++vstart) {
// Skip any vertices that have already been merged with another vertex.
if (merge_map->find(*vstart) != merge_map->end()) continue;
--- a/src/third_party/s2/s2polygonbuilder.h
+++ b/src/third_party/s2/s2polygonbuilder.h
@@ -262,7 +262,7 @@ class S2PolygonBuilder {
// current position to a new position, and also returns a spatial index
// containing all of the vertices that do not need to be moved.
class PointIndex;
- typedef hash_map<S2Point, S2Point> MergeMap;
+ typedef my_hash_map<S2Point, S2Point> MergeMap;
void BuildMergeMap(PointIndex* index, MergeMap* merge_map);
// Moves a set of vertices from old to new positions.
@@ -282,7 +282,7 @@ class S2PolygonBuilder {
// once. We could have also used a multiset<pair<S2Point, S2Point> >,
// but this representation is a bit more convenient.
typedef multiset<S2Point> VertexSet;
- typedef hash_map<S2Point, VertexSet> EdgeSet;
+ typedef my_hash_map<S2Point, VertexSet> EdgeSet;
scoped_ptr<EdgeSet> edges_;
// Unique collection of the starting (first) vertex of all edges,
--- a/src/third_party/s2/s2regioncoverer.cc
+++ b/src/third_party/s2/s2regioncoverer.cc
@@ -321,7 +321,7 @@ void S2RegionCoverer::GetInteriorCellUnion(S2Region const& region,
void S2RegionCoverer::FloodFill(
S2Region const& region, S2CellId const& start, vector<S2CellId>* output) {
- hash_set<S2CellId> all;
+ my_hash_set<S2CellId> all;
vector<S2CellId> frontier;
output->clear();
all.insert(start);
--- a/src/third_party/s2/s2regioncoverer_test.cc
+++ b/src/third_party/s2/s2regioncoverer_test.cc
@@ -11,7 +11,7 @@ using std::swap;
using std::reverse;
#include <hash_map>
-using __gnu_cxx::hash_map;
+using __gnu_cxx::hash_map = my_hash_map;
#include <queue>
using std::priority_queue;
@@ -65,7 +65,7 @@ static void CheckCovering(S2RegionCoverer const& coverer,
vector<S2CellId> const& covering,
bool interior) {
// Keep track of how many cells have the same coverer.min_level() ancestor.
- hash_map<S2CellId, int> min_level_cells;
+ my_hash_map<S2CellId, int> min_level_cells;
for (int i = 0; i < covering.size(); ++i) {
int level = covering[i].level();
EXPECT_GE(level, coverer.min_level());
@@ -76,7 +76,7 @@ static void CheckCovering(S2RegionCoverer const& coverer,
if (covering.size() > coverer.max_cells()) {
// If the covering has more than the requested number of cells, then check
// that the cell count cannot be reduced by using the parent of some cell.
- for (hash_map<S2CellId, int>::const_iterator i = min_level_cells.begin();
+ for (my_hash_map<S2CellId, int>::const_iterator i = min_level_cells.begin();
i != min_level_cells.end(); ++i) {
EXPECT_EQ(i->second, 1);
}
--- a/src/third_party/s2/strings/split.cc
+++ b/src/third_party/s2/strings/split.cc
@@ -156,7 +156,7 @@ struct simple_insert_iterator {
// SplitStringToIterator{Using|AllowEmpty}().
template <typename T>
struct simple_hash_map_iterator {
- typedef hash_map<T, T> hashmap;
+ typedef my_hash_map<T, T> hashmap;
hashmap* t;
bool even;
typename hashmap::iterator curr;
@@ -246,8 +246,8 @@ void SplitStringAllowEmpty(const string& full, const char* delim,
}
void SplitStringToHashsetAllowEmpty(const string& full, const char* delim,
- hash_set<string>* result) {
- simple_insert_iterator<hash_set<string> > it(result);
+ my_hash_set<string>* result) {
+ simple_insert_iterator<my_hash_set<string> > it(result);
SplitStringToIteratorAllowEmpty(full, delim, 0, it);
}
@@ -258,7 +258,7 @@ void SplitStringToSetAllowEmpty(const string& full, const char* delim,
}
void SplitStringToHashmapAllowEmpty(const string& full, const char* delim,
- hash_map<string, string>* result) {
+ my_hash_map<string, string>* result) {
simple_hash_map_iterator<string> it(result);
SplitStringToIteratorAllowEmpty(full, delim, 0, it);
}
@@ -352,8 +352,8 @@ void SplitStringUsing(const string& full,
}
void SplitStringToHashsetUsing(const string& full, const char* delim,
- hash_set<string>* result) {
- simple_insert_iterator<hash_set<string> > it(result);
+ my_hash_set<string>* result) {
+ simple_insert_iterator<my_hash_set<string> > it(result);
SplitStringToIteratorUsing(full, delim, it);
}
@@ -364,7 +364,7 @@ void SplitStringToSetUsing(const string& full, const char* delim,
}
void SplitStringToHashmapUsing(const string& full, const char* delim,
- hash_map<string, string>* result) {
+ my_hash_map<string, string>* result) {
simple_hash_map_iterator<string> it(result);
SplitStringToIteratorUsing(full, delim, it);
}
--- a/src/third_party/s2/strings/split.h
+++ b/src/third_party/s2/strings/split.h
@@ -41,7 +41,7 @@ using namespace std;
void SplitStringAllowEmpty(const string& full, const char* delim,
vector<string>* res);
void SplitStringToHashsetAllowEmpty(const string& full, const char* delim,
- hash_set<string>* res);
+ my_hash_set<string>* res);
void SplitStringToSetAllowEmpty(const string& full, const char* delim,
set<string>* res);
// The even-positioned (0-based) components become the keys for the
@@ -50,7 +50,7 @@ void SplitStringToSetAllowEmpty(const string& full, const char* delim,
// if the key was already present in the hash table, or will be the
// empty string if the key is a newly inserted key.
void SplitStringToHashmapAllowEmpty(const string& full, const char* delim,
- hash_map<string, string>* result);
+ my_hash_map<string, string>* result);
// ----------------------------------------------------------------------
// SplitStringUsing()
@@ -66,7 +66,7 @@ void SplitStringToHashmapAllowEmpty(const string& full, const char* delim,
void SplitStringUsing(const string& full, const char* delim,
vector<string>* res);
void SplitStringToHashsetUsing(const string& full, const char* delim,
- hash_set<string>* res);
+ my_hash_set<string>* res);
void SplitStringToSetUsing(const string& full, const char* delim,
set<string>* res);
// The even-positioned (0-based) components become the keys for the
@@ -75,7 +75,7 @@ void SplitStringToSetUsing(const string& full, const char* delim,
// if the key was already present in the hash table, or will be the
// empty string if the key is a newly inserted key.
void SplitStringToHashmapUsing(const string& full, const char* delim,
- hash_map<string, string>* result);
+ my_hash_map<string, string>* result);
// ----------------------------------------------------------------------
// SplitOneIntToken()

View File

@ -0,0 +1,29 @@
Don't automagically force lld > gold > bfd. Leave it up to the user.
In particular, avoids issues with LTO enabled (via the flag/scons option)
where using GCC as compiler, as lld can't do LTO with GCC.
https://bugs.gentoo.org/769986
--- a/SConstruct
+++ b/SConstruct
@@ -3109,20 +3109,6 @@ def doConfigure(myenv):
myenv.Append( CCFLAGS=["/Zc:inline"])
if myenv.ToolchainIs('gcc', 'clang'):
- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
- # because it is much faster. Don't use it if the user has already configured another linker
- # selection manually.
- if not any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']):
-
- # lld has problems with separate debug info on some platforms. See:
- # - https://bugzilla.mozilla.org/show_bug.cgi?id=1485556
- # - https://bugzilla.mozilla.org/show_bug.cgi?id=1485556
- if get_option('separate-debug') == 'off':
- if not AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=lld'):
- AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
- else:
- AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
-
# Usually, --gdb-index is too expensive in big static binaries, but for dynamic
# builds it works well.
if link_model.startswith("dynamic"):

View File

@ -0,0 +1,25 @@
https://cgit.openembedded.org/meta-openembedded-contrib/commit/?id=856c21b061e000640829e158b9bb9e978a974386
From 5d8218b8a1b5bc71e2a0cf543a000e194daba599 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 29 Jan 2023 17:15:30 -0800
Subject: [PATCH] free_mon: Include missing <cstdint>
gcc 13 moved some includes around and as a result <cstdint> is no
longer transitively included [1]. Explicitly include it
for uintXX_t.
[1] https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/src/mongo/db/free_mon/free_mon_options.h
+++ b/src/mongo/db/free_mon/free_mon_options.h
@@ -29,6 +29,7 @@
#pragma once
+#include <cstdint>
#include <string>
#include <vector>

View File

@ -0,0 +1,43 @@
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 62fbfc02..5be336f7 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -841,30 +841,6 @@ for full_dir, archive_dir in list(env["ARCHIVE_ADDITION_DIR_MAP"].items()):
for target in env["DIST_BINARIES"]:
installBinary(env, "db/modules/" + target)
-compass_script = "install_compass"
-if env.TargetOSIs('windows'):
- compass_script = "Install-Compass.ps1"
-
-compass_installer = f"$BUILD_DIR/mongo/installer/compass/{compass_script}"
-
-distBinaries.append(compass_installer)
-
-if not hygienic:
- compass_script_installer = env.Install("$DESTDIR/bin", compass_installer)
-else:
- compass_script_installer = env.AutoInstall(
- target='$PREFIX_BINDIR',
- source=[
- compass_installer,
- ],
- AIB_COMPONENT='dist',
- AIB_ROLE='runtime',
- )
-
-if env.TargetOSIs('posix'):
- env.AddPostAction( compass_script_installer, 'chmod 755 $TARGET' )
- env.AddPostAction( compass_installer, 'chmod 755 $TARGET' )
-
if not hygienic:
server_archive = env.Command(
target='#/${SERVER_ARCHIVE}',
@@ -878,7 +854,6 @@ if not hygienic:
'--transform $BUILD_DIR/mongo/stripped/db/modules/enterprise=$SERVER_DIST_BASENAME/bin',
'--transform $BUILD_DIR/mongo/stripped=$SERVER_DIST_BASENAME/bin',
'--transform $BUILD_DIR/mongo=$SERVER_DIST_BASENAME/bin',
- '--transform src/mongo/installer/compass=$SERVER_DIST_BASENAME/bin',
'${TEMPFILE(SOURCES[1:])}'
],
),

View File

@ -0,0 +1,71 @@
https://bugs.gentoo.org/844235
--- a/src/mongo/db/auth/security_key_test.cpp
+++ b/src/mongo/db/auth/security_key_test.cpp
@@ -30,6 +30,7 @@
#include "mongo/platform/basic.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include "mongo/base/string_data.h"
#include "mongo/db/auth/authorization_manager.h"
--- a/src/mongo/db/storage/storage_repair_observer.cpp
+++ b/src/mongo/db/storage/storage_repair_observer.cpp
@@ -41,6 +41,7 @@
#include <sys/types.h>
#endif
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/db/dbhelpers.h"
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine_test.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/storage/kv/kv_engine_test_harness.h"
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include <memory>
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_util.cpp
@@ -36,6 +36,7 @@
#include <limits>
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/path.hpp>
#include "mongo/base/simple_string_data_comparator.h"
--- a/src/mongo/shell/shell_utils_extended.cpp
+++ b/src/mongo/shell/shell_utils_extended.cpp
@@ -37,6 +37,7 @@
#endif
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <fmt/format.h>
#include <fstream>
--- a/src/mongo/util/stacktrace_threads.cpp
+++ b/src/mongo/util/stacktrace_threads.cpp
@@ -36,6 +36,7 @@
#include <array>
#include <atomic>
#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
#include <cstdint>
#include <cstdlib>
#include <dirent.h>
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -36,6 +36,7 @@
#include <iostream>
#include <malloc.h>
#include <pcrecpp.h>
+#include <fstream>
#include <sched.h>
#include <stdio.h>
#include <sys/mman.h>

View File

@ -0,0 +1,32 @@
diff --git a/SConstruct b/SConstruct
index 115de78a..613110b7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2366,7 +2366,6 @@ if env.TargetOSIs('posix'):
# -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used.
env.Append( CCFLAGS=["-fasynchronous-unwind-tables",
- "-ggdb" if not env.TargetOSIs('emscripten') else "-g",
"-Wall",
"-Wsign-compare",
"-Wno-unknown-pragmas",
@@ -2422,6 +2421,8 @@ if env.TargetOSIs('posix'):
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
env.Append( CXXFLAGS=["-Woverloaded-virtual"] )
+ env.Append( CXXFLAGS=os.environ['CXXFLAGS'] )
+ env.Append( LINKFLAGS=os.environ['LDFLAGS'] )
# On OS X, clang doesn't want the pthread flag at link time, or it
# issues warnings which make it impossible for us to declare link
@@ -2473,8 +2474,8 @@ if env.TargetOSIs('posix'):
],
)
- #make scons colorgcc friendly
- for key in ('HOME', 'TERM'):
+ #make scons colorgcc, distcc, ccache friendly
+ for key in ('HOME', 'PATH', 'TERM'):
try:
env['ENV'][key] = os.environ[key]
except KeyError:

View File

@ -0,0 +1,16 @@
diff --git a/src/mongo/stdx/thread.h b/src/mongo/stdx/thread.h
index 7b15bb56..4d8f73ad 100644
--- a/src/mongo/stdx/thread.h
+++ b/src/mongo/stdx/thread.h
@@ -105,10 +105,7 @@ private:
// . N Y : 4,344 | 13,048 | 7,352
// . Y Y : 4,424 | 13,672 | 8,392
// ( https://jira.mongodb.org/secure/attachment/233569/233569_stacktrace-writeup.txt )
- static constexpr std::size_t kMongoMinSignalStackSize = std::size_t{64} << 10;
-
- static constexpr std::size_t kStackSize =
- std::max(kMongoMinSignalStackSize, std::size_t{MINSIGSTKSZ});
+ static constexpr std::size_t kStackSize = std::size_t{64} << 10;
std::unique_ptr<std::byte[]> _stackStorage = std::make_unique<std::byte[]>(kStackSize);
#else // !MONGO_HAS_SIGALTSTACK

View File

@ -0,0 +1,12 @@
diff --git a/src/mongo/installer/SConscript b/src/mongo/installer/SConscript
index 5bd89fe9..489e70ac 100644
--- a/src/mongo/installer/SConscript
+++ b/src/mongo/installer/SConscript
@@ -7,7 +7,6 @@ env = env.Clone()
env.SConscript(
dirs=[
- 'compass',
'msi',
],
exports=[

View File

@ -0,0 +1,13 @@
diff --git a/SConstruct b/SConstruct
index 613110b7..4987e24e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2958,7 +2958,7 @@ def doConfigure(myenv):
# This warning was added in clang-5 and incorrectly flags our implementation of
# exceptionToStatus(). See https://bugs.llvm.org/show_bug.cgi?id=34804
- AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions")
+ #AddToCCFLAGSIfSupported(myenv, "-Wno-exceptions")
# Enable sized deallocation support.
AddToCXXFLAGSIfSupported(myenv, '-fsized-deallocation')

View File

@ -0,0 +1,24 @@
diff --git a/buildscripts/scons.py b/buildscripts/scons.py
index 534fca32..c38f64df 100755
--- a/buildscripts/scons.py
+++ b/buildscripts/scons.py
@@ -19,13 +19,13 @@ SITE_TOOLS_DIR = os.path.join(MONGODB_ROOT, 'site_scons')
sys.path = [SCONS_DIR, SITE_TOOLS_DIR] + sys.path
# pylint: disable=C0413
-from mongo.pip_requirements import verify_requirements, MissingRequirements
+#from mongo.pip_requirements import verify_requirements, MissingRequirements
-try:
- verify_requirements('etc/pip/compile-requirements.txt')
-except MissingRequirements as ex:
- print(ex)
- sys.exit(1)
+#try:
+# verify_requirements('etc/pip/compile-requirements.txt')
+#except MissingRequirements as ex:
+# print(ex)
+# sys.exit(1)
try:
import SCons.Script

View File

@ -0,0 +1,11 @@
https://bugs.gentoo.org/889020
--- a/src/mongo/util/boost_assert_shim.cpp
+++ b/src/mongo/util/boost_assert_shim.cpp
@@ -31,6 +31,7 @@
#if defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG)
+#include <exception>
#include <boost/assert.hpp>
namespace mongo {

View File

@ -0,0 +1,49 @@
Don't automagically force lld > gold > bfd. Leave it up to the user.
In particular, avoids issues with LTO enabled (via the flag/scons option)
where using GCC as compiler, as lld can't do LTO with GCC.
https://bugs.gentoo.org/769986
--- a/SConstruct
+++ b/SConstruct
@@ -2824,40 +2824,6 @@ def doConfigure(myenv):
def AddToSHLINKFLAGSIfSupported(env, flag):
return AddFlagIfSupported(env, 'C', '.c', flag, True, SHLINKFLAGS=[flag])
- if myenv.ToolchainIs('gcc', 'clang'):
- # This tells clang/gcc to use the gold linker if it is available - we prefer the gold linker
- # because it is much faster. Don't use it if the user has already configured another linker
- # selection manually.
- if any(flag.startswith('-fuse-ld=') for flag in env['LINKFLAGS']):
- myenv.FatalError(f"Use the '--linker' option instead of modifying the LINKFLAGS directly.")
-
- linker_ld = get_option('linker')
- if linker_ld == 'auto':
- # lld has problems with separate debug info on some platforms. See:
- # - https://bugzilla.mozilla.org/show_bug.cgi?id=1485556
- # - https://bugzilla.mozilla.org/show_bug.cgi?id=1485556
- #
- # lld also apparently has problems with symbol resolution
- # in some esoteric configurations that apply for us when
- # using --link-model=dynamic mode, so disable lld there
- # too. See:
- # - https://bugs.llvm.org/show_bug.cgi?id=46676
- #
- # We should revisit all of these issues the next time we upgrade our clang minimum.
- if get_option('separate-debug') == 'off' and get_option('link-model') != 'dynamic':
- if not AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=lld'):
- AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
- else:
- AddToLINKFLAGSIfSupported(myenv, '-fuse-ld=gold')
- elif link_model.startswith("dynamic") and linker_ld == 'bfd':
- # BFD is not supported due to issues with it causing warnings from some of
- # the third party libraries that mongodb is linked with:
- # https://jira.mongodb.org/browse/SERVER-49465
- myenv.FatalError(f"Linker {linker_ld} is not supported with dynamic link model builds.")
- else:
- if not AddToLINKFLAGSIfSupported(myenv, f'-fuse-ld={linker_ld}'):
- myenv.FatalError(f"Linker {linker_ld} could not be configured.")
-
detectCompiler = Configure(myenv, help=False, custom_tests = {
'CheckForCXXLink': CheckForCXXLink,
})

View File

@ -0,0 +1,34 @@
# !! IMPORTANT !!
#
# This file uses the YAML format as described in the documentation:
# http://docs.mongodb.org/manual/reference/configuration-options/
storage:
dbPath: "/var/lib/mongodb"
#engine: wiredTiger
systemLog:
destination: file
path: "/var/log/mongodb/mongodb.log"
quiet: true
logAppend: true
net:
port: 27017
bindIp: 127.0.0.1
#ssl:
# mode: disabled
#security:
#keyFile:
#clusterAuthMode:
#replication:
#replSetName:
# Specifies one of the MongoDB parameters described here:
# http://docs.mongodb.org/manual/reference/parameters/
#
# You can specify multiple setParameter fields such as:
# setParameter: {enableTestCommands: 1}
#setParameter:

View File

@ -0,0 +1,11 @@
# !! IMPORTANT !!
#
# This file is ONLY used to override some of the init script configuration.
#
# You should NOT use this file to configure your mongodb instance,
# see the /etc/mongodb.conf file instead.
#
# Available init script modifiers :
# - config_file : the configuration file to use (default : /etc/mongodb.conf)
# - user : the user used to run your mongodb instance (default : mongodb)
# - group : the group used to run your mongodb instance (default : mongodb)

View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
: ${config_file:="/etc/${RC_SVCNAME}.conf"}
: ${user:=mongodb}
: ${group:=mongodb}
command="/usr/bin/mongod"
command_args="--config ${config_file}"
command_background="true"
pidfile="/run/${RC_SVCNAME}.pid"
command_user="${user}:${group}"
required_files="${config_file}"
retry="SIGTERM/30"
depend() {
use net
}

View File

@ -0,0 +1,13 @@
# Default log rotation / compression keeps 1 year of logs.
/var/log/mongodb/*.log {
daily
rotate 365
dateext
copytruncate
delaycompress
compress
notifempty
extension gz
sharedscripts
missingok
}

View File

@ -0,0 +1,10 @@
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,30 @@
# !! IMPORTANT !!
#
# This file uses the YAML format as described in the documentation:
# http://docs.mongodb.org/manual/reference/configuration-options/
systemLog:
destination: file
path: "/var/log/mongodb/mongos.log"
quiet: true
logAppend: true
net:
port: 27017
bindIp: 127.0.0.1
ssl:
mode: disabled
#security:
#keyFile:
#clusterAuthMode:
#sharding:
#configDB:
# Specifies one of the MongoDB parameters described here:
# http://docs.mongodb.org/manual/reference/parameters/
#
# You can specify multiple setParameter fields such as:
# setParameter: {enableTestCommands: 1}
#setParameter:

View File

@ -0,0 +1,11 @@
# !! IMPORTANT !!
#
# This file is ONLY used to override some of the init script configuration.
#
# You should NOT use this file to configure your mongos instance,
# see the /etc/mongos.conf file instead.
#
# Available init script modifiers :
# - config_file : the configuration file to use (default : /etc/mongos.conf)
# - user : the user used to run your mongodb instance (default : mongodb)
# - group : the group used to run your mongodb instance (default : mongodb)

View File

@ -0,0 +1,18 @@
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
: ${config_file:="/etc/${RC_SVCNAME}.conf"}
: ${user:=mongodb}
: ${group:=mongodb}
command="/usr/bin/mongos"
command_args="--config ${config_file}"
command_background="true"
pidfile="/run/${RC_SVCNAME}.pid"
command_user="${user}:${group}"
required_files="${config_file}"
depend() {
use net
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>ultrabug@gentoo.org</email>
<name>Alexys Jacob</name>
</maintainer>
<longdescription lang="en">
MongoDB (from "humongous") is a scalable, high-performance, open source,
schema-free, document-oriented database. Written in C++, MongoDB features:
MongoDB bridges the gap between key-value stores (which are fast and highly
scalable) and traditional RDBMS systems (which provide structured schemas
and powerful queries).
</longdescription>
<use>
<flag name="lto">Adds support for link time optimization</flag>
<flag name="mongosh">Install the MongoDB shell from <pkg>app-admin/mongosh-bin</pkg></flag>
<flag name="tools">Install the MongoDB tools (mongoimport, mongodump...) from <pkg>app-admin/mongo-tools</pkg></flag>
</use>
</pkgmetadata>

View File

@ -0,0 +1,184 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9..11} )
SCONS_MIN_VERSION="3.3.1"
CHECKREQS_DISK_BUILD="2400M"
CHECKREQS_DISK_USR="512M"
CHECKREQS_MEMORY="1024M"
inherit check-reqs flag-o-matic multiprocessing pax-utils python-any-r1 scons-utils systemd toolchain-funcs
MY_P=${PN}-src-r${PV/_rc/-rc}
DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
HOMEPAGE="https://www.mongodb.com"
SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz"
LICENSE="Apache-2.0 SSPL-1"
SLOT="0"
KEYWORDS="~amd64 ~arm64 -riscv"
IUSE="debug kerberos lto ssl test +tools"
RESTRICT="!test? ( test )"
RDEPEND="acct-group/mongodb
acct-user/mongodb
>=app-arch/snappy-1.1.3:=
>=dev-cpp/yaml-cpp-0.6.2:=
dev-libs/boost:=[nls]
>=dev-libs/libpcre-8.42[cxx]
app-arch/zstd:=
dev-libs/snowball-stemmer:=
net-misc/curl
>=sys-libs/zlib-1.2.11:=
kerberos? ( dev-libs/cyrus-sasl[kerberos] )
ssl? (
>=dev-libs/openssl-1.0.1g:0=
)"
DEPEND="${RDEPEND}
${PYTHON_DEPS}
sys-libs/ncurses:0=
sys-libs/readline:0=
debug? ( dev-util/valgrind )"
BDEPEND="
$(python_gen_any_dep '
test? ( dev-python/pymongo[${PYTHON_USEDEP}] dev-python/requests[${PYTHON_USEDEP}] )
>=dev-util/scons-3.1.1[${PYTHON_USEDEP}]
dev-python/cheetah3[${PYTHON_USEDEP}]
dev-python/psutil[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
')
"
PDEPEND="tools? ( >=app-admin/mongo-tools-100 )"
PATCHES=(
"${FILESDIR}/${PN}-4.4.1-fix-scons.patch"
"${FILESDIR}/${PN}-4.4.8-no-compass.patch"
"${FILESDIR}/${PN}-4.4.1-boost.patch"
"${FILESDIR}/${PN}-4.4.1-gcc11.patch"
"${FILESDIR}/${PN}-4.4.8-gcc-13.patch"
"${FILESDIR}/${PN}-4.4.10-boost-1.79.patch"
"${FILESDIR}/${PN}-4.4.10-no-force-lld.patch"
"${FILESDIR}/${PN}-4.4.10-boost-1.81.patch"
)
S="${WORKDIR}/${MY_P}"
python_check_deps() {
if use test; then
python_has_version "dev-python/pymongo[${PYTHON_USEDEP}]" || return 1
python_has_version "dev-python/requests[${PYTHON_USEDEP}]" || return 1
fi
python_has_version ">=dev-util/scons-3.1.1[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/cheetah3[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/psutil[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
}
pkg_pretend() {
if [[ -n ${REPLACING_VERSIONS} ]]; then
if ver_test "$REPLACING_VERSIONS" -lt 4.2; then
ewarn "To upgrade from a version earlier than the 4.2-series, you must"
ewarn "successively upgrade major releases until you have upgraded"
ewarn "to 4.2-series. Then upgrade to 4.4 series."
else
ewarn "Be sure to set featureCompatibilityVersion to 4.2 before upgrading."
fi
fi
}
src_prepare() {
default
# remove bundled libs
rm -r src/third_party/{boost-*,pcre-*,scons-*,snappy-*,yaml-cpp-*,zlib-*} || die
# remove compass
rm -r src/mongo/installer/compass || die
}
src_configure() {
# https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
# --use-system-icu fails tests
# --use-system-tcmalloc is strongly NOT recommended:
scons_opts=(
AR="$(tc-getAR)"
CC="$(tc-getCC)"
CXX="$(tc-getCXX)"
--disable-warnings-as-errors
--use-system-boost
--use-system-pcre
--use-system-snappy
--use-system-stemmer
--use-system-yaml
--use-system-zlib
--use-system-zstd
)
use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300
use debug && scons_opts+=( --dbg=on )
use kerberos && scons_opts+=( --use-sasl-client )
use lto && scons_opts+=( --lto=on )
use ssl && scons_opts+=( --ssl )
# Needed to avoid forcing FORTIFY_SOURCE
# Gentoo's toolchain applies these anyway
scons_opts+=( --runtime-hardening=off )
# respect mongoDB upstream's basic recommendations
# see bug #536688 and #526114
if ! use debug; then
filter-flags '-m*'
filter-flags '-O?'
fi
default
}
src_compile() {
PREFIX="${EPREFIX}/usr" escons "${scons_opts[@]}" --nostrip install-core
}
# FEATURES="test -usersandbox" emerge dev-db/mongodb
src_test() {
ewarn "Tests may hang with FEATURES=usersandbox"
"${EPYTHON}" ./buildscripts/resmoke.py run --dbpathPrefix=test --suites core --jobs=$(makeopts_jobs) || die "Tests failed with ${EPYTHON}"
}
src_install() {
dobin build/install/bin/{mongo,mongod,mongos}
doman debian/mongo*.1
dodoc README docs/building.md
newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
newinitd "${FILESDIR}/mongos.initd-r3" mongos
newconfd "${FILESDIR}/mongos.confd-r3" mongos
insinto /etc
newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
newins "${FILESDIR}/mongos.conf-r2" mongos.conf
systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
insinto /etc/logrotate.d/
newins "${FILESDIR}/${PN}.logrotate" ${PN}
# see bug #526114
pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
diropts -m0750 -o mongodb -g mongodb
keepdir /var/log/${PN}
}
pkg_postinst() {
ewarn "Make sure to read the release notes and follow the upgrade process:"
ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/"
ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures"
}

View File

@ -0,0 +1,197 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9..11} )
SCONS_MIN_VERSION="3.3.1"
CHECKREQS_DISK_BUILD="2400M"
CHECKREQS_DISK_USR="512M"
CHECKREQS_MEMORY="1024M"
inherit check-reqs flag-o-matic multiprocessing pax-utils python-any-r1 scons-utils systemd toolchain-funcs
MY_P=${PN}-src-r${PV/_rc/-rc}
DESCRIPTION="A high-performance, open source, schema-free document-oriented database"
HOMEPAGE="https://www.mongodb.com"
SRC_URI="https://fastdl.mongodb.org/src/${MY_P}.tar.gz"
LICENSE="Apache-2.0 SSPL-1"
SLOT="0"
KEYWORDS="~amd64 ~arm64 -riscv"
CPU_FLAGS="cpu_flags_x86_avx"
IUSE="debug kerberos lto mongosh ssl +tools ${CPU_FLAGS}"
# https://github.com/mongodb/mongo/wiki/Test-The-Mongodb-Server
# resmoke needs python packages not yet present in Gentoo
RESTRICT="test"
RDEPEND="acct-group/mongodb
acct-user/mongodb
>=app-arch/snappy-1.1.7:=
>=dev-cpp/yaml-cpp-0.6.2:=
dev-libs/boost:=[nls]
>=dev-libs/libpcre-8.42[cxx]
app-arch/zstd:=
dev-libs/snowball-stemmer:=
>=sys-libs/zlib-1.2.12:=
kerberos? ( dev-libs/cyrus-sasl[kerberos] )
ssl? (
>=dev-libs/openssl-1.0.1g:0=
)"
DEPEND="${RDEPEND}
${PYTHON_DEPS}
sys-libs/ncurses:0=
sys-libs/readline:0=
debug? ( dev-util/valgrind )"
BDEPEND="
$(python_gen_any_dep '
>=dev-util/scons-3.1.1[${PYTHON_USEDEP}]
dev-python/cheetah3[${PYTHON_USEDEP}]
dev-python/psutil[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
')
"
PDEPEND="
mongosh? ( app-admin/mongosh-bin )
tools? ( >=app-admin/mongo-tools-100 )
"
PATCHES=(
"${FILESDIR}/${PN}-4.4.1-boost.patch"
"${FILESDIR}/${PN}-4.4.1-gcc11.patch"
"${FILESDIR}/${PN}-5.0.2-fix-scons.patch"
"${FILESDIR}/${PN}-5.0.2-no-compass.patch"
"${FILESDIR}/${PN}-5.0.2-skip-no-exceptions.patch"
"${FILESDIR}/${PN}-5.0.2-skip-reqs-check.patch"
"${FILESDIR}/${PN}-5.0.2-boost-1.79.patch"
"${FILESDIR}/${PN}-5.0.5-no-force-lld.patch"
"${FILESDIR}/${PN}-4.4.10-boost-1.81.patch"
"${FILESDIR}/${PN}-5.0.5-boost-1.81-extra.patch"
"${FILESDIR}/${PN}-4.4.8-gcc-13.patch"
)
S="${WORKDIR}/${MY_P}"
python_check_deps() {
python_has_version ">=dev-util/scons-3.1.1[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/cheetah3[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/psutil[${PYTHON_USEDEP}]" &&
python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
}
pkg_pretend() {
# Bug 809692
if use amd64 && ! use cpu_flags_x86_avx; then
eerror "MongoDB 5.0 requires use of the AVX instruction set"
eerror "https://docs.mongodb.com/v5.0/administration/production-notes/"
die "MongoDB requires AVX"
fi
if [[ -n ${REPLACING_VERSIONS} ]]; then
if ver_test "$REPLACING_VERSIONS" -lt 4.4; then
ewarn "To upgrade from a version earlier than the 4.4-series, you must"
ewarn "successively upgrade major releases until you have upgraded"
ewarn "to 4.4-series. Then upgrade to 5.0 series."
else
ewarn "Be sure to set featureCompatibilityVersion to 4.4 before upgrading."
fi
fi
}
src_prepare() {
default
# remove bundled libs
rm -r src/third_party/{boost,pcre-*,snappy-*,yaml-cpp,zlib-*} || die
# remove compass
rm -r src/mongo/installer/compass || die
}
src_configure() {
# https://github.com/mongodb/mongo/wiki/Build-Mongodb-From-Source
# --use-system-icu fails tests
# --use-system-tcmalloc is strongly NOT recommended:
scons_opts=(
AR="$(tc-getAR)"
CC="$(tc-getCC)"
CXX="$(tc-getCXX)"
--disable-warnings-as-errors
--jobs="$(makeopts_jobs)"
--use-system-boost
--use-system-pcre
--use-system-snappy
--use-system-stemmer
--use-system-yaml
--use-system-zlib
--use-system-zstd
)
use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300
use debug && scons_opts+=( --dbg=on )
use kerberos && scons_opts+=( --use-sasl-client )
use lto && scons_opts+=( --lto=on )
scons_opts+=( --ssl=$(usex ssl on off) )
# Needed to avoid forcing FORTIFY_SOURCE
# Gentoo's toolchain applies these anyway
scons_opts+=( --runtime-hardening=off )
# gold is an option here but we don't really do that anymore
if tc-ld-is-lld; then
scons_opts+=( --linker=lld )
else
scons_opts+=( --linker=bfd )
fi
# respect mongoDB upstream's basic recommendations
# see bug #536688 and #526114
if ! use debug; then
filter-flags '-m*'
filter-flags '-O?'
fi
default
}
src_compile() {
PREFIX="${EPREFIX}/usr" ./buildscripts/scons.py "${scons_opts[@]}" install-core || die
}
src_install() {
dobin build/install/bin/{mongo,mongod,mongos}
doman debian/mongo*.1
dodoc README docs/building.md
newinitd "${FILESDIR}/${PN}.initd-r3" ${PN}
newconfd "${FILESDIR}/${PN}.confd-r3" ${PN}
newinitd "${FILESDIR}/mongos.initd-r3" mongos
newconfd "${FILESDIR}/mongos.confd-r3" mongos
insinto /etc
newins "${FILESDIR}/${PN}.conf-r3" ${PN}.conf
newins "${FILESDIR}/mongos.conf-r2" mongos.conf
systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
insinto /etc/logrotate.d/
newins "${FILESDIR}/${PN}.logrotate" ${PN}
# see bug #526114
pax-mark emr "${ED}"/usr/bin/{mongo,mongod,mongos}
diropts -m0750 -o mongodb -g mongodb
keepdir /var/log/${PN}
}
pkg_postinst() {
ewarn "Make sure to read the release notes and follow the upgrade process:"
ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/"
ewarn " https://docs.mongodb.com/manual/release-notes/$(ver_cut 1-2)/#upgrade-procedures"
}