46 lines
1.2 KiB
Ruby
Raw Normal View History

#: * `linkage` [`--test`] [`--reverse`] <formula>:
#: Checks the library links of an installed formula.
#:
#: Only works on installed formulae. An error is raised if it is run on
#: uninstalled formulae.
#:
#: If `--test` is passed, only display missing libraries and exit with a
#: non-zero exit code if any missing libraries were found.
#:
#: If `--reverse` is passed, print the dylib followed by the binaries
#: which link to it for each library the keg references.
require "cache_store"
require "linkage_checker"
2018-06-02 20:45:50 +05:30
require "cli_parser"
module Homebrew
2016-09-26 01:44:51 +02:00
module_function
def linkage
2018-06-02 20:45:50 +05:30
Homebrew::CLI::Parser.parse do
switch "--test"
switch "--reverse"
switch :verbose
switch :debug
end
2018-05-22 14:46:14 +01:00
CacheStoreDatabase.use(:linkage) do |db|
ARGV.kegs.each do |keg|
ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
result = LinkageChecker.new(keg, cache_db: db)
2018-06-02 20:45:50 +05:30
if args.test?
result.display_test_output
Homebrew.failed = true if result.broken_library_linkage?
2018-06-02 20:45:50 +05:30
elsif args.reverse?
result.display_reverse_output
else
result.display_normal_output
end
end
end
end
end