keg: cache runtime_dependencies.

This commit is contained in:
Mike McQuaid 2019-11-05 20:33:32 +00:00
parent 3aa7624284
commit eeb9ac36a2
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
4 changed files with 8 additions and 1 deletions

View File

@ -263,6 +263,7 @@ module Homebrew
changed_files = keg.replace_locations_with_placeholders unless args.skip_relocation?
Keg.clear_cache
Tab.clear_cache
tab = Tab.for_keg(keg)
original_tab = tab.dup

View File

@ -649,6 +649,7 @@ class FormulaInstaller
# Update tab with actual runtime dependencies
tab = Tab.for_keg(keg)
Keg.clear_cache
Tab.clear_cache
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
tab.runtime_dependencies = Tab.runtime_deps_hash(f_runtime_deps)

View File

@ -6,6 +6,8 @@ require "lock_file"
require "ostruct"
class Keg
extend Cachable
class AlreadyLinkedError < RuntimeError
def initialize(keg)
super <<~EOS
@ -519,7 +521,8 @@ class Keg
end
def runtime_dependencies
tab.runtime_dependencies
Keg.cache[:runtime_dependencies] ||= {}
Keg.cache[:runtime_dependencies][path] ||= tab.runtime_dependencies
end
def aliases

View File

@ -145,6 +145,7 @@ RSpec.configure do |config|
begin
Homebrew.raise_deprecation_exceptions = true
Keg.clear_cache
Tap.clear_cache
FormulaInstaller.clear_attempted
@ -177,6 +178,7 @@ RSpec.configure do |config|
end
Tab.clear_cache
Keg.clear_cache
FileUtils.rm_rf [
TEST_DIRECTORIES.map(&:children),