From 48fdd163bcf9ab52f4ac708def700b7b6ab218a4 Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Tue, 21 Mar 2017 04:13:13 -0500 Subject: Brew cleanup: Continue on error removing keg Fixes #2355 Create unremovable_kegs instance var Check cellar cleanup failure after full cleanup completes Use module_function in Homebrew::Cleanup as we never instantiate the class --- Library/Homebrew/cmd/cleanup.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 126309579..d8f669e85 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -21,11 +21,14 @@ module Homebrew if ARGV.named.empty? Cleanup.cleanup else - ARGV.resolved_formulae.each { |f| Cleanup.cleanup_formula f } + Cleanup.cleanup_cellar(ARGV.resolved_formulae) end - return if Cleanup.disk_cleanup_size.zero? + report_disk_usage unless Cleanup.disk_cleanup_size.zero? + report_unremovable_kegs unless Cleanup.unremovable_kegs.empty? + end + def report_disk_usage disk_space = disk_usage_readable(Cleanup.disk_cleanup_size) if ARGV.dry_run? ohai "This operation would free approximately #{disk_space} of disk space." @@ -33,4 +36,11 @@ module Homebrew ohai "This operation has freed approximately #{disk_space} of disk space." end end + + def report_unremovable_kegs + ofail <<-EOS.undent + Could not cleanup old kegs! Fix your permissions on: + #{Cleanup.unremovable_kegs.join "\n "} + EOS + end end -- cgit v1.2.3