Post-install audit for shadowed header files

This commit is contained in:
Jack Nagel 2014-10-01 23:32:53 -05:00
parent 86bb9b3fbb
commit c4818394cb
3 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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?