From 79e1bf0f8d07ff93b2022977b640c4a032321022 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 9 May 2024 11:23:05 +0300 Subject: [PATCH] Follow BugSplat convention for naming sym files. BugSplat's Breakpad processor is very particular about upload conventions. To resolve this issue modify sym file such that the file name is Valentina.sym and the module name (first line of the sym file) as Valentina. --- scripts/symupload.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/scripts/symupload.py b/scripts/symupload.py index 8abaed682..4069cc5fc 100644 --- a/scripts/symupload.py +++ b/scripts/symupload.py @@ -6,6 +6,7 @@ import glob import zipfile import requests import shutil +import re database = "valentina" @@ -35,12 +36,34 @@ def generate_sym_files(install_root): print("No debug files found.") for debug_file in debug_files: - print(f"Generating symbols for: {os.path.basename(debug_file)}") + corrected_debug_name = os.path.basename(debug_file) + debug_dir = os.path.dirname(debug_file) - sym_file = os.path.splitext(debug_file)[0] + ".sym" - dump_syms_cmd = ["dump_syms", '-o', sym_file, '--inlines', debug_file] + if sys.platform == "darwin": + # Remove ".app" if present + corrected_debug_name = corrected_debug_name.replace(".app", "") + # Remove ".framework" if present + corrected_debug_name = corrected_debug_name.replace(".framework", "") + elif platform == "linux": + # Remove .so + version numbers if present (e.g., .so.1.0.0 or .so.2.7.0) + corrected_debug_name = re.sub(r'\.so\.\d+(\.\d+)*', '', corrected_debug_name) + + # Convert to lowercase + corrected_debug_name = corrected_debug_name.lower() + + print(f"Generating symbols for: {corrected_debug_name}") + + # Copy debug file with corrected name + corrected_debug_path = os.path.join(debug_dir, corrected_debug_name) + shutil.copy(debug_file, corrected_debug_path) + + sym_file = os.path.splitext(corrected_debug_name)[0] + ".sym" + dump_syms_cmd = ["dump_syms", '-o', sym_file, '--inlines', corrected_debug_path] subprocess.run(dump_syms_cmd, check=True) + # Remove temporary debug file + os.remove(corrected_debug_path) + sym_files.append((debug_file, sym_file)) return sym_files