Complain about non-exes in bin and non-libs in lib

This commit is contained in:
Adam Vandenberg 2012-02-19 19:09:38 -08:00
parent 86e7c8a772
commit 47a81b0b80

View File

@ -82,9 +82,10 @@ class FormulaInstaller
ohai 'Caveats', f.keg_only_text
@show_summary_heading = true
else
audit_bin
audit_lib
check_manpages
check_infopages
check_jars
check_m4
end
end
@ -244,7 +245,8 @@ class FormulaInstaller
def check_jars
# Check for Jars in lib
if File.exist?(f.lib)
return unless File.exist? f.lib
unless f.lib.children.select{|g| g.to_s =~ /\.jar$/}.empty?
opoo 'JARs were installed to "lib".'
puts "Installing JARs to \"lib\" can cause conflicts between packages."
@ -254,6 +256,43 @@ class FormulaInstaller
@show_summary_heading = true
end
end
def check_non_libraries
return unless File.exist? f.lib
valid_libraries = %w(.a .dylib .framework .la .so)
non_libraries = f.lib.children.select do |g|
next if g.directory?
extname = g.extname
(extname != ".jar") and (not valid_libraries.include? extname)
end
unless non_libraries.empty?
opoo 'Non-libraries were installed to "lib".'
puts "Installing non-libraries to \"lib\" is bad practice."
puts "The offending files are:"
puts non_libraries
@show_summary_heading = true
end
end
def audit_bin
return unless File.exist? f.bin
non_exes = f.bin.children.select {|g| not File.executable? g}
unless non_exes.empty?
opoo 'Non-executables were installed to "bin".'
puts "Installing non-executables to \"bin\" is bad practice."
puts "The offending files are:"
puts non_exes
@show_summary_heading = true
end
end
def audit_lib
check_jars
check_non_libraries
end
def check_m4