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

backtrace_crashpad v0.1.0 (new formula) #152908

Conversation

shraddhaarora
Copy link

@shraddhaarora shraddhaarora commented Oct 31, 2023

Backtrace Crashpad is a fork of Crashpad with file attachment support and other improvements.

This is a fork of the Crashpad project with changes provided by Backtrace I/O, a Sauce Labs Company.

The major differences:

  1. addition of CMake build files, making it possible to use Crashpad as a simple CMake dependency.
  2. support for native Mac OS on M1 ARM builds.
  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

@github-actions github-actions bot added autosquash Automatically squash pull request commits according to Homebrew style. new formula PR adds a new formula to Homebrew/homebrew-core labels Oct 31, 2023
@shraddhaarora
Copy link
Author

Looping in @jviotti @rick-bt @gm4sl

@github-actions
Copy link
Contributor

Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request.

A fork of Crashpad with file attachment support and other improvements
@shraddhaarora shraddhaarora force-pushed the add-backtrace-crashpad-formula branch from 8a9dbca to db44519 Compare October 31, 2023 11:16
# TODO: Add minidump_stackwalk once Backtrace supports it
def install
system "cmake", "-S", ".", "-B", "out", *std_cmake_args
system "cmake", "--build", "out"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no CMake install?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, but maybe @rick-bt @gm4sl would be interesting in addressing this upstream? (we would be happy to send a PR)


depends_on "cmake" => :build

# TODO: Creating iOS variants for the client at some point
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a supported platform for Homebrew though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not even for cross-compilation purposes? i.e. we keep the iOS static library variant if somebody wants to build an iOS app for it?

In any case @shraddhaarora we can probably delete all these TODOs already and just keep internal notes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, and static libraries are generally discouraged in Homebrew since they make no use of security updates by the package manager

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

Comment on lines +50 to +68
cmake_config = <<-EOF
add_library(backtrace::crashpad STATIC IMPORTED)
set_target_properties(backtrace::crashpad PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_LIST_DIR}/../../libbacktrace_crashpad_client.a")
target_include_directories(backtrace::crashpad
INTERFACE "${CMAKE_CURRENT_LIST_DIR}/../../../include/backtrace")
set(BacktraceCrashpad_FOUND TRUE)
EOF
cmake_version_config = <<-EOF
set(PACKAGE_VERSION "#{version}")
if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
if(NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else(NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
EOF
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homebrew formulae should not ship their own configuration. This should either come from upstream or not at all

Copy link
Contributor

@jviotti jviotti Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, interesting. @rick-bt @gm4sl Would you take a PR to generate CMake configs?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jviotti - yes, we would welcome that.

end

test do
system "#{bin}/backtrace_crashpad_handler", "--help"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a test that exercises the some of the functionality of the app. Version checks or usage checks (foo --version or foo --help) are not sufficient, as explained in the formula cookbook.

In most cases, a good test would involve running a simple test case: run #{bin}/foo input.txt.

  • Then you can check that the output is as expected (with assert_equal or assert_match on the output of shell_output)
  • You can also check that an output file was created, if that is expected: assert_predicate testpath/"output.txt", :exist?

Some advice for specific cases:

  • If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.
  • If the formula is for a GUI program, try to find some function that runs as command-line only, like a format conversion, reading or displaying a config file, etc.
  • If the software cannot function without credentials, a test could be to try to connect with invalid credentials (or without credentials) and confirm that it fails as expected.
  • Same if the software requires a virtual machine, docker instance, etc. to be running.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shraddhaarora Let's do the first option:

If the formula is a library, compile and run some simple code that links against it. It could be taken from upstream's documentation / source examples.

@github-actions github-actions bot added the automerge-skip `brew pr-automerge` will skip this pull request label Nov 2, 2023
@SMillerDev
Copy link
Member

Please do not add merge commits to your branch

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 27, 2023
@github-actions github-actions bot closed this Dec 5, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Jan 4, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge-skip `brew pr-automerge` will skip this pull request autosquash Automatically squash pull request commits according to Homebrew style. new formula PR adds a new formula to Homebrew/homebrew-core outdated PR was locked due to age stale No recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants