cleanup: tweak missing clean file behaviour.
Instead of cleaning every time if the file is missing: don't clean this time, touch the file and clean when it's next needed. Now that this feature has been around for longer this makes more sense for existing installations and stops the first `brew install` run on a new/test installation without this file always running a `brew cleanup`. Also, fix up the use of a compat/deprecated method hit by tests by this change.
This commit is contained in:
parent
954c833de2
commit
4da5c09c25
@ -142,14 +142,18 @@ module Homebrew
|
||||
cleanup = Cleanup.new
|
||||
if cleanup.periodic_clean_due?
|
||||
cleanup.periodic_clean!
|
||||
elsif f.installed?
|
||||
elsif f.latest_version_installed?
|
||||
cleanup.cleanup_formula(f)
|
||||
end
|
||||
end
|
||||
|
||||
def periodic_clean_due?
|
||||
return false if Homebrew::EnvConfig.no_install_cleanup?
|
||||
return true unless PERIODIC_CLEAN_FILE.exist?
|
||||
|
||||
unless PERIODIC_CLEAN_FILE.exist?
|
||||
FileUtils.touch PERIODIC_CLEAN_FILE
|
||||
return false
|
||||
end
|
||||
|
||||
PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user