Permit cleanup to remove outdated keg-only formulae

This check is not really relevant anymore; old-style, pre-opt installs
date from 2012 at the very latest, so it is very unlikely that any
packages remain which still link against these.

Refs Homebrew/homebrew#48139.
This commit is contained in:
Misty De Meo 2016-01-17 12:59:17 -08:00
parent b118539c8c
commit 09ba000be1

View File

@ -1484,7 +1484,7 @@ class Formula
eligible_for_cleanup = []
if installed?
eligible_kegs = installed_kegs.select { |k| pkg_version > k.version }
if eligible_kegs.any? && eligible_for_cleanup?
if eligible_kegs.any?
eligible_kegs.each do |keg|
if keg.linked?
opoo "Skipping (old) #{keg} due to it being linked"
@ -1492,8 +1492,6 @@ class Formula
eligible_for_cleanup << keg
end
end
else
eligible_kegs.each { |keg| opoo "Skipping (old) keg-only: #{keg}" }
end
elsif installed_prefixes.any? && !pinned?
# If the cellar only has one version installed, don't complain
@ -1504,25 +1502,6 @@ class Formula
eligible_for_cleanup
end
# @private
def eligible_for_cleanup?
# It used to be the case that keg-only kegs could not be cleaned up, because
# older brews were built against the full path to the keg-only keg. Then we
# introduced the opt symlink, and built against that instead. So provided
# no brew exists that was built against an old-style keg-only keg, we can
# remove it.
if !keg_only? || ARGV.force?
true
elsif opt_prefix.directory?
# SHA records were added to INSTALL_RECEIPTS the same day as opt symlinks
Formula.installed.select do |f|
f.deps.any? do |d|
d.to_formula.full_name == full_name rescue d.name == name
end
end.all? { |f| f.installed_prefixes.all? { |keg| Tab.for_keg(keg).HEAD } }
end
end
private
def exec_cmd(cmd, args, out, logfn)