formula_installer: set exit code to failed always.

If we say something failed we should communicate that through the exit
code for the bot and scripts.
This commit is contained in:
Mike McQuaid 2014-10-27 13:16:18 +00:00
parent 27c1a67ed6
commit 92e68049d1

View File

@ -524,6 +524,7 @@ class FormulaInstaller
onoe "Failed to create #{f.opt_prefix}" onoe "Failed to create #{f.opt_prefix}"
puts "Things that depend on #{f.name} will probably not build." puts "Things that depend on #{f.name} will probably not build."
puts e puts e
Homebrew.failed = true
end end
return return
end end
@ -544,6 +545,7 @@ class FormulaInstaller
mode = OpenStruct.new(:dry_run => true, :overwrite => true) mode = OpenStruct.new(:dry_run => true, :overwrite => true)
keg.link(mode) keg.link(mode)
@show_summary_heading = true @show_summary_heading = true
Homebrew.failed = true
rescue Keg::LinkError => e rescue Keg::LinkError => e
onoe "The `brew link` step did not complete successfully" onoe "The `brew link` step did not complete successfully"
puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}" puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
@ -552,6 +554,7 @@ class FormulaInstaller
puts "You can try again using:" puts "You can try again using:"
puts " brew link #{f.name}" puts " brew link #{f.name}"
@show_summary_heading = true @show_summary_heading = true
Homebrew.failed = true
rescue Exception => e rescue Exception => e
onoe "An unexpected error occurred during the `brew link` step" onoe "An unexpected error occurred during the `brew link` step"
puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}" puts "The formula built, but is not symlinked into #{HOMEBREW_PREFIX}"
@ -559,6 +562,7 @@ class FormulaInstaller
puts e.backtrace if debug? puts e.backtrace if debug?
@show_summary_heading = true @show_summary_heading = true
ignore_interrupts { keg.unlink } ignore_interrupts { keg.unlink }
Homebrew.failed = true
raise raise
end end
end end
@ -570,6 +574,7 @@ class FormulaInstaller
rescue Exception => e rescue Exception => e
onoe "Failed to install plist file" onoe "Failed to install plist file"
ohai e, e.backtrace if debug? ohai e, e.backtrace if debug?
Homebrew.failed = true
end end
def fix_install_names(keg) def fix_install_names(keg)
@ -584,6 +589,7 @@ class FormulaInstaller
puts "The formula built, but you may encounter issues using it or linking other" puts "The formula built, but you may encounter issues using it or linking other"
puts "formula against it." puts "formula against it."
ohai e, e.backtrace if debug? ohai e, e.backtrace if debug?
Homebrew.failed = true
@show_summary_heading = true @show_summary_heading = true
end end
@ -594,6 +600,7 @@ class FormulaInstaller
opoo "The cleaning step did not complete successfully" opoo "The cleaning step did not complete successfully"
puts "Still, the installation was successful, so we will link it into your prefix" puts "Still, the installation was successful, so we will link it into your prefix"
ohai e, e.backtrace if debug? ohai e, e.backtrace if debug?
Homebrew.failed = true
@show_summary_heading = true @show_summary_heading = true
end end
@ -603,6 +610,7 @@ class FormulaInstaller
opoo "The post-install step did not complete successfully" opoo "The post-install step did not complete successfully"
puts "You can try again using `brew postinstall #{f.name}`" puts "You can try again using `brew postinstall #{f.name}`"
ohai e, e.backtrace if debug? ohai e, e.backtrace if debug?
Homebrew.failed = true
@show_summary_heading = true @show_summary_heading = true
end end