Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sentry-breakpad] Replace _patch_sources by patches #19092

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions recipes/sentry-breakpad/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,54 @@
"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/0001-remove-third-pary-lss.patch"
base_path: "external/breakpad"

Check notice on line 20 in recipes/sentry-breakpad/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/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/0001-remove-third-pary-lss.patch"
base_path: "external/breakpad"

Check notice on line 30 in recipes/sentry-breakpad/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/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/0001-remove-third-pary-lss.patch"
base_path: "external/breakpad"

Check notice on line 40 in recipes/sentry-breakpad/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/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/0001-remove-third-pary-lss.patch"
base_path: "external/breakpad"

Check notice on line 50 in recipes/sentry-breakpad/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
MartinDelille marked this conversation as resolved.
Show resolved Hide resolved
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/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/0001-remove-third-pary-lss.patch"
base_path: "external/breakpad"

Check notice on line 60 in recipes/sentry-breakpad/all/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml v2 migration suggestion

'base_path' should not be required once a recipe has been upgraded to take advantage of layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)
patch_description: "Remove third party lss from include"
patch_type: "conan"
patch_source: "https://github.com/getsentry/breakpad/pull/37"
- patch_file: "patches/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
Loading