From ab7f0080a8546d21fa737350ce58aaf1cb9c8435 Mon Sep 17 00:00:00 2001 From: Jonathan Reams Date: Mon, 15 Jun 2015 11:31:56 -0400 Subject: SERVER-18953 SERVER-9567 Add debug symbols archive target (cherry picked from commit 26d5e725c8d3da73c2ca81f9940debe4f76326b8) --- SConstruct | 6 +- buildscripts/make_archive.py | 13 ++- etc/evergreen.yml | 205 +++++++++---------------------------------- src/mongo/SConscript | 54 ++++++++++-- 4 files changed, 101 insertions(+), 177 deletions(-) diff --git a/SConstruct b/SConstruct index 069f0f1cc64..0d9de5a8d50 100644 --- a/SConstruct +++ b/SConstruct @@ -470,6 +470,10 @@ env_vars.Add('MONGO_GIT_HASH', help='Sets the githash to store in the MongoDB version information', default=version_data['githash']) +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) @@ -2383,8 +2387,6 @@ def getSystemInstallName(): n = platform + "-" + arch_name if static: n += "-static" - if has_option("nostrip"): - n += "-debugsymbols" if nix and os.uname()[2].startswith("8."): n += "-tiger" 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 fd79c3471d6..346cd6484c4 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -46,6 +46,28 @@ variables: - amazon - debian71 +- &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 # ####################################### @@ -92,25 +114,8 @@ 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 params: @@ -120,25 +125,8 @@ 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 + "extract binaries" : command: shell.exec params: @@ -153,6 +141,7 @@ functions: remote_file: mongodb-mongo-v3.0/${build_variant}/${revision}/artifacts/${build_id}.tgz bucket: mciuploads extract_to: src + "build rocksdb" : command: shell.exec params: @@ -268,16 +257,15 @@ tasks: export MONGO_PHASE="${task_name}_${execution}" 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|} ${gitvars} git describe | ${python|python} buildscripts/generate_compile_expansions.py | 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} ${python|python} buildscripts/smoke.py --with-cleanbb --mode files --from-file build/unittests.txt --dont-start-mongod --report-file report.json core 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: expansions.update params: @@ -1929,7 +1917,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 @@ -1964,7 +1952,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 @@ -2011,7 +1999,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 @@ -2057,7 +2045,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 @@ -2105,7 +2093,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 @@ -2160,25 +2148,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) @@ -2193,25 +2163,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 @@ -2233,26 +2185,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 @@ -2273,26 +2206,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'}, @@ -2313,24 +2227,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 @@ -2378,7 +2275,6 @@ buildvariants: push_arch: x86_64 compile_flags: -j$(grep -c ^processor /proc/cpuinfo) --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --release --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true tasks: - name: compile distros: @@ -2455,7 +2351,6 @@ buildvariants: push_arch: x86_64 test_flags: --continue-on-failure compile_flags: --dbg=on --opt=on -j$(grep -c ^processor /proc/cpuinfo) --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --variant-dir="linux2/dbg_on/opt_on" - has_debugsymbols: true tasks: - name: compile distros: @@ -2521,7 +2416,6 @@ buildvariants: push_name: linux-duroff push_arch: x86_64 compile_flags: --durableDefaultOff -j$(grep -c ^processor /proc/cpuinfo) --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --variant-dir="linux2/durableDefaultOff" - has_debugsymbols: true test_flags: --continue-on-failure tasks: - name: compile @@ -2606,7 +2500,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: ubuntu1204 @@ -2685,7 +2578,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: ubuntu1404 @@ -2765,7 +2657,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --authMechanism=SCRAM-SHA-1 --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: amazon @@ -2814,7 +2705,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: amazon @@ -2894,7 +2784,6 @@ buildvariants: push_arch: i686 compile_flags: --release --distarch=i686 -j$(grep -c ^processor /proc/cpuinfo) --32 --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true tasks: - name: compile distros: @@ -2930,7 +2819,6 @@ buildvariants: push_name: linux-debug push_arch: i686 test_flags: --continue-on-failure - has_debugsymbols: true compile_flags: --dbg=on --distarch=i686 --opt=on -j$(grep -c ^processor /proc/cpuinfo) --32 --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --variant-dir="linux2/debug" tasks: - name: compile @@ -3483,7 +3371,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: rhel57 @@ -3522,7 +3409,6 @@ buildvariants: push_arch: x86_64-enterprise-rhel62 compile_flags: --ssl --distmod=rhel62 -j$(grep -c ^processor /proc/cpuinfo) --release --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: rhel62 @@ -3560,7 +3446,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: rhel70 @@ -3596,7 +3481,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: rhel55 @@ -3676,7 +3560,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: rhel62 @@ -3756,7 +3639,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: rhel70 @@ -3841,7 +3723,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --authMechanism=SCRAM-SHA-1 --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: ubuntu1204 @@ -3879,7 +3760,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --authMechanism=SCRAM-SHA-1 --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: ubuntu1404 @@ -3921,7 +3801,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --authMechanism=SCRAM-SHA-1 --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: suse11 @@ -3958,7 +3837,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: suse11 @@ -4039,9 +3917,8 @@ 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++ --static-libstdc++ --64 -j$(kstat cpu | sort -u | grep -c "^module") --release + compile_flags: --cc=/opt/mongodbtoolchain/bin/gcc --cxx=/opt/mongodbtoolchain/bin/g++ --static-libstdc++ --64 -j$(kstat cpu | sort -u | grep -c "^module") --release OBJCOPY=/opt/mongodbtoolchain/bin/objcopy test_flags: --continue-on-failure - has_debugsymbols: true tasks: - name: compile - name: aggregation @@ -4090,7 +3967,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --authMechanism=SCRAM-SHA-1 --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager-enterprise.py packager_distro: debian71 @@ -4127,7 +4003,6 @@ buildvariants: 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++ --variant-dir="linux2/release" test_flags: --continue-on-failure - has_debugsymbols: true has_packages: true packager_script: packager.py packager_distro: debian71 diff --git a/src/mongo/SConscript b/src/mongo/SConscript index bdfe93f9c45..28197bd5833 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -1339,18 +1339,53 @@ if not has_option('noshell'): # binaries distBinaries = [] +distDebugSymbols = [] -if windows: - distBinaries.extend(['mongod.pdb', 'mongos.pdb']) +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 (solaris or 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 linux or 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 darwin: + debug_sym_name += '.dSYM' + debug_sym_cmd = 'dsymutil -o ${TARGET} ${SOURCE}' + elif windows: + 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 (linux or 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 nix: @@ -1446,6 +1481,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" ) -- cgit v1.2.1