aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-10-01 23:32:53 -0500
committerJack Nagel2014-10-01 23:32:53 -0500
commitc4818394cbd8872016e56a97e1a464a635d71c6c (patch)
treee440bd9d8fe8714f5d221415acdda5a931fc743d /Library
parent86bb9b3fbb5d53b44a56b7e13c685ea60e64b376 (diff)
downloadbrew-c4818394cbd8872016e56a97e1a464a635d71c6c.tar.bz2
Post-install audit for shadowed header files
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb1
-rw-r--r--Library/Homebrew/formula_cellar_checks.rb19
-rw-r--r--Library/Homebrew/formula_installer.rb5
3 files changed, 25 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 0cf20b75b..cbfb67dce 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -567,6 +567,7 @@ class FormulaAuditor
audit_check_output(check_generic_executables(f.bin))
audit_check_output(check_non_executables(f.sbin))
audit_check_output(check_generic_executables(f.sbin))
+ audit_check_output(check_shadowed_headers)
end
def audit
diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb
index e1341303b..f639c2046 100644
--- a/Library/Homebrew/formula_cellar_checks.rb
+++ b/Library/Homebrew/formula_cellar_checks.rb
@@ -106,4 +106,23 @@ module FormulaCellarChecks
EOS
]
end
+
+ def check_shadowed_headers
+ return if f.keg_only? || !f.include.directory?
+
+ files = relative_glob(f.include, "**/*.h")
+ files &= relative_glob("#{MacOS.sdk_path}/usr/include", "**/*.h")
+ files.map! { |p| File.join(f.include, p) }
+
+ return if files.empty?
+
+ ["Header files that shadow system header files were installed to \"#{f.include}\".",
+ "The offending files are: \n #{files * "\n "}"]
+ end
+
+ private
+
+ def relative_glob(dir, pattern)
+ Dir.chdir(dir) { Dir[pattern] }
+ end
end
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index c5914484c..7723c0f8d 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -384,6 +384,7 @@ class FormulaInstaller
audit_lib
audit_man
audit_info
+ audit_include
end
c = Caveats.new(f)
@@ -671,6 +672,10 @@ class FormulaInstaller
print_check_output(check_infopages)
end
+ def audit_include
+ print_check_output(check_shadowed_headers)
+ end
+
private
def hold_locks?