use ofail to set Homebrew.failed

This commit is contained in:
EricFromCanada 2020-07-29 19:41:39 -04:00
parent 571179ff0e
commit f5e1557154
4 changed files with 9 additions and 17 deletions

View File

@ -57,8 +57,7 @@ module Homebrew
methods.each do |method|
$stderr.puts Formatter.headline("Checking #{method}", color: :magenta) if args.debug?
unless checks.respond_to?(method)
Homebrew.failed = true
puts "No check available by the name: #{method}"
ofail "No check available by the name: #{method}"
next
end

View File

@ -150,8 +150,8 @@ module Homebrew
def fetch_patch(p, args:)
fetch_fetchable p, args: args
rescue ChecksumMismatchError => e
Homebrew.failed = true
opoo "Patch reports different sha256: #{e.expected}"
Homebrew.failed = true
end
def retry_fetch?(f, args:)

View File

@ -951,10 +951,9 @@ class FormulaInstaller
begin
keg.optlink(verbose: verbose?)
rescue Keg::LinkError => e
onoe "Failed to create #{formula.opt_prefix}"
ofail "Failed to create #{formula.opt_prefix}"
puts "Things that depend on #{formula.full_name} will probably not build."
puts e
Homebrew.failed = true
end
return
end
@ -991,25 +990,23 @@ class FormulaInstaller
link_overwrite_backup[conflict_file] = backup_file
retry
end
onoe "The `brew link` step did not complete successfully"
ofail "The `brew link` step did not complete successfully"
puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
puts e
puts
puts "Possible conflicting files are:"
keg.link(dry_run: true, overwrite: true, verbose: verbose?)
@show_summary_heading = true
Homebrew.failed = true
rescue Keg::LinkError => e
onoe "The `brew link` step did not complete successfully"
ofail "The `brew link` step did not complete successfully"
puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
puts e
puts
puts "You can try again using:"
puts " brew link #{formula.name}"
@show_summary_heading = true
Homebrew.failed = true
rescue Exception => e # rubocop:disable Lint/RescueException
onoe "An unexpected error occurred during the `brew link` step"
ofail "An unexpected error occurred during the `brew link` step"
puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
puts e
puts e.backtrace if debug?
@ -1021,7 +1018,6 @@ class FormulaInstaller
FileUtils.mv backup, origin
end
end
Homebrew.failed = true
raise
end
@ -1043,20 +1039,18 @@ class FormulaInstaller
log = formula.var/"log"
log.mkpath if formula.plist.include? log.to_s
rescue Exception => e # rubocop:disable Lint/RescueException
onoe "Failed to install plist file"
ofail "Failed to install plist file"
odebug e, e.backtrace
Homebrew.failed = true
end
sig { params(keg: Keg).void }
def fix_dynamic_linkage(keg)
keg.fix_dynamic_linkage
rescue Exception => e # rubocop:disable Lint/RescueException
onoe "Failed to fix install linkage"
ofail "Failed to fix install linkage"
puts "The formula built, but you may encounter issues using it or linking other"
puts "formulae against it."
odebug e, e.backtrace
Homebrew.failed = true
@show_summary_heading = true
end

View File

@ -36,8 +36,7 @@ module Homebrew
upgrade_formula(f, args: args)
Cleanup.install_formula_clean!(f)
rescue UnsatisfiedRequirements => e
Homebrew.failed = true
onoe "#{f}: #{e}"
ofail "#{f}: #{e}"
end
end
end