aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorXu Cheng2016-07-14 13:14:03 +0800
committerXu Cheng2016-07-14 15:23:34 +0800
commit0ed673abdb59e2f75f9b8539cce318607924e87f (patch)
tree6046d9c1a8f3c7054c891b1e9a125ba53429d13f /Library/Homebrew/extend
parent13730a9dadde8570e41cf5599b4f5c940014f190 (diff)
downloadbrew-0ed673abdb59e2f75f9b8539cce318607924e87f.tar.bz2
formula_cellar_checks: add check_linkage
This means linkage checks will be invoked during `brew install` and `brew audit` Closes #470. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/os/mac/formula_cellar_checks.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
index cc0372eb1..dd21559e2 100644
--- a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
+++ b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb
@@ -1,3 +1,5 @@
+require "os/mac/linkage_checker"
+
module FormulaCellarChecks
def check_shadowed_headers
return if ["libtool", "subversion", "berkeley-db"].any? do |formula_name|
@@ -56,10 +58,33 @@ module FormulaCellarChecks
EOS
end
+ def check_linkage
+ return unless formula.prefix.directory?
+ keg = Keg.new(formula.prefix)
+ checker = LinkageChecker.new(keg, formula)
+
+ if checker.broken_dylibs?
+ audit_check_output <<-EOS.undent
+ The installation was broken.
+ Broken dylib links found:
+ #{checker.broken_dylibs.to_a * "\n "}
+ EOS
+ end
+
+ if checker.undeclared_deps?
+ audit_check_output <<-EOS.undent
+ Formulae are required to declare all linked dependencies.
+ Please add all linked dependencies to the formula with:
+ #{checker.undeclared_deps.map { |d| "depends_on \"#{d}\" => :linked"} * "\n "}
+ EOS
+ end
+ end
+
def audit_installed
generic_audit_installed
audit_check_output(check_shadowed_headers)
audit_check_output(check_openssl_links)
audit_check_output(check_python_framework_links(formula.lib))
+ check_linkage
end
end