aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2012-03-06 18:08:16 +0000
committerMax Howell2012-03-16 21:06:16 +0000
commit126cc9fa15f1211f9f38eb68a9f8b7984682a1e2 (patch)
tree2fa3301489c7b871bbedc3ce1faf9236c4128841 /Library/Homebrew
parentf8e70f93c3f153b145e03765f77320ff3da64dde (diff)
downloadhomebrew-126cc9fa15f1211f9f38eb68a9f8b7984682a1e2.tar.bz2
Concise --config output for build errors
Rationale, lets only pay attention to the output when it matters. Speeding up diagnosis.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/--config.rb31
-rw-r--r--Library/Homebrew/exceptions.rb14
2 files changed, 36 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb
index 1d74bebf5..da146ac89 100644
--- a/Library/Homebrew/cmd/--config.rb
+++ b/Library/Homebrew/cmd/--config.rb
@@ -76,14 +76,41 @@ module Homebrew extend self
Pathname.new(a_path).realpath.to_s
end
+ def hardware
+ "CPU: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family}"
+ end
+
+ def kernel
+ `uname -m`.chomp
+ end
+
+ # we try to keep output minimal
+ def dump_build_config
+ puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" if HOMEBREW_PREFIX.to_s != "/usr/local"
+ puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" if HOMEBREW_CELLAR.to_s != "#{HOMEBREW_PREFIX}/Cellar"
+ puts hardware
+ puts "MacOS: #{MACOS_FULL_VERSION}-#{kernel}"
+ puts "Xcode: #{xcode_version}"
+ puts "/usr/bin/ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" if RUBY_VERSION.to_f != 1.8
+
+ ruby = Pathname.new("/usr/bin/ruby")
+ puts "/usr/bin/ruby => #{ruby.realpath}" unless ruby.realpath.to_s =~ %r{^/System}
+
+ ponk = macports_or_fink_installed?
+ puts "MacPorts/Fink: #{ponk?}" if ponk
+
+ x11 = describe_x11
+ puts "X11: #{x11}" unless x11 == "/usr/X11"
+ end
+
def config_s; <<-EOS.undent
HOMEBREW_VERSION: #{HOMEBREW_VERSION}
HEAD: #{sha}
HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}
HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}
- Hardware: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family}
+ #{hardware}
OS X: #{MACOS_FULL_VERSION}
- Kernel Architecture: #{`uname -m`.chomp}
+ Kernel Architecture: #{kernel}
Xcode: #{xcode_version}
GCC-4.0: #{gcc_40 ? "build #{gcc_40}" : "N/A"}
GCC-4.2: #{gcc_42 ? "build #{gcc_42}" : "N/A"}
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 9929d37bc..0d55336d1 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -98,17 +98,17 @@ class BuildError < Homebrew::InstallationError
issues_url = ISSUES_URL
end
- ohai "Exit Status: #{e.exit_status}"
- puts "https://github.com/#{repo}/blob/master/#{repo_path}/#{formula_name}.rb#L#{error_line}"
- ohai "Environment"
- puts Homebrew.config_s
- ohai "Build Flags"
+ if ARGV.verbose?
+ ohai "Exit Status: #{e.exit_status}"
+ puts "https://github.com/#{repo}/blob/master/#{repo_path}/#{formula_name}.rb#L#{error_line}"
+ end
+ ohai "Build Environment"
+ Homebrew.dump_build_config
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
+ onoe "#{e.to_s.strip} (#{formula_name}.rb:#{error_line})"
issues = GitHub.issues_for_formula formula_name
if issues.empty?
puts "If `brew doctor' does not help diagnose the issue, please report the bug:"