mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Move brew output for BuildError into BuildError
So upgrade can output errors but continue to upgrade the rest of the installation.
This commit is contained in:
parent
735b6337a1
commit
15a70c36d0
@ -121,6 +121,42 @@ class BuildError < Homebrew::InstallationError
|
||||
def was_running_configure?
|
||||
@command == './configure'
|
||||
end
|
||||
|
||||
def dump
|
||||
e = self
|
||||
|
||||
require 'cmd/--config'
|
||||
require 'cmd/--env'
|
||||
|
||||
e.backtrace[1] =~ %r{Library/Formula/(.+)\.rb:(\d+)}
|
||||
formula_name = $1
|
||||
error_line = $2
|
||||
|
||||
ohai "Exit Status: #{e.exit_status}"
|
||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{error_line}"
|
||||
ohai "Environment"
|
||||
puts Homebrew.config_s
|
||||
ohai "Build Flags"
|
||||
puts %["--use-clang" was specified] if ARGV.include? '--use-clang'
|
||||
puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
|
||||
puts %["--use-gcc" was specified] if ARGV.include? '--use-gcc'
|
||||
Homebrew.dump_build_env e.env
|
||||
puts
|
||||
onoe e
|
||||
issues = GitHub.issues_for_formula formula_name
|
||||
if issues.empty?
|
||||
puts "If `brew doctor' does not help diagnose the issue, please report the bug:"
|
||||
puts " #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
|
||||
else
|
||||
puts "These existing issues may help you:", *issues.map{ |s| " #{Tty.em}#{s}#{Tty.reset}" }
|
||||
puts "Otherwise, please report the bug:"
|
||||
puts " #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
|
||||
end
|
||||
if e.was_running_configure?
|
||||
puts "We saved the configure log, please gist it if you report the issue:"
|
||||
puts " ~/Library/Logs/Homebrew/config.log"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# raised in CurlDownloadStrategy.fetch
|
||||
|
32
bin/brew
32
bin/brew
@ -106,37 +106,7 @@ rescue Interrupt => e
|
||||
puts # seemingly a newline is typical
|
||||
exit 130
|
||||
rescue BuildError => e
|
||||
require 'cmd/--config'
|
||||
require 'cmd/--env'
|
||||
|
||||
e.backtrace[1] =~ %r{Library/Formula/(.+)\.rb:(\d+)}
|
||||
formula_name = $1
|
||||
error_line = $2
|
||||
|
||||
ohai "Exit Status: #{e.exit_status}"
|
||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{error_line}"
|
||||
ohai "Environment"
|
||||
puts Homebrew.config_s
|
||||
ohai "Build Flags"
|
||||
puts %["--use-clang" was specified] if ARGV.include? '--use-clang'
|
||||
puts %["--use-llvm" was specified] if ARGV.include? '--use-llvm'
|
||||
puts %["--use-gcc" was specified] if ARGV.include? '--use-gcc'
|
||||
Homebrew.dump_build_env e.env
|
||||
puts
|
||||
onoe e
|
||||
issues = GitHub.issues_for_formula formula_name
|
||||
if issues.empty?
|
||||
puts "If `brew doctor' does not help diagnose the issue, please report the bug:"
|
||||
puts " #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
|
||||
else
|
||||
puts "These existing issues may help you:", *issues.map{ |s| " #{Tty.em}#{s}#{Tty.reset}" }
|
||||
puts "Otherwise, please report the bug:"
|
||||
puts " #{Tty.em}#{ISSUES_URL}#{Tty.reset}"
|
||||
end
|
||||
if e.was_running_configure?
|
||||
puts "We saved the configure log, please gist it if you report the issue:"
|
||||
puts " ~/Library/Logs/Homebrew/config.log"
|
||||
end
|
||||
e.dump
|
||||
exit 1
|
||||
rescue RuntimeError, SystemCallError => e
|
||||
onoe e
|
||||
|
Loading…
x
Reference in New Issue
Block a user