From 87686d861051f25018288d6dab1333daef2e038f Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 26 Feb 2012 16:33:44 -0800 Subject: [PATCH] audit: check sbin too Apply the 'bin' audit to 'sbin' too, and also complain if subfolders are installed to either. --- Library/Homebrew/formula_installer.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index e61967bb52..9a48011842 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -83,6 +83,7 @@ class FormulaInstaller @show_summary_heading = true else audit_bin + audit_sbin audit_lib check_manpages check_infopages @@ -287,7 +288,7 @@ class FormulaInstaller def audit_bin return unless File.exist? f.bin - non_exes = f.bin.children.select {|g| not File.executable? g} + non_exes = f.bin.children.select {|g| File.directory? g or not File.executable? g} unless non_exes.empty? opoo 'Non-executables were installed to "bin".' @@ -298,6 +299,20 @@ class FormulaInstaller end end + def audit_sbin + return unless File.exist? f.sbin + + non_exes = f.sbin.children.select {|g| File.directory? g or not File.executable? g} + + unless non_exes.empty? + opoo 'Non-executables were installed to "sbin".' + puts "Installing non-executables to \"sbin\" 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