diff options
author | Jonathan Reams <jbreams@mongodb.com> | 2015-06-15 11:31:56 -0400 |
---|---|---|
committer | Jonathan Reams <jbreams@mongodb.com> | 2015-06-23 11:08:17 -0400 |
commit | 26d5e725c8d3da73c2ca81f9940debe4f76326b8 (patch) | |
tree | 2b76a9f8c894445d5021b6448965596ed631d5b9 | |
parent | c094ed73df14256aeb2851bfb2525947eda066ce (diff) | |
download | mongo-26d5e725c8d3da73c2ca81f9940debe4f76326b8.tar.gz |
SERVER-18953 SERVER-9567 Add debug symbols archive target
-rw-r--r-- | SConstruct | 6 | ||||
-rwxr-xr-x | buildscripts/make_archive.py | 13 | ||||
-rw-r--r-- | etc/evergreen.yml | 202 | ||||
-rw-r--r-- | src/mongo/SConscript | 53 |
4 files changed, 96 insertions, 178 deletions
diff --git a/SConstruct b/SConstruct index ea42bf93b55..85db3412585 100644 --- a/SConstruct +++ b/SConstruct @@ -628,6 +628,10 @@ env_vars.Add('MSVC_USE_SCRIPT', env_vars.Add('MSVC_VERSION', help='Sets the version of Visual Studio to use (e.g. 12.0, 11.0, 10.0)') +env_vars.Add('OBJCOPY', + help='Sets the path to objcopy', + default=WhereIs('objcopy')) + env_vars.Add('RPATH', help='Set the RPATH for dynamic libraries and executables', converter=variable_shlex_converter) @@ -2232,8 +2236,6 @@ def getSystemInstallName(): dist_arch = GetOption("distarch") arch_name = env['TARGET_ARCH'] if not dist_arch else dist_arch n = env.GetTargetOSName() + "-" + arch_name - if has_option("nostrip"): - n += "-debugsymbols" if len(mongo_modules): n += "-" + "-".join(m.name for m in mongo_modules) diff --git a/buildscripts/make_archive.py b/buildscripts/make_archive.py index 5df995b41e9..eabd6f28a07 100755 --- a/buildscripts/make_archive.py +++ b/buildscripts/make_archive.py @@ -32,6 +32,7 @@ import sys import shlex import shutil import zipfile +import tempfile from subprocess import (Popen, PIPE, STDOUT) def main(argv): @@ -80,9 +81,10 @@ def make_tar_archive(opts): tar_options += "z" # clean and create a temp directory to copy files to - enclosing_archive_directory = os.path.join("build", "archive") - delete_directory(enclosing_archive_directory) - os.makedirs(enclosing_archive_directory) + enclosing_archive_directory = tempfile.mkdtemp( + prefix='archive_', + dir=os.path.abspath('build') + ) output_tarfile = os.path.join(os.getcwd(), opts.output_filename) tar_command = ["tar", tar_options, output_tarfile] @@ -94,7 +96,10 @@ def make_tar_archive(opts): if not os.path.exists(enclosing_file_directory): os.makedirs(enclosing_file_directory) print "copying %s => %s" % (input_filename, temp_file_location) - shutil.copy2(input_filename, temp_file_location) + if os.path.isdir(input_filename): + shutil.copytree(input_filename, temp_file_location) + else: + shutil.copy2(input_filename, temp_file_location) tar_command.append(preferred_filename) print " ".join(tar_command) diff --git a/etc/evergreen.yml b/etc/evergreen.yml index ced7a5d30ae..ef602d339c8 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -36,6 +36,28 @@ variables: resmoke_args: --help run_multiple_jobs: false +- &debug_symbol_variants + - enterprise-linux-64-amazon-ami + - enterprise-rhel-57-64-bit + - enterprise-rhel-62-64-bit + - enterprise-rhel-70-64-bit + - enterprise-suse11-64 + - enterprise-ubuntu1204-64 + - enterprise-ubuntu1404-64 + - enterprise-debian71-64 + - linux-32 + - linux-64 + - amazon + - rhel55 + - rhel62 + - rhel70 + - suse11 + - ubuntu1204 + - ubuntu1404 + - debian71 + - solaris-64-bit + - osx + ####################################### # Functions # ####################################### @@ -98,25 +120,7 @@ functions: permissions: public-read content_type: ${content_type|application/x-gzip} build_variants: - ['enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-rhel-70-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit'] + *debug_symbol_variants "fetch debugsymbols archive" : command: s3.get @@ -127,25 +131,7 @@ functions: bucket: mciuploads local_file: src/mongo-debugsymbols.tgz build_variants: - ['enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-rhel-70-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit'] + *debug_symbol_variants "build rocksdb" : command: shell.exec @@ -296,17 +282,16 @@ tasks: set -o verbose rm -rf ${install_directory|/data/mongo-install-directory} - ${scons|scons} ${compile_flags|} --use-new-tools all dist distsrc-${ext|tgz} ${msi_target|} + ${scons|scons} ${compile_flags|} --use-new-tools all dist dist-debugsymbols distsrc-${ext|tgz} ${msi_target|} ${python|python} buildscripts/generate_compile_expansions.py version.json | \ tee compile_expansions.yml - if [ "${has_debugsymbols|}" = "true" ]; then ${scons|scons} ${compile_flags|} --nostrip --use-new-tools dist; original_filename=$(ls | grep debugsymbols); mv $original_filename $(echo $original_filename | sed 's/debugsymbols-//' | sed 's/mongodb/debugsymbols-mongodb/'); fi ${asan_symbolizer} ${enable_lsan} ${rlp_environment} ${python|python} buildscripts/resmoke.py --jobs=${num_jobs_unittests|1} --suites=unittests ${test_flags} --log=buildlogger --reportFile=report.json mv mongodb-src-*.${ext|tgz} distsrc.${ext|tgz} + mv mongodb-*-debugsymbols.${ext|tgz} mongo-debugsymbols.tgz || true mv mongodb-*.${ext|tgz} mongodb-binaries.tgz - mv debugsymbols-*.${ext|tgz} mongo-debugsymbols.tgz || true - command: archive.targz_pack params: @@ -1102,7 +1087,7 @@ tasks: params: aws_secret: ${aws_secret} aws_key: ${aws_key} - build_variants: ["enterprise-linux-64-amazon-ami", "enterprise-rhel-57-64-bit", "enterprise-rhel-62-64-bit", "enterprise-rhel-70-64-bit", "enterprise-suse11-64", "enterprise-ubuntu1204-64", "enterprise-ubuntu1404-64", "enterprise-debian71-64", "linux-32", "linux-64", "amazon", "rhel55", "rhel62", "rhel70", "suse11", "ubuntu1204", "ubuntu1404", "debian71", "solaris-64-bit"] + build_variants: *debug_symbol_variants permissions: public-read local_file: src/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz} bucket: build-push-testing @@ -1137,7 +1122,7 @@ tasks: params: aws_secret: ${aws_secret} aws_key: ${aws_key} - build_variants: ["enterprise-linux-64-amazon-ami", "enterprise-rhel-57-64-bit", "enterprise-rhel-62-64-bit", "enterprise-rhel-70-64-bit", "enterprise-suse11-64", "enterprise-ubuntu1204-64", "enterprise-ubuntu1404-64", "enterprise-debian71-64", "linux-32", "linux-64", "amazon", "rhel55", "rhel62", "rhel70", "suse11", "ubuntu1204", "ubuntu1404", "debian71", "solaris-64-bit"] + build_variants: *debug_symbol_variants permissions: public-read local_file: src/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sig bucket: build-push-testing @@ -1184,7 +1169,7 @@ tasks: params: aws_secret: ${aws_secret} aws_key: ${aws_key} - build_variants: ["enterprise-linux-64-amazon-ami", "enterprise-rhel-57-64-bit", "enterprise-rhel-62-64-bit", "enterprise-rhel-70-64-bit", "enterprise-suse11-64", "enterprise-ubuntu1204-64", "enterprise-ubuntu1404-64", "enterprise-debian71-64", "linux-32", "linux-64", "amazon", "rhel55", "rhel62", "rhel70", "suse11", "ubuntu1204", "ubuntu1404", "debian71", "solaris-64-bit"] + build_variants: *debug_symbol_variants permissions: public-read local_file: src/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sha1 bucket: build-push-testing @@ -1230,7 +1215,7 @@ tasks: - command: s3.put params: aws_secret: ${aws_secret} - build_variants: ["enterprise-linux-64-amazon-ami", "enterprise-rhel-57-64-bit", "enterprise-rhel-62-64-bit", "enterprise-rhel-70-64-bit", "enterprise-suse11-64", "enterprise-ubuntu1204-64", "enterprise-ubuntu1404-64", "enterprise-debian71-64", "linux-32", "linux-64", "amazon", "rhel55", "rhel62", "rhel70", "suse11", "ubuntu1204", "ubuntu1404", "debian71", "solaris-64-bit"] + build_variants: *debug_symbol_variants local_file: src/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sha256 aws_key: ${aws_key} bucket: build-push-testing @@ -1278,7 +1263,7 @@ tasks: params: aws_key: ${aws_key} aws_secret: ${aws_secret} - build_variants: ["enterprise-linux-64-amazon-ami", "enterprise-rhel-57-64-bit", "enterprise-rhel-62-64-bit", "enterprise-rhel-70-64-bit", "enterprise-suse11-64", "enterprise-ubuntu1204-64", "enterprise-ubuntu1404-64", "linux-32", "linux-64", "amazon", "rhel55", "rhel62", "rhel70", "suse11", "ubuntu1204", "ubuntu1404", "debian71", "solaris-64-bit"] + build_variants: *debug_symbol_variants local_file: src/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.md5 bucket: build-push-testing content_type: text/plain @@ -1315,25 +1300,7 @@ tasks: #Debug Symbols - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}-${task_id}.${ext|tgz}', 'bucket': 'build-push-testing'}, 'destination': {'path': '${push_path}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}', 'bucket': '${push_bucket}'}, - 'build_variants': - ['enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit'] + 'build_variants': *debug_symbol_variants } #MSI (Windows only) @@ -1348,25 +1315,7 @@ tasks: #Debug Symbols Signature - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}-${task_id}.${ext|tgz}.sig', 'bucket': 'build-push-testing'}, 'destination': {'path': '${push_path}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sig', 'bucket': '${push_bucket}'}, - 'build_variants': - ['enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit'] + 'build_variants': *debug_symbol_variants } #Source tarball signature @@ -1388,26 +1337,7 @@ tasks: #SHA1 for debug symbols - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}-${task_id}.${ext|tgz}.sha1', 'bucket': 'build-push-testing'}, 'destination': {'path': '${push_path}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sha1', 'bucket': '${push_bucket}'}, - 'build_variants': [ - 'enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit' - ] + 'build_variants': *debug_symbol_variants } #SHA1 for MSI @@ -1428,26 +1358,7 @@ tasks: #SHA256 for debugsymbols - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}-${task_id}.${ext|tgz}.sha256', 'bucket': 'build-push-testing'}, 'destination': {'path': '${push_path}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.sha256', 'bucket': '${push_bucket}'}, - 'build_variants': [ - 'enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'enterprise-debian71-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit' - ]} + 'build_variants': *debug_symbol_variants} #SHA256 for MSI files - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-win32-${push_arch}-${suffix}-${task_id}-signed.msi.sha256', 'bucket': 'build-push-testing'}, @@ -1468,24 +1379,7 @@ tasks: #MD5 for debugsymbols - {'source': {'path': '${push_path}-STAGE/${push_name}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}-${task_id}.${ext|tgz}.md5', 'bucket': 'build-push-testing'}, 'destination': {'path': '${push_path}/mongodb-${push_name}-${push_arch}-debugsymbols-${suffix}.${ext|tgz}.md5', 'bucket': '${push_bucket}'}, - 'build_variants': [ - 'enterprise-linux-64-amazon-ami', - 'enterprise-rhel-57-64-bit', - 'enterprise-rhel-62-64-bit', - 'enterprise-suse11-64', - 'enterprise-ubuntu1204-64', - 'enterprise-ubuntu1404-64', - 'linux-32', - 'linux-64', - 'amazon', - 'rhel55', - 'rhel62', - 'rhel70', - 'suse11', - 'ubuntu1204', - 'ubuntu1404', - 'debian71', - 'solaris-64-bit'] + 'build_variants': *debug_symbol_variants } #MD5 for MSIs @@ -1540,7 +1434,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -1635,7 +1528,6 @@ buildvariants: num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure compile_flags: --dbg=on --opt=on -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ - has_debugsymbols: true tasks: - name: compile distros: @@ -1706,7 +1598,6 @@ buildvariants: push_name: linux-duroff push_arch: x86_64 compile_flags: -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ - has_debugsymbols: true num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure --nojournal @@ -1806,7 +1697,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -1897,7 +1787,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -1989,7 +1878,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -2043,7 +1931,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -2135,7 +2022,6 @@ buildvariants: 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. - has_debugsymbols: true tasks: - name: compile distros: @@ -2173,7 +2059,6 @@ buildvariants: 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. - has_debugsymbols: true compile_flags: --dbg=on --distarch=i686 --opt=on -j$(grep -c ^processor /proc/cpuinfo) CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ --wiredtiger=off CCFLAGS="-m32" LINKFLAGS="-m32" tasks: - name: compile @@ -2806,7 +2691,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -2847,7 +2731,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -2888,7 +2771,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile - name: audit @@ -2926,7 +2808,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3018,7 +2899,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3110,7 +2990,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3207,7 +3086,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3246,7 +3124,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3289,7 +3166,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true # TODO: Remove the "has_pyyaml_installed" expansion after PyYAML is installed on all build variants. has_pyyaml_installed: true tasks: @@ -3329,7 +3205,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true # TODO: Remove the "has_pyyaml_installed" expansion after PyYAML is installed on all build variants. has_pyyaml_installed: true tasks: @@ -3421,11 +3296,10 @@ buildvariants: push_bucket: downloads.mongodb.org push_name: sunos5 push_arch: x86_64 - compile_flags: CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ -j$(kstat cpu | sort -u | grep -c "^module") --release CCFLAGS="-m64" LINKFLAGS="-m64 -static-libstdc++ -static-libgcc" + compile_flags: CC=/opt/mongodbtoolchain/bin/gcc CXX=/opt/mongodbtoolchain/bin/g++ -j$(kstat cpu | sort -u | grep -c "^module") --release CCFLAGS="-m64" LINKFLAGS="-m64 -static-libstdc++ -static-libgcc" OBJCOPY=/opt/mongodbtoolchain/bin/objcopy num_cores: $(kstat cpu | sort -u | grep -c "^module") num_jobs_unittests: $(kstat cpu | sort -u | grep -c "^module") test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile - name: aggregation @@ -3478,7 +3352,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: @@ -3516,7 +3389,6 @@ buildvariants: num_cores: $(grep -c ^processor /proc/cpuinfo) num_jobs_unittests: $(grep -c ^processor /proc/cpuinfo) test_flags: --continueOnFailure - has_debugsymbols: true tasks: - name: compile distros: diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 1d23c459b82..596b94b70ee 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -318,21 +318,53 @@ else: # binaries distBinaries = [] - -if env.TargetOSIs('windows'): - distBinaries.extend(['mongod.pdb', 'mongos.pdb']) +distDebugSymbols = [] def add_exe( v ): return "${PROGPREFIX}%s${PROGSUFFIX}" % v +def failMissingObjCopy(env, target, source): + env.FatalError("Generating debug symbols requires objcopy, please set the OBJCOPY variable.") + def installBinary( e, name ): + debug_sym_name = name name = add_exe( name ) - if env.TargetOSIs('solaris', 'linux') and (not has_option("nostrip")): - name = e.Command('stripped/%s' % name, name, Copy('$TARGET', '$SOURCE'))[0] - e.AddPostAction(name, 'strip $TARGET') + debug_sym_cmd = None + if e.TargetOSIs('linux', 'solaris'): + if 'OBJCOPY' not in e: + debug_sym_cmd = failMissingObjCopy + else: + debug_sym_cmd = '${OBJCOPY} --only-keep-debug ${SOURCE} ${TARGET}' + debug_sym_name += '.debug' + elif e.TargetOSIs('osx'): + debug_sym_name += '.dSYM' + debug_sym_cmd = 'dsymutil -o ${TARGET} ${SOURCE}' + elif e.ToolchainIs('msvc'): + debug_sym_name += '.pdb' + distBinaries.append(debug_sym_name) + distDebugSymbols.append(debug_sym_name) + + if debug_sym_cmd: + debug_sym = e.Command( + debug_sym_name, + name, + debug_sym_cmd + ) + e.Install("#/", debug_sym) + e.Alias('debugsymbols', debug_sym) + distDebugSymbols.append(debug_sym) + + if env.TargetOSIs('linux', 'solaris') and (not has_option("nostrip")): + strip_cmd = e.Command( + 'stripped/%s' % name, + [name, debug_sym], + '${OBJCOPY} --strip-debug --add-gnu-debuglink ${SOURCES[1]} ${SOURCES[0]} $TARGET' + ) + distBinaries.append('stripped/%s' % name) + else: + distBinaries.append(name) - distBinaries.append(name) inst = e.Install( "$INSTALL_DIR/bin", name ) if env.TargetOSIs('posix'): @@ -432,6 +464,13 @@ else: env.Alias("dist", [], [ failDist ] ) env.AlwaysBuild("dist") +debug_symbols_dist = env.Command( + target='#/${SERVER_DIST_BASENAME}-debugsymbols${DIST_ARCHIVE_SUFFIX}', + source=['#buildscripts/make_archive.py'] + distDebugSymbols, + action='$PYTHON ${SOURCES[0]} -o $TARGET --transform $BUILD_DIR/mongo=$SERVER_DIST_BASENAME ${TEMPFILE(SOURCES[1:])}', + BUILD_DIR=env.Dir('$BUILD_DIR').path +) +env.Alias('dist-debugsymbols', debug_symbols_dist) #final alias env.Alias( "install", "$INSTALL_DIR" ) |