2018-01-16 17:37:59 -05:00
|
|
|
#: * `linkage` [`--test`] [`--reverse`] [`--rebuild`] <formula>:
|
2016-09-08 09:05:00 +01:00
|
|
|
#: 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.
|
2018-01-16 17:37:59 -05:00
|
|
|
#:
|
|
|
|
#: If `--rebuild` is passed, flushes the `LinkageStore` cache for each
|
|
|
|
#: 'keg.name' and forces a check on the dylibs.
|
2016-04-17 21:25:11 -04:00
|
|
|
|
2016-07-07 20:41:14 +08:00
|
|
|
require "os/mac/linkage_checker"
|
2016-04-17 21:25:11 -04:00
|
|
|
|
|
|
|
module Homebrew
|
2016-09-26 01:44:51 +02:00
|
|
|
module_function
|
|
|
|
|
2016-04-17 21:25:11 -04:00
|
|
|
def linkage
|
|
|
|
ARGV.kegs.each do |keg|
|
|
|
|
ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
|
2018-01-16 17:37:59 -05:00
|
|
|
database_cache = DatabaseCache.new("linkage")
|
|
|
|
result = LinkageChecker.new(keg, database_cache)
|
|
|
|
result.flush_cache_and_check_dylibs if ARGV.include?("--rebuild")
|
|
|
|
|
2016-04-17 21:25:11 -04:00
|
|
|
if ARGV.include?("--test")
|
|
|
|
result.display_test_output
|
2016-07-07 20:41:14 +08:00
|
|
|
Homebrew.failed = true if result.broken_dylibs?
|
2016-06-30 19:50:50 -07:00
|
|
|
elsif ARGV.include?("--reverse")
|
|
|
|
result.display_reverse_output
|
2016-04-17 21:25:11 -04:00
|
|
|
else
|
|
|
|
result.display_normal_output
|
|
|
|
end
|
2018-01-16 17:37:59 -05:00
|
|
|
|
|
|
|
database_cache.close
|
2016-04-17 21:25:11 -04:00
|
|
|
end
|
|
|
|
end
|
2016-04-19 13:55:47 +08:00
|
|
|
end
|