Remove memoization from uses.rb, as it doesn't result in the expected time complexity savings
This commit is contained in:
parent
b135a70c57
commit
43cbf08018
@ -14,7 +14,7 @@ module Homebrew
|
|||||||
def readall
|
def readall
|
||||||
if ARGV.include?("--syntax")
|
if ARGV.include?("--syntax")
|
||||||
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
|
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
|
||||||
ruby_files = Dir.glob(scan_files).reject { |file| file =~ /vendor|cask/ }
|
ruby_files = Dir.glob(scan_files).reject { |file| file =~ %r{/(vendor|cask)/} }
|
||||||
|
|
||||||
Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files)
|
Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -54,14 +54,11 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
ignores << "recommended?" if ARGV.include? "--skip-recommended"
|
ignores << "recommended?" if ARGV.include? "--skip-recommended"
|
||||||
|
|
||||||
memo = {}
|
|
||||||
uses = formulae.select do |f|
|
uses = formulae.select do |f|
|
||||||
used_formulae.all? do |ff|
|
used_formulae.all? do |ff|
|
||||||
begin
|
begin
|
||||||
if recursive
|
if recursive
|
||||||
deps = f.recursive_dependencies do |dependent, dep|
|
deps = f.recursive_dependencies do |dependent, dep|
|
||||||
memo_key = [dependent, dep].to_s
|
|
||||||
next if memo[memo_key]
|
|
||||||
if dep.recommended?
|
if dep.recommended?
|
||||||
Dependency.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
Dependency.prune if ignores.include?("recommended?") || dependent.build.without?(dep)
|
||||||
elsif dep.optional?
|
elsif dep.optional?
|
||||||
@ -75,7 +72,6 @@ module Homebrew
|
|||||||
if dep.is_a?(TapDependency) && !dep.tap.installed?
|
if dep.is_a?(TapDependency) && !dep.tap.installed?
|
||||||
Dependency.keep_but_prune_recursive_deps
|
Dependency.keep_but_prune_recursive_deps
|
||||||
end
|
end
|
||||||
memo[memo_key] = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dep_formulae = deps.flat_map do |dep|
|
dep_formulae = deps.flat_map do |dep|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user