Skip to content

Commit

Permalink
Cleanup dsym directory after sending to sentry
Browse files Browse the repository at this point in the history
Otherwise, this directory contains an almost-similar .dylib file, which is sometimes picked by pyinstaller instead of the proper library, and will create an unrunnable application.
  • Loading branch information
wawanbreton committed Jan 27, 2025
1 parent 5e6e7ae commit 24233a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions recipes/sentrylibrary/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,25 @@ def send_sentry_debug_files(self, binary_basename):
extension = "a"
binary_name = f"{binary_basename}.{extension}"

cleanup_steps = []

if self.settings.os == "Linux":
self.output.info("Stripping debug symbols from binary")
self.run(f"objcopy --only-keep-debug --compress-debug-sections=zlib {binary_name} {binary_name}.debug")
self.run(f"objcopy --strip-debug --strip-unneeded {binary_name}")
self.run(f"objcopy --add-gnu-debuglink={binary_name}.debug {binary_name}")
elif self.settings.os == "Macos":
self.run(f"dsymutil {binary_name}")
cleanup_steps.append(f"rm -rf {binary_name}.dSYM") # Cleanup dsym directory after sending, other pyinstaller may pick it instead

self.output.info("Uploading debug symbols to sentry")
build_source_dir = Path(self.build_folder).parent.parent.as_posix()
sentry_auth = f"--auth-token {sentry_token} -o {sentry_organization} -p {sentry_project}"
self.run(f"sentry-cli debug-files upload --include-sources {build_source_dir} {sentry_auth}")

for cleanup_step in cleanup_steps:
self.run(cleanup_step)

if self.options.sentry_create_release:
sentry_version = self.version
if self._sentry_environment() != "production":
Expand Down

0 comments on commit 24233a1

Please sign in to comment.