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.
This commit is contained in:
parent
28ee57aa3c
commit
88e79a9098
@ -111,10 +111,4 @@ def install f
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue Exception
|
|
||||||
if f.prefix.directory?
|
|
||||||
f.prefix.rmtree
|
|
||||||
f.rack.rmdir_if_possible
|
|
||||||
end
|
|
||||||
raise
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -119,7 +119,7 @@ class FormulaInstaller
|
|||||||
clean
|
clean
|
||||||
end
|
end
|
||||||
|
|
||||||
raise "Nothing was installed to #{f.prefix}" unless f.installed?
|
opoo "Nothing was installed to #{f.prefix}" unless f.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_dependency dep
|
def install_dependency dep
|
||||||
@ -240,10 +240,23 @@ class FormulaInstaller
|
|||||||
data = read.read
|
data = read.read
|
||||||
raise Marshal.load(data) unless data.nil? or data.empty?
|
raise Marshal.load(data) unless data.nil? or data.empty?
|
||||||
raise "Suspicious installation failure" unless $?.success?
|
raise "Suspicious installation failure" unless $?.success?
|
||||||
|
|
||||||
# Write an installation receipt (a Tab) to the prefix
|
|
||||||
Tab.for_install(f, args).write if f.installed?
|
|
||||||
end
|
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
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
def link
|
def link
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user