mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
install, upgrade: fetch each formula only once
This commit is contained in:
parent
b14078a41d
commit
aa6f10ff35
@ -114,6 +114,15 @@ class FormulaInstaller
|
|||||||
@installed = Set.new
|
@installed = Set.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.fetched
|
||||||
|
@fetched ||= Set.new
|
||||||
|
end
|
||||||
|
|
||||||
|
sig { void }
|
||||||
|
def self.clear_fetched
|
||||||
|
@fetched = Set.new
|
||||||
|
end
|
||||||
|
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def build_from_source?
|
def build_from_source?
|
||||||
@build_from_source_formulae.include?(formula.full_name)
|
@build_from_source_formulae.include?(formula.full_name)
|
||||||
@ -1141,6 +1150,8 @@ class FormulaInstaller
|
|||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def fetch
|
def fetch
|
||||||
|
return if self.class.fetched.include?(formula)
|
||||||
|
|
||||||
fetch_dependencies
|
fetch_dependencies
|
||||||
|
|
||||||
return if only_deps?
|
return if only_deps?
|
||||||
@ -1152,6 +1163,8 @@ class FormulaInstaller
|
|||||||
formula.resources.each(&:fetch)
|
formula.resources.each(&:fetch)
|
||||||
end
|
end
|
||||||
downloader.fetch
|
downloader.fetch
|
||||||
|
|
||||||
|
self.class.fetched << formula
|
||||||
end
|
end
|
||||||
|
|
||||||
def downloader
|
def downloader
|
||||||
|
@ -204,6 +204,7 @@ RSpec.configure do |config|
|
|||||||
Requirement.clear_cache
|
Requirement.clear_cache
|
||||||
FormulaInstaller.clear_attempted
|
FormulaInstaller.clear_attempted
|
||||||
FormulaInstaller.clear_installed
|
FormulaInstaller.clear_installed
|
||||||
|
FormulaInstaller.clear_fetched
|
||||||
|
|
||||||
TEST_DIRECTORIES.each(&:mkpath)
|
TEST_DIRECTORIES.each(&:mkpath)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user