install, upgrade: fetch each formula only once

This commit is contained in:
fn ⌃ ⌥ 2021-10-31 10:52:40 -07:00
parent b14078a41d
commit aa6f10ff35
2 changed files with 14 additions and 0 deletions

View File

@ -114,6 +114,15 @@ class FormulaInstaller
@installed = Set.new
end
def self.fetched
@fetched ||= Set.new
end
sig { void }
def self.clear_fetched
@fetched = Set.new
end
sig { returns(T::Boolean) }
def build_from_source?
@build_from_source_formulae.include?(formula.full_name)
@ -1141,6 +1150,8 @@ class FormulaInstaller
sig { void }
def fetch
return if self.class.fetched.include?(formula)
fetch_dependencies
return if only_deps?
@ -1152,6 +1163,8 @@ class FormulaInstaller
formula.resources.each(&:fetch)
end
downloader.fetch
self.class.fetched << formula
end
def downloader

View File

@ -204,6 +204,7 @@ RSpec.configure do |config|
Requirement.clear_cache
FormulaInstaller.clear_attempted
FormulaInstaller.clear_installed
FormulaInstaller.clear_fetched
TEST_DIRECTORIES.each(&:mkpath)