Add a snapshot of ENV to BuildError and show some flags with the stack trace.
This commit is contained in:
parent
07934ce3ab
commit
485d480722
@ -60,4 +60,10 @@ class ExecutionError <RuntimeError
|
||||
end
|
||||
|
||||
class BuildError <ExecutionError
|
||||
attr :env
|
||||
|
||||
def initialize cmd, args = [], es = nil
|
||||
super
|
||||
@env = ENV.to_hash
|
||||
end
|
||||
end
|
||||
|
||||
16
bin/brew
16
bin/brew
@ -66,6 +66,12 @@ X11 installed? #{x11_installed?}
|
||||
EOS
|
||||
end
|
||||
|
||||
def dump_build_env env
|
||||
%w[CC CXX LD CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MAKEFLAGS].each do |k|
|
||||
puts "#{k}: #{env[k]}"
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
require 'brew.h'
|
||||
|
||||
@ -374,10 +380,16 @@ rescue Interrupt => e
|
||||
rescue BuildError => e
|
||||
e.backtrace[1] =~ %r{Library/Formula/(.+)\.rb:(\d+)}
|
||||
formula_name = $1
|
||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{$2}"
|
||||
error_line = $2
|
||||
puts "Exit status: #{e.exit_status}"
|
||||
puts
|
||||
puts "http://github.com/mxcl/homebrew/blob/master/Library/Formula/#{formula_name}.rb#L#{error_line}"
|
||||
puts
|
||||
ohai "Environment"
|
||||
dump_config
|
||||
puts "Exit status: #{e.exit_status}"
|
||||
puts
|
||||
ohai "Build Flags"
|
||||
dump_build_env e.env
|
||||
onoe e
|
||||
puts PLEASE_REPORT_BUG
|
||||
# this feature can be slow (depends on network conditions and if github is up)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user