Skip to content

Commit

Permalink
(#19092) [sentry-breakpad] Replace _patch_sources by patches
Browse files Browse the repository at this point in the history
* [sentry-breakpad] Convert to patches

* Remove second patch

* Fix breakpad patch

* Remove base_path in other versions

* Fix patches for all versions
  • Loading branch information
MartinDelille authored Aug 9, 2023
1 parent 6a5d58e commit ece3a9e
Show file tree
Hide file tree
Showing 8 changed files with 893 additions and 79 deletions.
46 changes: 46 additions & 0 deletions recipes/sentry-breakpad/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,49 @@ sources:
"0.4.18":
url: "https://github.com/getsentry/sentry-native/releases/download/0.4.18/sentry-native.zip"
sha256: "41fdf6499cd8576142beb03104badcc9e0b80b8ef27080ca71cd4408cc1d7ece"
patches:
"0.6.5":
- patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch"
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/0.6.x-0002-install-breakpad-header.patch"
patch_description: "Install breakpad header"
patch_type: "conan"
patch_source: "https://github.com/getsentry/sentry-native/pull/872"
"0.6.4":
- patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch"
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/0.6.x-0002-install-breakpad-header.patch"
patch_description: "Install breakpad header"
patch_type: "conan"
patch_source: "https://github.com/getsentry/sentry-native/pull/872"
"0.6.3":
- patch_file: "patches/0.6.x-0001-remove-third-pary-lss.patch"
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/0.6.x-0002-install-breakpad-header.patch"
patch_description: "Install breakpad header"
patch_type: "conan"
patch_source: "https://github.com/getsentry/sentry-native/pull/872"
"0.5.4":
- patch_file: "patches/0.5.4-0001-remove-third-pary-lss.patch"
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/0.5.4-0002-install-breakpad-header.patch"
patch_description: "Install breakpad header"
patch_type: "conan"
patch_source: "https://github.com/getsentry/sentry-native/pull/872"
"0.4.18":
- patch_file: "patches/0.4.18-0001-remove-third-pary-lss.patch"
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/0.4.18-0002-install-breakpad-header.patch"
patch_description: "Install breakpad header"
patch_type: "conan"
patch_source: "https://github.com/getsentry/sentry-native/pull/872"
83 changes: 4 additions & 79 deletions recipes/sentry-breakpad/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, replace_in_file, save
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
from conan.tools.scm import Version
import os

Expand Down Expand Up @@ -43,6 +43,7 @@ def _compilers_minimum_version(self):

def export_sources(self):
copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder)
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -54,7 +55,7 @@ def layout(self):
def requirements(self):
if self.settings.os in ("FreeBSD", "Linux"):
# linux-syscal-support is a public dependency
# see https://github.com/conan-io/conan-center-index/pull/16752#issuecomment-1487241864
# see https://github.com/conan-io/conan-center-index/pull/16752#issuecomment-1487241864
self.requires("linux-syscall-support/cci.20200813", transitive_headers=True)

def validate(self):
Expand All @@ -75,84 +76,8 @@ def generate(self):
tc.variables["LINUX"] = True
tc.generate()

def _patch_sources(self):
# FIXME: convert to patches
import textwrap

files_to_patch = [
# "src/tools/linux/md2core/minidump-2-core.cc",
# "src/processor/testdata/linux_test_app.cc",
"src/common/memory_allocator.h",
"src/common/linux/memory_mapped_file.cc",
"src/common/linux/file_id.cc",
"src/common/linux/safe_readlink.cc",
"src/client/minidump_file_writer.cc",
"src/client/linux/handler/exception_handler.cc",
"src/client/linux/handler/exception_handler_unittest.cc",
"src/client/linux/log/log.cc",
"src/client/linux/crash_generation/crash_generation_client.cc",
"src/client/linux/minidump_writer/linux_dumper.cc",
"src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc",
"src/client/linux/minidump_writer/proc_cpuinfo_reader.h",
"src/client/linux/minidump_writer/minidump_writer.cc",
"src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
"src/client/linux/minidump_writer/cpu_set.h",
"src/client/linux/minidump_writer/directory_reader.h",
"src/client/linux/minidump_writer/line_reader.h"
]

for file in files_to_patch:
replace_in_file(self,
os.path.join(self.source_folder, "external", "breakpad", file),
"#include \"third_party/lss/linux_syscall_support.h\"",
"#include <linux_syscall_support.h>"
)

