aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2012-02-19 19:09:38 -0800
committerAdam Vandenberg2012-02-20 18:03:31 -0800
commit47a81b0b809c56c724643e53b1e0e42b7d016815 (patch)
tree091ded77f03b8bfbded09dc08b3dcbdfa1184fe8 /Library
parent86e7c8a7726fd63c4d2a8f9f151a2deb7d1d6083 (diff)
downloadbrew-47a81b0b809c56c724643e53b1e0e42b7d016815.tar.bz2
Complain about non-exes in bin and non-libs in lib
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula_installer.rb59
1 files changed, 49 insertions, 10 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 469db2db3..39c956545 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -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,18 +245,56 @@ class FormulaInstaller
def check_jars
# Check for Jars in lib
- if 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."
- puts "For Java software, it is typically better for the formula to"
- puts "install to \"libexec\" and then symlink or wrap binaries into \"bin\"."
- puts "See \"activemq\", \"jruby\", etc. for examples."
- @show_summary_heading = true
- end
+ 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."
+ puts "For Java software, it is typically better for the formula to"
+ puts "install to \"libexec\" and then symlink or wrap binaries into \"bin\"."
+ puts "See \"activemq\", \"jruby\", etc. for examples."
+ @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
# Check for m4 files
if Dir[f.share+"aclocal/*.m4"].length > 0 and not in_aclocal_dirlist?