brew cleanup: don't remove higher version kegs.
* Use version compare to only remove kegs with lower version than the
current one, not higher version which might be from someone's
branch.
* Do the same for cache cleanup.
- Be conservative so that if a name detected from cache file is not
the same as its formula then don't clean it.
Closes Homebrew/homebrew#15914.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
9c294364c6
commit
2a1ec18ff9
@ -33,7 +33,7 @@ module Homebrew extend self
|
|||||||
|
|
||||||
if f.installed? and f.rack.directory?
|
if f.installed? and f.rack.directory?
|
||||||
f.rack.children.each do |keg|
|
f.rack.children.each do |keg|
|
||||||
if f.installed_prefix != keg
|
if f.version > Keg.new(keg).version
|
||||||
if f.can_cleanup?
|
if f.can_cleanup?
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "Would remove: #{keg}"
|
puts "Would remove: #{keg}"
|
||||||
@ -61,7 +61,7 @@ module Homebrew extend self
|
|||||||
if name and version
|
if name and version
|
||||||
f = Formula.factory(name) rescue nil
|
f = Formula.factory(name) rescue nil
|
||||||
old_bottle = bottle_file_outdated? f, pn
|
old_bottle = bottle_file_outdated? f, pn
|
||||||
if not f or (f.version != version or ARGV.switch? "s" and not f.installed?) or old_bottle
|
if (f and f.version > version) or (ARGV.switch? "s" and (f and (not f.installed?))) or old_bottle
|
||||||
if ARGV.dry_run?
|
if ARGV.dry_run?
|
||||||
puts "Would remove: #{pn}"
|
puts "Would remove: #{pn}"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user