summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct67
-rw-r--r--etc/evergreen.yml48
-rw-r--r--site_scons/mongo_scons_utils.py63
-rw-r--r--src/mongo/SConscript67
-rw-r--r--src/mongo/db/log_process_details.cpp4
-rw-r--r--src/mongo/db/mongod_options.cpp4
-rw-r--r--src/mongo/dbtests/framework.cpp3
-rw-r--r--src/mongo/util/version.cpp.in219
-rw-r--r--src/mongo/util/version.h5
9 files changed, 256 insertions, 224 deletions
diff --git a/SConstruct b/SConstruct
index 29c3ab474ea..5d541375052 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,18 +1,4 @@
# -*- mode: python; -*-
-# build file for MongoDB
-# this requires scons
-# you can get from http://www.scons.org
-# then just type scons
-
-# some common tasks
-# build 64-bit mac and pushing to s3
-# scons --64 s3dist
-# scons --distname=0.8 s3dist
-# all s3 pushes require settings.py and simples3
-
-# This file, SConstruct, configures the build environment, and then delegates to
-# several, subordinate SConscript files, which describe specific build rules.
-
import copy
import datetime
import errno
@@ -28,7 +14,11 @@ import uuid
from buildscripts import utils
from buildscripts import moduleconfig
-from mongo_scons_utils import default_variant_dir_generator
+from mongo_scons_utils import (
+ default_buildinfo_environment_data,
+ default_variant_dir_generator,
+ get_toolchain_ver,
+)
import libdeps
@@ -149,18 +139,6 @@ add_option('prefix',
help='installation prefix',
)
-add_option('distname',
- help='dist name (0.8.0)',
-)
-
-add_option('distmod',
- help='additional piece for full dist name',
-)
-
-add_option('distarch',
- help='override the architecture name in dist output',
-)
-
add_option('nostrip',
help='do not strip installed binaries',
nargs=0,
@@ -633,11 +611,29 @@ env_vars.Add('LINKFLAGS',
help='Sets flags for the linker',
converter=variable_shlex_converter)
+# Note: This is only really meaningful when configured via a variables file. See the
+# default_buildinfo_environment_data() function for examples of how to use this.
+env_vars.Add('MONGO_BUILDINFO_ENVIRONMENT_DATA',
+ help='Sets the info returned from the buildInfo command and --version command-line flag',
+ default=default_buildinfo_environment_data())
+
env_vars.Add('MONGO_DIST_SRC_PREFIX',
help='Sets the prefix for files in the source distribution archive',
converter=variable_distsrc_converter,
default="mongodb-src-r${MONGO_VERSION}")
+env_vars.Add('MONGO_DISTARCH',
+ help='Adds a string representing the target processor architecture to the dist archive',
+ default='$TARGET_ARCH')
+
+env_vars.Add('MONGO_DISTMOD',
+ help='Adds a string that will be embedded in the dist archive naming',
+ default=None)
+
+env_vars.Add('MONGO_DISTNAME',
+ help='Sets the version string to be used in dist archive naming',
+ default='$MONGO_VERSION')
+
env_vars.Add('MONGO_VERSION',
help='Sets the version string for MongoDB',
default=version_data['version'])
@@ -998,6 +994,9 @@ elif not detectConf.CheckForOS(env['TARGET_OS']):
detectConf.Finish()
+env['CC_VERSION'] = get_toolchain_ver(env, 'CC')
+env['CXX_VERSION'] = get_toolchain_ver(env, 'CXX')
+
if not env['HOST_ARCH']:
env['HOST_ARCH'] = env['TARGET_ARCH']
@@ -2420,8 +2419,7 @@ env.AlwaysBuild( "lint" )
# ---- INSTALL -------
def getSystemInstallName():
- dist_arch = GetOption("distarch")
- arch_name = env['TARGET_ARCH'] if not dist_arch else dist_arch
+ arch_name = env.subst('$MONGO_DISTARCH')
# We need to make sure the directory names inside dist tarballs are permanently
# consistent, even if the target OS name used in scons is different. Any differences
@@ -2437,8 +2435,8 @@ def getSystemInstallName():
if len(mongo_modules):
n += "-" + "-".join(m.name for m in mongo_modules)
- dn = GetOption("distmod")
- if dn and len(dn) > 0:
+ dn = env.subst('$MONGO_DISTMOD')
+ if len(dn) > 0:
n = n + "-" + dn
return n
@@ -2464,12 +2462,7 @@ def add_version_to_distsrc(env, archive):
env.AddDistSrcCallback(add_version_to_distsrc)
-if has_option('distname'):
- distName = GetOption( "distname" )
-else:
- distName = env['MONGO_VERSION']
-
-env['SERVER_DIST_BASENAME'] = 'mongodb-%s-%s' % (getSystemInstallName(), distName)
+env['SERVER_DIST_BASENAME'] = env.subst('mongodb-%s-$MONGO_DISTNAME' % (getSystemInstallName()))
module_sconscripts = moduleconfig.get_module_sconscripts(mongo_modules)
diff --git a/etc/evergreen.yml b/etc/evergreen.yml
index 5a2e47ec927..3977db3a812 100644
--- a/etc/evergreen.yml
+++ b/etc/evergreen.yml
@@ -1960,7 +1960,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-ubuntu1204
- compile_flags: --ssl --distmod=ubuntu1204 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=ubuntu1204 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2059,7 +2059,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-ubuntu1404
- compile_flags: --ssl --distmod=ubuntu1404 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=ubuntu1404 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2158,7 +2158,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-amzn64
- compile_flags: --ssl --distmod=amzn64 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=amzn64 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2221,7 +2221,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-amazon
- compile_flags: --ssl --distmod=amazon -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=amazon -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2318,7 +2318,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: i686
- compile_flags: --release --distarch=i686 -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ --wiredtiger=off CCFLAGS="-m32" LINKFLAGS="-m32"
+ compile_flags: --release MONGO_DISTARCH=i686 -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ --wiredtiger=off CCFLAGS="-m32" LINKFLAGS="-m32"
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure --storageEngine=mmapv1 -j1 # Avoid starting too many mongod's on 32-bit systems.
@@ -2469,7 +2469,7 @@ buildvariants:
push_arch: x86_64-2008plus
msi_target: msi
content_type: application/zip
- compile_flags: --release --win-version-min=ws08r2 -j$(grep -c ^processor /proc/cpuinfo) --distmod=2008plus VARIANT_DIR=win32
+ compile_flags: --release --win-version-min=ws08r2 -j$(grep -c ^processor /proc/cpuinfo) MONGO_DISTMOD=2008plus VARIANT_DIR=win32
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2558,7 +2558,7 @@ buildvariants:
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
- compile_flags: --dbg=on --opt=on --win-version-min=ws08r2 -j$(grep -c ^processor /proc/cpuinfo) --distmod=2008plus
+ compile_flags: --dbg=on --opt=on --win-version-min=ws08r2 -j$(grep -c ^processor /proc/cpuinfo) MONGO_DISTMOD=2008plus
ext: zip
tasks:
- name: compile
@@ -2626,7 +2626,7 @@ buildvariants:
push_arch: x86_64-enterprise-windows-64
msi_target: msi
content_type: application/zip
- compile_flags: --release --ssl --distmod=windows-64 CPPPATH="c:/openssl/include c:/sasl/include c:/snmp/include" LIBPATH="c:/openssl/lib c:/sasl/lib c:/snmp/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
+ compile_flags: --release --ssl MONGO_DISTMOD=windows-64 CPPPATH="c:/openssl/include c:/sasl/include c:/snmp/include" LIBPATH="c:/openssl/lib c:/sasl/lib c:/snmp/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -2672,7 +2672,7 @@ buildvariants:
push_arch: x86_64-2008plus-ssl
msi_target: msi
content_type: application/zip
- compile_flags: --release --ssl --distmod=2008plus-ssl CPPPATH="c:/openssl/include" LIBPATH="c:/openssl/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
+ compile_flags: --release --ssl MONGO_DISTMOD=2008plus-ssl CPPPATH="c:/openssl/include" LIBPATH="c:/openssl/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3035,7 +3035,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-rhel57
- compile_flags: --ssl --distmod=rhel57 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=rhel57 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3080,7 +3080,7 @@ buildvariants:
push_name: linux
push_arch: x86_64-enterprise-rhel62
rlp_environment: MONGOD_UNITTEST_RLP_LANGUAGE_TEST_BTROOT=/opt/basis
- compile_flags: --ssl --distmod=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" --use-basis-tech-rosette-linguistics-platform=on
+ compile_flags: --ssl MONGO_DISTMOD=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ CPPPATH="/opt/basis/rlp/rlp/include /opt/basis/rlp/utilities/include" --use-basis-tech-rosette-linguistics-platform=on
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3126,7 +3126,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-rhel70
- compile_flags: --ssl --distmod=rhel70 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=rhel70 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3168,7 +3168,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-rhel55
- compile_flags: --ssl --distmod=rhel55 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=rhel55 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3268,7 +3268,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-rhel62
- compile_flags: --ssl --distmod=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3368,7 +3368,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-rhel70
- compile_flags: --ssl --distmod=rhel70 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=rhel70 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3473,7 +3473,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-ubuntu1204
- compile_flags: --ssl --distmod=ubuntu1204 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=ubuntu1204 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3517,7 +3517,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-ubuntu1404
- compile_flags: --ssl --distmod=ubuntu1404 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=ubuntu1404 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3565,7 +3565,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-suse11
- compile_flags: --ssl --distmod=suse11 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=suse11 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3608,7 +3608,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-suse11
- compile_flags: --ssl --distmod=suse11 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=suse11 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3786,7 +3786,7 @@ buildvariants:
push_bucket: downloads.10gen.com
push_name: linux
push_arch: x86_64-enterprise-debian71
- compile_flags: --ssl --distmod=debian71 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=debian71 --release -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -3829,7 +3829,7 @@ buildvariants:
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: x86_64-debian71
- compile_flags: --ssl --distmod=debian71 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=debian71 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -4094,7 +4094,7 @@ buildvariants:
batchtime: 1440 # 1 day
expansions:
tooltags: "-tags 'ssl'"
- compile_flags: CC=/usr/bin/clang CXX=/usr/bin/clang++ --libc++ --ssl -j$(grep -c ^processor /proc/cpuinfo) VARIANT_DIR=build --distmod=ubuntu1410-clang
+ compile_flags: CC=/usr/bin/clang CXX=/usr/bin/clang++ --libc++ --ssl -j$(grep -c ^processor /proc/cpuinfo) VARIANT_DIR=build MONGO_DISTMOD=ubuntu1410-clang
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: --continueOnFailure
@@ -4191,7 +4191,7 @@ buildvariants:
batchtime: 1440 # 1 day
expansions:
tooltags: "-tags ssl"
- compile_flags: --ssl --distmod=ubuntu1404 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
+ compile_flags: --ssl MONGO_DISTMOD=ubuntu1404 -j$(grep -c ^processor /proc/cpuinfo) --release CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: "--continueOnFailure --mongosSetParameters='{outboundNetworkImpl: 'ASIO'}' --mongodSetParameters='{outboundNetworkImpl: 'ASIO'}'"
@@ -4237,7 +4237,7 @@ buildvariants:
tooltags: "-tags ssl"
msi_target: msi
content_type: application/zip
- compile_flags: --release --ssl --distmod=2008plus-ssl CPPPATH="c:/openssl/include" LIBPATH="c:/openssl/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
+ compile_flags: --release --ssl MONGO_DISTMOD=2008plus-ssl CPPPATH="c:/openssl/include" LIBPATH="c:/openssl/lib" -j$(grep -c ^processor /proc/cpuinfo) --dynamic-windows --win-version-min=ws08r2 VARIANT_DIR=win32
num_cores: $(grep -c ^processor /proc/cpuinfo)
num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo)
test_flags: "--continueOnFailure --mongosSetParameters='{outboundNetworkImpl: 'ASIO'}' --mongodSetParameters='{outboundNetworkImpl: 'ASIO'}'"
diff --git a/site_scons/mongo_scons_utils.py b/site_scons/mongo_scons_utils.py
index 1ddaf9915dd..69b81f751dd 100644
--- a/site_scons/mongo_scons_utils.py
+++ b/site_scons/mongo_scons_utils.py
@@ -1,4 +1,6 @@
import md5
+import subprocess
+import SCons.Action
def default_variant_dir_generator(target, source, env, for_signature):
@@ -35,3 +37,64 @@ def os_specific_variant_dir_generator(target, source, env, for_signature):
return '-'.join([
env['TARGET_OS'],
default_variant_dir_generator(target, source, env, for_signature)])
+
+def get_toolchain_ver(env, tool):
+ # By default we don't know the version of each tool, and only report what
+ # command gets executed (gcc vs /opt/mongodbtoolchain/bin/gcc).
+ verstr = "version unknown"
+ proc = None
+ if env.ToolchainIs('clang', 'gcc'):
+ proc = SCons.Action._subproc(env,
+ env.subst("${%s} --version" % tool),
+ stdout=subprocess.PIPE,
+ stderr='devnull',
+ stdin='devnull',
+ universal_newlines=True,
+ error='raise',
+ shell=True)
+ verstr = proc.stdout.readline()
+
+ elif env.ToolchainIs('msvc') and env.TargetOSIs('windows'):
+ proc = SCons.Action._subproc(env,
+ env.subst("${%s}" % tool),
+ stdout='devnull',
+ stderr=subprocess.PIPE,
+ stdin='devnull',
+ universal_newlines=True,
+ error='raise',
+ shell=True)
+ verstr = proc.stderr.readline()
+
+ # If we started a process, we should drain its stdout/stderr and wait for
+ # it to end.
+ if proc:
+ proc.communicate()
+
+ return env.subst('${%s}: %s' % (tool, verstr))
+
+# This is the tuple that will be returned by the buildInfo command and
+# printed by the --version command-line option to mongod.
+# Each tuple consists of:
+# key (string)
+# value (string)
+# should be included in buildInfo output (bool)
+# should be included in --version output (bool)
+# The values will be passed through env.subst, so you can use any SCons variables you
+# want to define them.
+def default_buildinfo_environment_data():
+ return (
+ ('distmod', '$MONGO_DISTMOD', True, True,),
+ ('distarch', '$MONGO_DISTARCH', True, True,),
+ ('cc', '$CC_VERSION', True, False,),
+ ('ccflags', '$CCFLAGS', True, False,),
+ ('cxx', '$CXX_VERSION', True, False,),
+ ('cxxflags', '$CXXFLAGS', True, False,),
+ ('linkflags', '$LINKFLAGS', True, False,),
+ ('target_arch', '$TARGET_ARCH', True, True,),
+ ('target_os', '$TARGET_OS', True, False,),
+ )
+
+# If you want buildInfo and --version to be relatively empty, set
+# env['MONGO_BUILDINFO_ENVIRONMENT_DATA'] = empty_buildinfo_environment_data()
+def empty_buildinfo_environment_data():
+ return ()
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 573f8cf6b75..d302dd9e354 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -5,12 +5,9 @@
import itertools
import os
import re
-import subprocess
import sys
from buildscripts import utils
-import SCons.Action
-
Import("env")
Import("has_option")
Import("get_option")
@@ -131,40 +128,6 @@ env.Library(
LIBDEPS=baseLibDeps,
)
-def get_toolchain_ver(tool):
- # By default we don't know the version of each tool, and only report what
- # command gets executed (gcc vs /opt/mongodbtoolchain/bin/gcc).
- verstr = "version unknown"
- proc = None
- if env.ToolchainIs('clang', 'gcc'):
- proc = SCons.Action._subproc(env,
- env.subst("${%s} --version" % tool),
- stdout=subprocess.PIPE,
- stderr='devnull',
- stdin='devnull',
- universal_newlines=True,
- error='raise',
- shell=True)
- verstr = proc.stdout.readline()
-
- elif env.ToolchainIs('msvc') and env.TargetOSIs('windows'):
- proc = SCons.Action._subproc(env,
- env.subst("${%s}" % tool),
- stdout='devnull',
- stderr=subprocess.PIPE,
- stdin='devnull',
- universal_newlines=True,
- error='raise',
- shell=True)
- verstr = proc.stderr.readline()
-
- # If we started a process, we should drain its stdout/stderr and wait for
- # it to end.
- if proc:
- proc.communicate()
-
- return env.subst('${%s}: %s' % (tool, verstr))
-
js_engine_ver = get_option("js-engine") if get_option("server-js") == "on" else "none"
# On windows, we need to escape the backslashes in the command-line
@@ -203,6 +166,26 @@ else:
version_parts[3] = 0
version_parts = [ int(x) for x in version_parts[:4]]
+# This turns the MONGO_BUILDINFO_ENVIRONMENT_DATA tuples into a std::vector of
+# std::tuple<string, string, bool, bool>.
+buildInfoInitializer = []
+for tup in env['MONGO_BUILDINFO_ENVIRONMENT_DATA']:
+ def pyToCXXBool(val):
+ return "true" if val else "false"
+ def wrapInQuotes(val):
+ return '"{0}"'.format(val)
+ buildInfoInitializer.append(
+ 'std::make_tuple({0})'.format(', '.join(
+ (
+ wrapInQuotes(tup[0]),
+ wrapInQuotes(env.subst(tup[1])),
+ pyToCXXBool(tup[2]),
+ pyToCXXBool(tup[3]),
+ )
+ ))
+ )
+buildInfoInitializer = '{{ {0} }}'.format(', '.join(buildInfoInitializer))
+
generatedVersionFile = env.Substfile(
'util/version.cpp.in',
SUBST_DICT=[
@@ -215,16 +198,8 @@ generatedVersionFile = env.Substfile(
('@mongo_git_hash@', env['MONGO_GIT_HASH']),
('@buildinfo_js_engine@', js_engine_ver),
('@buildinfo_allocator@', GetOption('allocator')),
- ('@buildinfo_ccflags@', env['CCFLAGS']),
- ('@buildinfo_cflags@', env['CFLAGS']),
- ('@buildinfo_cxxflags@', env['CXXFLAGS']),
- ('@buildinfo_linkflags@', env['LINKFLAGS']),
- ('@buildinfo_cmdline@', ''),
('@buildinfo_modules@', module_list),
- ('@buildinfo_target_arch@', env['TARGET_ARCH']),
- ('@buildinfo_target_os@', env.GetTargetOSName()),
- ('@buildinfo_cc_version@', get_toolchain_ver('CC')),
- ('@buildinfo_cxx_version@', get_toolchain_ver('CXX')),
+ ('@buildinfo_environment_data@', buildInfoInitializer),
])
env.Alias('generated-sources', generatedVersionFile)
diff --git a/src/mongo/db/log_process_details.cpp b/src/mongo/db/log_process_details.cpp
index 777777d7a40..476bad1eaba 100644
--- a/src/mongo/db/log_process_details.cpp
+++ b/src/mongo/db/log_process_details.cpp
@@ -50,9 +50,7 @@ bool is32bit() {
void logProcessDetails() {
log() << mongodVersion();
- printGitVersion();
- printOpenSSLVersion();
- printAllocator();
+ printBuildInfo();
printCommandLineOpts();
}
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index fe0ef3be14f..7c20662e8fe 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -582,9 +582,7 @@ bool handlePreValidationMongodOptions(const moe::Environment& params,
if (params.count("version") && params["version"].as<bool>() == true) {
setPlainConsoleLogger();
log() << mongodVersion() << endl;
- printGitVersion();
- printOpenSSLVersion();
- printCompiledModules();
+ printBuildInfo();
return false;
}
if (params.count("sysinfo") && params["sysinfo"].as<bool>() == true) {
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index c2e84735084..93d95fe1c11 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -61,8 +61,7 @@ int runDbTests(int argc, char** argv) {
Client::initThread("testsuite");
srand((unsigned)frameworkGlobalParams.seed);
- printGitVersion();
- printOpenSSLVersion();
+ printBuildInfo();
getGlobalServiceContext()->initializeGlobalStorageEngine();
diff --git a/src/mongo/util/version.cpp.in b/src/mongo/util/version.cpp.in
index 165efe460ea..bbd136b0ed0 100644
--- a/src/mongo/util/version.cpp.in
+++ b/src/mongo/util/version.cpp.in
@@ -54,133 +54,142 @@
namespace mongo {
- using std::string;
- using std::stringstream;
-
- const char versionString[] = "@mongo_version@";
- const char * gitVersion() { return "@mongo_git_hash@"; }
- const char * compiledJSEngine() { return "@buildinfo_js_engine@"; }
- const char * allocator() { return "@buildinfo_allocator@"; }
-
- const int kMongoVersionMajor = @mongo_version_major@;
- const int kMongoVersionMinor = @mongo_version_minor@;
- const int kMongoVersionPatch = @mongo_version_patch@;
- const int kMongoVersionExtra = @mongo_version_extra@;
- const char kMongoVersionExtraStr[] = "@mongo_version_extra_str@";
-
- std::vector<std::string> compiledModules() {
- const std::vector<string> modules_list = @buildinfo_modules@;
- return modules_list;
- }
+using std::string;
+using std::stringstream;
- void printCompiledModules() {
- stringstream ss;
- ss << "modules: ";
- auto modules_list = compiledModules();
- if (modules_list.size() == 0) {
- ss << "none";
- } else {
- for (const auto& m: modules_list) {
- ss << m << " ";
- }
- }
- log() << ss.str();
- }
+const char versionString[] = "@mongo_version@";
+const char* gitVersion() {
+ return "@mongo_git_hash@";
+}
+const char* compiledJSEngine() {
+ return "@buildinfo_js_engine@";
+}
+const char* allocator() {
+ return "@buildinfo_allocator@";
+}
- bool isSameMajorVersion(const char* version) {
- int major = -1, minor = -1;
- pcrecpp::RE ver_regex("^(\\d+)\\.(\\d+)\\.");
- ver_regex.PartialMatch(version, &major, &minor);
+const int kMongoVersionMajor = @mongo_version_major@;
+const int kMongoVersionMinor = @mongo_version_minor@;
+const int kMongoVersionPatch = @mongo_version_patch@;
+const int kMongoVersionExtra = @mongo_version_extra@;
+const char kMongoVersionExtraStr[] = "@mongo_version_extra_str@";
- if(major == -1 || minor == -1)
- return false;
- return (major == kMongoVersionMajor && minor == kMongoVersionMinor);
- }
+using BuildInfoTuple = std::tuple<std::string, std::string, bool, bool>;
+const std::vector<BuildInfoTuple> kBuildEnvironment = @buildinfo_environment_data@;
- string mongodVersion() {
- stringstream ss;
- ss << "db version v" << versionString;
- return ss.str();
- }
+std::vector<std::string> compiledModules() {
+ const std::vector<string> modules_list = @buildinfo_modules@;
+ return modules_list;
+}
+
+bool isSameMajorVersion(const char* version) {
+ int major = -1, minor = -1;
+ pcrecpp::RE ver_regex("^(\\d+)\\.(\\d+)\\.");
+ ver_regex.PartialMatch(version, &major, &minor);
- void printGitVersion() { log() << "git version: " << gitVersion(); }
+ if (major == -1 || minor == -1)
+ return false;
+ return (major == kMongoVersionMajor && minor == kMongoVersionMinor);
+}
+
+string mongodVersion() {
+ stringstream ss;
+ ss << "db version v" << versionString;
+ return ss.str();
+}
- const std::string openSSLVersion(const std::string &prefix, const std::string &suffix) {
+const std::string openSSLVersion(const std::string& prefix, const std::string& suffix) {
#ifndef MONGO_CONFIG_SSL
- return "";
+ return "";
#else
- return prefix + SSLeay_version(SSLEAY_VERSION) + suffix;
-#endif
- }
-
- void printOpenSSLVersion() {
-#ifdef MONGO_CONFIG_SSL
- log() << openSSLVersion("OpenSSL version: ");
+ return prefix + SSLeay_version(SSLEAY_VERSION) + suffix;
#endif
- }
+}
#if defined(_WIN32)
- const char * targetMinOS() {
+const char* targetMinOS() {
#if (NTDDI_VERSION >= NTDDI_WIN7)
- return "Windows 7/Windows Server 2008 R2";
-#elif (NTDDI_VERSION >= NTDDI_VISTA)
- return "Windows Vista/Windows Server 2008";
+ return "Windows 7/Windows Server 2008 R2";
+#elif(NTDDI_VERSION >= NTDDI_VISTA)
+ return "Windows Vista/Windows Server 2008";
#else
#error This targeted Windows version is not supported
-#endif // NTDDI_VERSION
- }
+#endif // NTDDI_VERSION
+}
- void printTargetMinOS() {
- log() << "targetMinOS: " << targetMinOS();
- }
-#endif // _WIN32
+void printTargetMinOS() {
+ log() << "targetMinOS: " << targetMinOS();
+}
+#endif // _WIN32
+
+void printBuildInfo() {
+ log() << "git version: " << gitVersion();
+
+#ifdef MONGO_CONFIG_SSL
+ log() << openSSLVersion("OpenSSL version: ");
+#endif
+
+ log() << "allocator: " << allocator();
- void printAllocator() {
- log() << "allocator: " << allocator();
+ stringstream ss;
+ ss << "modules: ";
+ auto modules_list = compiledModules();
+ if (modules_list.size() == 0) {
+ ss << "none";
+ } else {
+ for (const auto& m : modules_list) {
+ ss << m << " ";
+ }
}
+ log() << ss.str();
+
+ log() << "build environment:";
+ for (auto&& envDataEntry : kBuildEnvironment) {
+ if (std::get<3>(envDataEntry)) {
+ auto val = std::get<1>(envDataEntry);
+ if (val.length() == 0)
+ continue;
+ log() << " " << std::get<0>(envDataEntry) << ": " << std::get<1>(envDataEntry);
+ }
+ }
+}
- void appendBuildInfo(BSONObjBuilder& result) {
- result << "version" << versionString
- << "gitVersion" << gitVersion()
+void appendBuildInfo(BSONObjBuilder& result) {
+ result << "version" << versionString << "gitVersion" << gitVersion()
#if defined(_WIN32)
- << "targetMinOS" << targetMinOS()
+ << "targetMinOS" << targetMinOS()
#endif
- << "allocator" << allocator()
- << "javascriptEngine" << compiledJSEngine()
- << "sysInfo" << "deprecated";
-
- BSONArrayBuilder versionArray(result.subarrayStart("versionArray"));
- versionArray << kMongoVersionMajor
- << kMongoVersionMinor
- << kMongoVersionPatch
- << kMongoVersionExtra;
- versionArray.done();
-
- BSONObjBuilder opensslInfo(result.subobjStart("openssl"));
+ << "allocator" << allocator() << "javascriptEngine" << compiledJSEngine() << "sysInfo"
+ << "deprecated";
+
+ BSONArrayBuilder versionArray(result.subarrayStart("versionArray"));
+ versionArray << kMongoVersionMajor << kMongoVersionMinor << kMongoVersionPatch
+ << kMongoVersionExtra;
+ versionArray.done();
+
+ BSONObjBuilder opensslInfo(result.subobjStart("openssl"));
#ifdef MONGO_CONFIG_SSL
- opensslInfo << "running" << openSSLVersion()
- << "compiled" << OPENSSL_VERSION_TEXT;
+ opensslInfo << "running" << openSSLVersion() << "compiled" << OPENSSL_VERSION_TEXT;
#else
- opensslInfo << "running" << "disabled"
- << "compiled" << "disabled";
+ opensslInfo << "running"
+ << "disabled"
+ << "compiled"
+ << "disabled";
#endif
- opensslInfo.done();
-
- BSONObjBuilder buildvarsInfo(result.subobjStart("buildEnvironment"));
- buildvarsInfo << "build_command" << "@buildinfo_cmdline@"
- << "cc" << "@buildinfo_cc_version@"
- << "ccflags" << "@buildinfo_ccflags@"
- << "cflags" << "@buildinfo_cflags@"
- << "cxx" << "@buildinfo_cxx_version@"
- << "cxxflags" << "@buildinfo_cxxflags@"
- << "linkflags" << "@buildinfo_linkflags@"
- << "modules" << compiledModules()
- << "target_arch" << "@buildinfo_target_arch@"
- << "target_os" << "@buildinfo_target_os@";
- buildvarsInfo.done();
-
- result << "bits" << (int)sizeof(void*) * 8;
- result.appendBool( "debug" , kDebugBuild );
- result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
+ opensslInfo.done();
+
+ BSONObjBuilder buildvarsInfo(result.subobjStart("buildEnvironment"));
+ buildvarsInfo << "modules" << compiledModules();
+
+ for (auto&& envDataEntry : kBuildEnvironment) {
+ if (std::get<2>(envDataEntry)) {
+ buildvarsInfo << std::get<0>(envDataEntry) << std::get<1>(envDataEntry);
+ }
}
+ buildvarsInfo.done();
+
+ result << "bits" << (int)sizeof(void*) * 8;
+ result.appendBool("debug", kDebugBuild);
+ result.appendNumber("maxBsonObjectSize", BSONObjMaxUserSize);
+}
}
diff --git a/src/mongo/util/version.h b/src/mongo/util/version.h
index cdce9e72a99..17a40eaa62e 100644
--- a/src/mongo/util/version.h
+++ b/src/mongo/util/version.h
@@ -45,22 +45,19 @@ std::string mongodVersion();
// mongo git version
const char* gitVersion();
const char* distName();
-void printGitVersion();
std::vector<std::string> compiledModules();
-void printCompiledModules();
// Checks whether another version is the same major version as us
bool isSameMajorVersion(const char* version);
// Get/print the version of OpenSSL that's used at runtime
const std::string openSSLVersion(const std::string& prefix = "", const std::string& suffix = "");
-void printOpenSSLVersion();
// Append build info data to a BSONObjBuilder
void appendBuildInfo(BSONObjBuilder& result);
void printTargetMinOS();
-void printAllocator();
+void printBuildInfo();
void show_warnings();
extern const int kMongoVersionMajor;