save(self, os.path.join(self.source_folder, "external", "CMakeLists.txt"),
textwrap.dedent("""\
target_compile_features(breakpad_client PUBLIC cxx_std_11)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
find_path(LINUX_SYSCALL_INCLUDE_DIR NAMES linux_syscall_support.h)
target_include_directories(breakpad_client PRIVATE ${LINUX_SYSCALL_INCLUDE_DIR})
endif()
install(TARGETS breakpad_client
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
file(GLOB COMMON_FILES breakpad/src/common/*.h)
install(FILES ${COMMON_FILES}
DESTINATION include/breakpad/common
)
set(PLATFORM_FOLDER)
if(IOS)
set(PLATFORM_FOLDER ios)
elseif(APPLE)
set(PLATFORM_FOLDER mac)
elseif(UNIX)
set(PLATFORM_FOLDER linux)
endif()
if(WIN32)
set(PLATFORM_FOLDER windows)
endif()
if(NOT PLATFORM_FOLDER)
message(FATAL_ERROR "Unknown os -> don't know how to install headers")
endif()
file(GLOB COMMON_PLATFORM_HEADERS breakpad/src/common/${PLATFORM_FOLDER}/*.h)
install(FILES ${COMMON_PLATFORM_HEADERS}
DESTINATION include/breakpad/common/${PLATFORM_FOLDER})
install(DIRECTORY breakpad/src/client/${PLATFORM_FOLDER}
DESTINATION include/breakpad/client
FILES_MATCHING PATTERN *.h
)
install(DIRECTORY breakpad/src/google_breakpad/common
DESTINATION include/breakpad/google_breakpad
FILES_MATCHING PATTERN *.h
)
"""), append=True)

def build(self):
self._patch_sources()
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.build()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
commit a9d52d999e0450a2f6b7ca24b245e718ab537cec
Author: Martin Delille <martin@delille.org>
Date: Tue Aug 8 11:59:04 2023 +0200

Remove third_party/lss

diff --git a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
index d8bfbbad..b7b43cff 100644
--- a/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
+++ b/external/breakpad/src/client/linux/crash_generation/crash_generation_client.cc
@@ -37,7 +37,7 @@

#include "common/linux/eintr_wrapper.h"
#include "common/linux/ignore_ret.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/client/linux/handler/exception_handler.cc b/external/breakpad/src/client/linux/handler/exception_handler.cc
index 499be0a9..d6c3ba71 100644
--- a/external/breakpad/src/client/linux/handler/exception_handler.cc
+++ b/external/breakpad/src/client/linux/handler/exception_handler.cc
@@ -95,7 +95,7 @@
#include "client/linux/minidump_writer/linux_dumper.h"
#include "client/linux/minidump_writer/minidump_writer.h"
#include "common/linux/eintr_wrapper.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

#if defined(__ANDROID__)
#include "linux/sched.h"
diff --git a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc
index 35dcbfd4..21647998 100644
--- a/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc
+++ b/external/breakpad/src/client/linux/handler/exception_handler_unittest.cc
@@ -50,7 +50,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/tests/auto_tempdir.h"
#include "common/using_std_string.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"
#include "google_breakpad/processor/minidump.h"

using namespace google_breakpad;
diff --git a/external/breakpad/src/client/linux/log/log.cc b/external/breakpad/src/client/linux/log/log.cc
index 31879409..072377ed 100644
--- a/external/breakpad/src/client/linux/log/log.cc
+++ b/external/breakpad/src/client/linux/log/log.cc
@@ -33,7 +33,7 @@
#include <android/log.h>
#include <dlfcn.h>
#else
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"
#endif

