Pass debug? to Formula#brew and Formula#run_test.

This commit is contained in:
Markus Reiter 2020-08-02 03:32:05 +02:00
parent 75a692d08b
commit 5caafe413e
4 changed files with 7 additions and 7 deletions

View File

@ -139,7 +139,7 @@ class Build
formula.update_head_version
formula.brew(fetch: false, keep_tmp: args.keep_tmp?, interactive: args.interactive?) do |_formula, _staging|
formula.brew(fetch: false, keep_tmp: args.keep_tmp?, interactive: args.interactive?, debug: args.debug?) do
# For head builds, HOMEBREW_FORMULA_PREFIX should include the commit,
# which is not known until after the formula has been staged.
ENV["HOMEBREW_FORMULA_PREFIX"] = formula.prefix

View File

@ -57,7 +57,7 @@ module Homebrew
# show messages about tar
with_env VERBOSE: "1" do
f.brew do
f.brew(debug: args.debug?) do
f.patch if args.patch?
cp_r getwd, stage_dir, preserve: true
end

View File

@ -1170,7 +1170,7 @@ class Formula
# yields |self,staging| with current working directory set to the uncompressed tarball
# where staging is a Mktemp staging context
# @private
def brew(fetch: true, keep_tmp: false, interactive: false)
def brew(fetch: true, keep_tmp: false, interactive: false, debug: false)
@prefix_returns_versioned_prefix = true
active_spec.fetch if fetch
stage(interactive: interactive) do |staging|
@ -1182,7 +1182,7 @@ class Formula
begin
yield self, staging
rescue
staging.retain! if interactive || Homebrew.args.debug?
staging.retain! if interactive || debug
raise
ensure
cp Dir["config.log", "CMakeCache.txt"], logs
@ -1803,7 +1803,7 @@ class Formula
end
# @private
def run_test(keep_tmp: false)
def run_test(keep_tmp: false, debug: false)
@prefix_returns_versioned_prefix = true
test_env = {
@ -1831,7 +1831,7 @@ class Formula
end
end
rescue Exception # rubocop:disable Lint/RescueException
staging.retain! if Homebrew.args.debug?
staging.retain! if debug
raise
end
end

View File

@ -34,7 +34,7 @@ begin
# tests can also return false to indicate failure
Timeout.timeout TEST_TIMEOUT_SECONDS do
raise "test returned false" if formula.run_test(keep_tmp: args.keep_tmp?) == false
raise "test returned false" if formula.run_test(keep_tmp: args.keep_tmp?, debug: args.debug?) == false
end
rescue Exception => e # rubocop:disable Lint/RescueException
error_pipe.puts e.to_json