From 09730f8a53a8adb24ad168f1d260745c69a9b072 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 21 Mar 2024 17:18:10 +0200 Subject: [PATCH] Switch to dump_syms from mozilla project. --- .cirrus.yml | 12 ++++------ appveyor.yml | 12 ++++------ conanfile.py | 5 ++-- scripts/symupload.py | 54 ++++++++++++-------------------------------- 4 files changed, 25 insertions(+), 58 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index aa64d3c34..17bef41e7 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -130,7 +130,7 @@ appimage_task_template: &APPIMAGE_TASK_TEMPLATE install_script: - bash -c "$PACKAGE_MANAGER_INSTALL qt515base qt515svg qt515tools qt515xmlpatterns qt515translations qt515doc qt515imageformats poppler-utils git xvfb ccache build-essential libgl1-mesa-dev libicu-dev python3-pip" - python3 --version - - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 + - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests build_script: - uname -a - mkdir -pm 0700 $XDG_RUNTIME_DIR @@ -157,14 +157,12 @@ appimage_task_template: &APPIMAGE_TASK_TEMPLATE - qbs setup-qt /opt/qt515/bin/qmake qt5 - qbs config defaultProfile qt5 - qbs config profiles.qt5.baseProfile ${COMPILER} - - conan install . -s os=Linux --build=missing -o with_crash_reporting=True -pr valentina -g virtualrunenv + - conan install . -s os=Linux --build=missing -o with_crash_reporting=True -pr valentina - qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --jobs $(nproc) profile:qt5 config:release modules.buildconfig.enableCcache:${ENABLE_CCACHE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/AppDir modules.buildconfig.enableAppImage:true modules.buildconfig.enableRPath:false project.conanWithCrashReporting:true project.enableConan:true - qbs -p autotest-runner -d build profile:qt5 config:release - export CRASH_QT_VERSION=$(/opt/qt515/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}') - export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1) - - source activate_run.sh - python3 scripts/symupload.py $CIRRUS_WORKING_DIR/build/AppDir $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean - - source deactivate_run.sh - appimage-builder --recipe dist/AppImage/AppImageBuilder.yml --appdir $CIRRUS_WORKING_DIR/build/AppDir --skip-test - ccache -s deploy_script: @@ -367,7 +365,7 @@ macos_task_template: &MACOS_TASK_TEMPLATE - chmod -R 755 /opt/homebrew/opt/poppler/* - chmod -R 755 /opt/homebrew/opt/xerces-c/* - python3 --version - - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 + - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests - ccache --set-config sloppiness=pch_defines,time_macros max_size="$CCACHE_SIZE" - qmake --version - which qmake @@ -398,13 +396,11 @@ macos_task_template: &MACOS_TASK_TEMPLATE - qbs setup-qt /opt/homebrew/opt/qt6/bin/qmake qt6 - qbs config defaultProfile qt6 - qbs config profiles.qt6.baseProfile clang - - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina -g virtualrunenv + - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina - qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:${ENABLE_CCACHE} moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir - export CRASH_QT_VERSION=$(/opt/homebrew/opt/qt6/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}') - export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1) - - source activate_run.sh - python3 scripts/symupload.py $CIRRUS_WORKING_DIR/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean - - source deactivate_run.sh - qbs build -f valentina.qbs -d $CIRRUS_WORKING_DIR/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:$CIRRUS_WORKING_DIR/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:${ENABLE_CCACHE} moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir # Store the notarization credentials so that we can prevent a UI password dialog # from blocking the CI diff --git a/appveyor.yml b/appveyor.yml index 1e1bb0f77..620211f36 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -655,7 +655,7 @@ for: fi - sudo python3 -m pip install --upgrade pip - - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 + - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests - export QTDIR=`$(brew --prefix qt6)` - export PATH="$PATH:`python3 -m site --user-base`/bin:$QTDIR/bin" - echo $PATH @@ -689,13 +689,11 @@ for: - qbs setup-qt $(brew --prefix qt6)/bin/qmake qt6 - qbs config defaultProfile qt6 - qbs config profiles.qt6.baseProfile clang - - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina -g virtualrunenv + - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina - qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true - export CRASH_QT_VERSION=$($QTDIR/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}') - export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1) - - source activate_run.sh - python3 scripts/symupload.py ${APPVEYOR_BUILD_FOLDER}/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean - - source deactivate_run.sh - qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt6 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true moduleProviders.qbspkgconfig.extraPaths:$(brew --prefix xerces-c)/lib/pkgconfig,$(brew --prefix qt6)/lib/pkgconfig,$(brew --prefix openssl@1.1)/lib/pkgconfig "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:$(brew --prefix qt6)/lib,$(brew --prefix poppler)/lib modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true # Store the notarization credentials so that we can prevent a UI password dialog # from blocking the CI @@ -854,7 +852,7 @@ for: fi - sudo python3 -m pip install --upgrade pip - - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 + - pip3 install --user --upgrade pip dropbox py7zr 'urllib3<2.0' conan==1.63.0 requests - export PATH="`brew --prefix qbs`/bin:$PATH" - echo $PATH - clang --version @@ -886,13 +884,11 @@ for: - qbs setup-qt ${QTDIR}/bin/qmake qt5 - qbs config defaultProfile qt5 - qbs config profiles.qt5.baseProfile clang - - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina -g virtualrunenv + - conan install . -s os=Macos --build=missing -o with_crash_reporting=True -pr valentina - qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt5 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:${QTDIR}/lib modules.macdeployqt.pluginspath:${QTDIR}/plugins modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true - export CRASH_QT_VERSION=$($QTDIR/bin/qmake -query QT_VERSION | awk -F. '{print $1 "_" $2}') - export CRASH_SHORT_SHA=$(git log --pretty=format:%h -n 1) - - source activate_run.sh - python3 scripts/symupload.py ${APPVEYOR_BUILD_FOLDER}/build/install-root $VALENTINA_VERSION $CRASH_SHORT_SHA $CRASH_QT_VERSION --clean - - source deactivate_run.sh - qbs build -f valentina.qbs -d ${APPVEYOR_BUILD_FOLDER}/build -p 'Valentina DMG' --force-probe-execution --jobs $(nproc) config:release modules.buildconfig.enableUnitTests:false modules.buildconfig.enableMultiBundle:${MULTI_BUNDLE} qbs.installRoot:${APPVEYOR_BUILD_FOLDER}/build/install-root profile:qt5 project.minimumMacosVersion:${MACOS_DEPLOYMENT_TARGET} modules.buildconfig.enableCcache:true "modules.buildconfig.signingIdentity:$MACOS_CERTIFICATE_NAME" modules.macdeployqt.libpath:${QTDIR}/lib modules.macdeployqt.pluginspath:${QTDIR}/plugins modules.macdeployqt.macdeployqtProgramBinPath:${HOME}/macdeployqt-install-dir project.enableConan:true project.conanWithCrashReporting:true # Store the notarization credentials so that we can prevent a UI password dialog # from blocking the CI diff --git a/conanfile.py b/conanfile.py index 131da430f..e138217fb 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,7 +4,7 @@ from conan import ConanFile class Recipe(ConanFile): settings = "os" - requires = "xerces-c/[~3.2]", "crashpad/cci.20220219", "breakpad/cci.20210521" + requires = "xerces-c/[~3.2]", "sentry-crashpad/0.6.5" options = { "with_xerces": [True, False], "with_crash_reporting": [True, False] @@ -27,5 +27,4 @@ class Recipe(ConanFile): del self.requires["xerces-c"] if not self.options.with_crash_reporting: - del self.requires["crashpad/cci.20220219"] - del self.requires["breakpad/cci.20210521"] + del self.requires["sentry-crashpad/0.6.5"] diff --git a/scripts/symupload.py b/scripts/symupload.py index 499c1f2fd..3995f0da0 100644 --- a/scripts/symupload.py +++ b/scripts/symupload.py @@ -4,6 +4,7 @@ import subprocess import sys import glob import zipfile +import requests database = "valentina" @@ -21,17 +22,6 @@ def debug_extension(): return debug_ext -def check_binary(binary): - # Check if binary file exists - if not os.path.exists(binary): - # If binary file doesn't exist, it may be part of a framework - framework_binary = os.path.basename(binary.replace(".framework", "")) - for root, dirs, files in os.walk(binary): - for file in files: - if file == framework_binary: - return os.path.join(root, file) - return binary - def zip_sym(sym_file): zip_sym_file = sym_file + ".zip" with zipfile.ZipFile(zip_sym_file, 'w', zipfile.ZIP_DEFLATED) as zipf: @@ -48,24 +38,10 @@ def generate_sym_files(install_root): for debug_file in debug_files: print(f"Generating symbols for: {os.path.basename(debug_file)}") - if platform == "win32": - # For Windows, return the executable file - sym_file = os.path.splitext(debug_file)[0] + ".exe" - else: - sym_file = os.path.splitext(debug_file)[0] + ".sym" - if platform == "darwin": - binary = check_binary(os.path.splitext(debug_file)[0]) - dump_syms_cmd = ["dump_syms", "-g", debug_file, binary] - elif platform == "linux": - dump_syms_cmd = ["dump_syms", debug_file] - with open(sym_file, "w") as f: - subprocess.run(dump_syms_cmd, check=True, stdout=f) - - if platform == "linux": - # When symbols are dumped from a debug file Crashpad creates an incorrect module name. - sed_cmd = ["sed", "-i", "1s/.debug//", sym_file] - subprocess.run(sed_cmd, check=True) + sym_file = os.path.splitext(debug_file)[0] + ".sym" + dump_syms_cmd = ["dump_syms", '-o', sym_file, debug_file] + subprocess.run(dump_syms_cmd, check=True) sym_files.append((debug_file, zip_sym(sym_file))) @@ -89,7 +65,7 @@ def generate_version_string(val_version, commit_hash, qt_version): def get_app_name(sym_file): # Get the base name of the symbol file without extension - base_name = os.path.splitext(os.path.basename(sym_file))[0].lower() + base_name = os.path.basename(sym_file).split(".sym")[0].lower() # Determine the platform platform = sys.platform @@ -114,18 +90,18 @@ def upload_symbols(install_root, val_version, commit_hash, qt_version, clean=Fal app_name = get_app_name(sym_file) print(f"Uploading symbols for application {app_name}") - if platform == "linux": - upload_cmd = ["sym_upload", sym_file, f"https://{database}.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName={app_name}&appVer={app_version}"] - elif platform == "darwin": - upload_cmd = ["symupload", sym_file, f"https://{database}.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName={app_name}&appVer={app_version}"] - elif platform == "win32": - upload_cmd = ["symupload.exe", "--product", app_name, sym_file, f"https://{database}.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName={app_name}&appVer={app_version}"] + sym_file_name = os.path.basename(sym_file) + url = f"https://{database}.bugsplat.com/post/bp/symbol/breakpadsymbols.php?appName={app_name}&appVer={app_version}&code_file={sym_file_name}" - try: - subprocess.run(upload_cmd, check=True) + files = {'symbol_file': (f'{sym_file_name}', open(sym_file, 'rb'))} + response = requests.post(url, files=files) + + if response.status_code == 200: print(f"Symbol file '{sym_file}' uploaded successfully.") - except subprocess.CalledProcessError as e: - print(f"Error: {e}") + else: + print("Request failed with status code:", response.status_code) + print("Server response:") + print(response.text) # Cleanup if requested if clean: