Don't cleanup if we can't tell which formula is for keeps

If the formula was updated and not yet installed, then cleanup would delete all kegs. Which is most likely not what the user wanted.

Ideally we'd do a version check to figure out which keg is newest. But we don't yet have a function that can determine with accuracy version order.
This commit is contained in:
Max Howell 2010-01-18 08:26:25 +00:00
parent 16132cab6b
commit f88fbf1882

View File

@ -250,6 +250,9 @@ def cleanup name
f = Formula.factory name f = Formula.factory name
# we can't tell which one to keep in this circumstance
raise "The most recent version of #{name} is not installed" unless f.installed?
if f.prefix.parent.directory? if f.prefix.parent.directory?
kids = f.prefix.parent.children kids = f.prefix.parent.children
kids.each do |keg| kids.each do |keg|