Failures during ./configure should mention config.log.
This commit is contained in:
parent
914a068dc8
commit
1761ba66bf
@ -205,6 +205,12 @@ class Formula
|
|||||||
onoe e.inspect
|
onoe e.inspect
|
||||||
puts e.backtrace
|
puts e.backtrace
|
||||||
ohai "Rescuing build..."
|
ohai "Rescuing build..."
|
||||||
|
if (e.was_running_configure? rescue false) and File.exist? 'config.log'
|
||||||
|
puts "It looks like an autotools configure failed."
|
||||||
|
puts "Gist 'config.log' and any error output when reporting an issue."
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
|
||||||
puts "When you exit this shell Homebrew will attempt to finalise the installation."
|
puts "When you exit this shell Homebrew will attempt to finalise the installation."
|
||||||
puts "If nothing is installed or the shell exits with a non-zero error code,"
|
puts "If nothing is installed or the shell exits with a non-zero error code,"
|
||||||
puts "Homebrew will abort. The installation prefix is:"
|
puts "Homebrew will abort. The installation prefix is:"
|
||||||
|
@ -44,13 +44,18 @@ RECOMMENDED_GCC_42 = (MACOS_VERSION >= 10.6) ? 5646 : 5577
|
|||||||
|
|
||||||
|
|
||||||
class ExecutionError <RuntimeError
|
class ExecutionError <RuntimeError
|
||||||
attr :exit_status
|
attr :exit_status, :command
|
||||||
|
|
||||||
def initialize cmd, args = [], es = nil
|
def initialize cmd, args = [], es = nil
|
||||||
|
@command = cmd
|
||||||
super "Failure while executing: #{cmd} #{pretty(args)*' '}"
|
super "Failure while executing: #{cmd} #{pretty(args)*' '}"
|
||||||
@exit_status = es.exitstatus rescue 1
|
@exit_status = es.exitstatus rescue 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def was_running_configure?
|
||||||
|
@command == './configure'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def pretty args
|
def pretty args
|
||||||
|
BIN
Library/Homebrew/test/configure_fails.tar.gz
Executable file
BIN
Library/Homebrew/test/configure_fails.tar.gz
Executable file
Binary file not shown.
@ -21,6 +21,18 @@ class TestScriptFileFormula <ScriptFileFormula
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigureTests < Test::Unit::TestCase
|
||||||
|
def test_detect_failed_configure
|
||||||
|
f=ConfigureFails.new
|
||||||
|
begin
|
||||||
|
f.brew { f.install }
|
||||||
|
rescue ExecutionError => e
|
||||||
|
assert e.was_running_configure?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
class InstallTests < Test::Unit::TestCase
|
class InstallTests < Test::Unit::TestCase
|
||||||
def temporary_install f
|
def temporary_install f
|
||||||
# Brew and install the given formula
|
# Brew and install the given formula
|
||||||
|
@ -12,3 +12,18 @@ class TestBall <Formula
|
|||||||
prefix.install "libexec"
|
prefix.install "libexec"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class ConfigureFails <Formula
|
||||||
|
# name parameter required for some Formula::factory
|
||||||
|
def initialize name=nil
|
||||||
|
@url="file:///#{TEST_FOLDER}/configure_fails.tar.gz"
|
||||||
|
@homepage = 'http://example.com/'
|
||||||
|
@version = '1.0.0'
|
||||||
|
@md5 = '9385e1b68ab8af68ac2c35423443159b'
|
||||||
|
super "configurefails"
|
||||||
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
system "./configure"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -26,15 +26,21 @@ at_exit { HOMEBREW_PREFIX.parent.rmtree }
|
|||||||
# Test fixtures and files can be found relative to this path
|
# Test fixtures and files can be found relative to this path
|
||||||
TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath
|
TEST_FOLDER = Pathname.new(ABS__FILE__).parent.realpath
|
||||||
|
|
||||||
|
# Note: These exceptions duplicate those defined in globals.
|
||||||
|
# Perhaps the same definitions should be used in both places.
|
||||||
class ExecutionError <RuntimeError
|
class ExecutionError <RuntimeError
|
||||||
attr :exit_status
|
attr :exit_status, :command
|
||||||
|
|
||||||
def initialize cmd, args = [], es = nil
|
def initialize cmd, args = [], es = nil
|
||||||
|
@command = cmd
|
||||||
super "Failure while executing: #{cmd} #{pretty(args)*' '}"
|
super "Failure while executing: #{cmd} #{pretty(args)*' '}"
|
||||||
@exit_status = es.exitstatus rescue 1
|
@exit_status = es.exitstatus rescue 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def was_running_configure?
|
||||||
|
@command == './configure'
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def pretty args
|
def pretty args
|
||||||
@ -49,6 +55,12 @@ class ExecutionError <RuntimeError
|
|||||||
end
|
end
|
||||||
|
|
||||||
class BuildError <ExecutionError
|
class BuildError <ExecutionError
|
||||||
|
attr :env
|
||||||
|
|
||||||
|
def initialize cmd, args = [], es = nil
|
||||||
|
super
|
||||||
|
@env = ENV.to_hash
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'test/unit' # must be after at_exit
|
require 'test/unit' # must be after at_exit
|
||||||
|
7
bin/brew
7
bin/brew
@ -434,6 +434,13 @@ rescue BuildError => e
|
|||||||
# then replace that string with the following when the github api returns
|
# then replace that string with the following when the github api returns
|
||||||
issues = issues_for_formula(formula_name)
|
issues = issues_for_formula(formula_name)
|
||||||
puts "These existing issues may help you:", *issues unless issues.empty?
|
puts "These existing issues may help you:", *issues unless issues.empty?
|
||||||
|
if e.was_running_configure?
|
||||||
|
puts "It looks like an autotools configure failed."
|
||||||
|
puts "Consider re-running the install with '-vd' to keep 'config.log' around:"
|
||||||
|
puts " brew install -vd formula_name"
|
||||||
|
puts "Gist 'config.log' and any error output when reporting an issue."
|
||||||
|
end
|
||||||
|
puts
|
||||||
puts "Consider running `brew doctor` if a large number of installs are failing."
|
puts "Consider running `brew doctor` if a large number of installs are failing."
|
||||||
exit 1
|
exit 1
|
||||||
rescue RuntimeError, SystemCallError => e
|
rescue RuntimeError, SystemCallError => e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user