aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-08-10 16:04:56 -0400
committerMax Howell2012-08-13 10:14:59 -0400
commit3c8ed1a5c01f09ef5f603082a9e244bd40d1266d (patch)
tree13f12b21d584500e90573304ec0decaaa763651f /Library
parentb96bd9ac3b16d515d5756aaf8b17c3e35ba9a5ec (diff)
downloadhomebrew-3c8ed1a5c01f09ef5f603082a9e244bd40d1266d.tar.bz2
Uninstall keg if error during build & tab creation
Previously if error occurred in code around the logic you'd get a keg that is installed without a tab, which breaks brew.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/build.rb6
-rw-r--r--Library/Homebrew/formula_installer.rb19
2 files changed, 16 insertions, 9 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index 5a7fee4fa..894c6b4e9 100755
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -111,10 +111,4 @@ def install f
end
end
end
-rescue Exception
- if f.prefix.directory?
- f.prefix.rmtree
- f.rack.rmdir_if_possible
- end
- raise
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 949fbdcc4..97ab036f6 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -119,7 +119,7 @@ class FormulaInstaller
clean
end
- raise "Nothing was installed to #{f.prefix}" unless f.installed?
+ opoo "Nothing was installed to #{f.prefix}" unless f.installed?
end
def install_dependency dep
@@ -240,10 +240,23 @@ class FormulaInstaller
data = read.read
raise Marshal.load(data) unless data.nil? or data.empty?
raise "Suspicious installation failure" unless $?.success?
+ end
+
+ # This is the installation receipt. The reason this comment is necessary
+ # is because some numpty decided to call the class Tab rather than
+ # the far more appropriate InstallationReceipt :P
+ Tab.for_install(f, args).write
- # Write an installation receipt (a Tab) to the prefix
- Tab.for_install(f, args).write if f.installed?
+ rescue Exception => e
+ ignore_interrupts do
+ # any exceptions must leave us with nothing installed
+ if f.prefix.directory?
+ puts "One sec, just cleaning up..." if e.kind_of? Interrupt
+ f.prefix.rmtree
+ end
+ f.rack.rmdir_if_possible
end
+ raise
end
def link