namespace logger {
diff --git a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h
index 1cca9aa5..50f83d8c 100644
--- a/external/breakpad/src/client/linux/minidump_writer/cpu_set.h
+++ b/external/breakpad/src/client/linux/minidump_writer/cpu_set.h
@@ -35,7 +35,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h
index a4bde180..e1c69a23 100644
--- a/external/breakpad/src/client/linux/minidump_writer/directory_reader.h
+++ b/external/breakpad/src/client/linux/minidump_writer/directory_reader.h
@@ -38,7 +38,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/client/linux/minidump_writer/line_reader.h b/external/breakpad/src/client/linux/minidump_writer/line_reader.h
index 9fc4b7cc..cf75dfe0 100644
--- a/external/breakpad/src/client/linux/minidump_writer/line_reader.h
+++ b/external/breakpad/src/client/linux/minidump_writer/line_reader.h
@@ -35,7 +35,7 @@
#include <string.h>

#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
index 44430c4e..a702ee68 100644
--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
+++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper.cc
@@ -51,7 +51,7 @@
#include "common/linux/memory_mapped_file.h"
#include "common/linux/safe_readlink.h"
#include "google_breakpad/common/minidump_exception_linux.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

using google_breakpad::elf::FileID;

diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
index 331f4bb3..c4c5bd42 100644
--- a/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
+++ b/external/breakpad/src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
@@ -39,7 +39,7 @@
#include <unistd.h>

#include "common/scoped_ptr.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

#if defined(__ARM_EABI__)
#define TID_PTR_REGISTER "r3"
diff --git a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
index e3ddb81a..6712af94 100644
--- a/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
+++ b/external/breakpad/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
@@ -57,7 +57,7 @@
#include "client/linux/minidump_writer/directory_reader.h"
#include "client/linux/minidump_writer/line_reader.h"
#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

// Suspends a thread by attaching to it.
static bool SuspendThread(pid_t pid) {
diff --git a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
index 7ce9ac57..4d9f1e21 100644
--- a/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
+++ b/external/breakpad/src/client/linux/minidump_writer/minidump_writer.cc
@@ -79,7 +79,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/minidump_type_helper.h"
#include "google_breakpad/common/minidump_format.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace {

diff --git a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h
index d9461bf3..a915a88b 100644
--- a/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h
+++ b/external/breakpad/src/client/linux/minidump_writer/proc_cpuinfo_reader.h
@@ -36,7 +36,7 @@

#include "client/linux/minidump_writer/line_reader.h"
#include "common/linux/linux_libc_support.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/client/minidump_file_writer.cc b/external/breakpad/src/client/minidump_file_writer.cc
index 5c3c5cbb..6b0e2dd0 100644
--- a/external/breakpad/src/client/minidump_file_writer.cc
+++ b/external/breakpad/src/client/minidump_file_writer.cc
@@ -41,7 +41,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/string_conversion.h"
#if defined(__linux__) && __linux__
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"
#endif

#if defined(__ANDROID__)
diff --git a/external/breakpad/src/common/linux/file_id.cc b/external/breakpad/src/common/linux/file_id.cc
index b483eb5c..eff1e8ce 100644
--- a/external/breakpad/src/common/linux/file_id.cc
+++ b/external/breakpad/src/common/linux/file_id.cc
@@ -46,7 +46,7 @@
#include "common/linux/linux_libc_support.h"
#include "common/linux/memory_mapped_file.h"
#include "common/using_std_string.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {
namespace elf {
diff --git a/external/breakpad/src/common/linux/memory_mapped_file.cc b/external/breakpad/src/common/linux/memory_mapped_file.cc
index 99362945..efaae8ec 100644
--- a/external/breakpad/src/common/linux/memory_mapped_file.cc
+++ b/external/breakpad/src/common/linux/memory_mapped_file.cc
@@ -40,7 +40,7 @@
#include <unistd.h>

#include "common/memory_range.h"
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/common/linux/safe_readlink.cc b/external/breakpad/src/common/linux/safe_readlink.cc
index 870c28af..37872b5b 100644
--- a/external/breakpad/src/common/linux/safe_readlink.cc
+++ b/external/breakpad/src/common/linux/safe_readlink.cc
@@ -32,7 +32,7 @@

#include <stddef.h>

-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"

namespace google_breakpad {

diff --git a/external/breakpad/src/common/memory_allocator.h b/external/breakpad/src/common/memory_allocator.h
index d28fbfc3..fbf8c977 100644
--- a/external/breakpad/src/common/memory_allocator.h
+++ b/external/breakpad/src/common/memory_allocator.h
@@ -47,7 +47,7 @@
#define sys_munmap munmap
#define MAP_ANONYMOUS MAP_ANON
#else
-#include "third_party/lss/linux_syscall_support.h"
+#include "linux_syscall_support.h"
#endif

namespace google_breakpad {
Loading

0 comments on commit ece3a9e

Please sign in to comment.