Changed default behavior of brew linkage
command to build cache instead of using cached output. Cached output may be printed with --cached
flag.
This commit is contained in:
parent
2c7ae2544b
commit
bc76a8afcb
@ -1,4 +1,4 @@
|
|||||||
#: * `linkage` [`--test`] [`--reverse`] [`--rebuild`] <formula>:
|
#: * `linkage` [`--test`] [`--reverse`] [`--cached`] <formula>:
|
||||||
#: Checks the library links of an installed formula.
|
#: Checks the library links of an installed formula.
|
||||||
#:
|
#:
|
||||||
#: Only works on installed formulae. An error is raised if it is run on
|
#: Only works on installed formulae. An error is raised if it is run on
|
||||||
@ -10,8 +10,8 @@
|
|||||||
#: If `--reverse` is passed, print the dylib followed by the binaries
|
#: If `--reverse` is passed, print the dylib followed by the binaries
|
||||||
#: which link to it for each library the keg references.
|
#: which link to it for each library the keg references.
|
||||||
#:
|
#:
|
||||||
#: If `--rebuild` is passed, flushes the `LinkageStore` cache for each
|
#: If `--cached` is passed, print the cached linkage values stored in
|
||||||
#: 'keg.name' and forces a check on the dylibs.
|
#: HOMEBREW_CACHE, set from a previous `brew linkage` run
|
||||||
|
|
||||||
require "cache_store"
|
require "cache_store"
|
||||||
require "linkage_checker"
|
require "linkage_checker"
|
||||||
@ -24,7 +24,8 @@ module Homebrew
|
|||||||
ARGV.kegs.each do |keg|
|
ARGV.kegs.each do |keg|
|
||||||
ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
|
ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
|
||||||
|
|
||||||
result = LinkageChecker.new(keg, database_cache, ARGV.include?("--rebuild"))
|
use_cache = ARGV.include?("--cached") || ENV["HOMEBREW_LINKAGE_CACHE"]
|
||||||
|
result = LinkageChecker.new(keg, database_cache, use_cache)
|
||||||
|
|
||||||
if ARGV.include?("--test")
|
if ARGV.include?("--test")
|
||||||
result.display_test_output
|
result.display_test_output
|
||||||
|
@ -66,7 +66,7 @@ module FormulaCellarChecks
|
|||||||
return unless formula.prefix.directory?
|
return unless formula.prefix.directory?
|
||||||
keg = Keg.new(formula.prefix)
|
keg = Keg.new(formula.prefix)
|
||||||
|
|
||||||
DatabaseCache.new(:linkage) { |database_cache| LinkageChecker.new(keg, database_cache, true, formula) }
|
DatabaseCache.new(:linkage) { |database_cache| LinkageChecker.new(keg, database_cache, false, formula) }
|
||||||
|
|
||||||
return unless checker.broken_dylibs?
|
return unless checker.broken_dylibs?
|
||||||
output = <<~EOS
|
output = <<~EOS
|
||||||
|
@ -6,11 +6,11 @@ require "linkage_cache_store"
|
|||||||
class LinkageChecker
|
class LinkageChecker
|
||||||
attr_reader :keg, :formula, :store
|
attr_reader :keg, :formula, :store
|
||||||
|
|
||||||
def initialize(keg, db, rebuild_cache = false, formula = nil)
|
def initialize(keg, db, use_cache = false, formula = nil)
|
||||||
@keg = keg
|
@keg = keg
|
||||||
@formula = formula || resolve_formula(keg)
|
@formula = formula || resolve_formula(keg)
|
||||||
@store = LinkageStore.new(keg.name, db)
|
@store = LinkageStore.new(keg.name, db)
|
||||||
flush_cache_and_check_dylibs if rebuild_cache
|
flush_cache_and_check_dylibs unless use_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
# 'Hash-type' cache values
|
# 'Hash-type' cache values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user