From b46ebf8a29d9ac150895f426cbcf9a78359709ec Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 13 Oct 2014 23:13:00 -0500 Subject: [PATCH] Simplify post-install audit output --- Library/Homebrew/cmd/audit.rb | 6 +- Library/Homebrew/formula_cellar_checks.rb | 110 +++++++++++----------- Library/Homebrew/formula_installer.rb | 11 +-- 3 files changed, 62 insertions(+), 65 deletions(-) diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb index 68e54999a8..ce8c1e9db7 100644 --- a/Library/Homebrew/cmd/audit.rb +++ b/Library/Homebrew/cmd/audit.rb @@ -550,10 +550,8 @@ class FormulaAuditor Symbol === dep ? dep.inspect : "'#{dep}'" end - def audit_check_output warning_and_description - return unless warning_and_description - warning, description = *warning_and_description - problem "#{warning}\n#{description}" + def audit_check_output(output) + problem(output) if output end def audit_installed diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 372fcca87f..7f30990e8e 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -10,32 +10,32 @@ module FormulaCellarChecks prefix_bin = prefix_bin.realpath return if ORIGINAL_PATHS.include? prefix_bin - ["#{prefix_bin} is not in your PATH", - "You can amend this by altering your ~/.bashrc file"] + <<-EOS.undent + #{prefix_bin} is not in your PATH + You can amend this by altering your ~/.bashrc file + EOS end def check_manpages # Check for man pages that aren't in share/man return unless (f.prefix+'man').directory? - ['A top-level "man" directory was found.', - <<-EOS.undent - Homebrew requires that man pages live under share. - This can often be fixed by passing "--mandir=\#{man}" to configure. - EOS - ] + <<-EOS.undent + A top-level "man" directory was found + Homebrew requires that man pages live under share. + This can often be fixed by passing "--mandir=\#{man}" to configure. + EOS end def check_infopages # Check for info pages that aren't in share/info return unless (f.prefix+'info').directory? - ['A top-level "info" directory was found.', - <<-EOS.undent - Homebrew suggests that info pages live under share. - This can often be fixed by passing "--infodir=\#{info}" to configure. - EOS - ] + <<-EOS.undent + A top-level "info" directory was found + Homebrew suggests that info pages live under share. + This can often be fixed by passing "--infodir=\#{info}" to configure. + EOS end def check_jars @@ -43,16 +43,15 @@ module FormulaCellarChecks jars = f.lib.children.select { |g| g.extname == ".jar" } return if jars.empty? - ["JARs were installed to \"#{f.lib}\".", - <<-EOS.undent - Installing JARs to "lib" can cause conflicts between packages. - For Java software, it is typically better for the formula to - install to "libexec" and then symlink or wrap binaries into "bin". - See "activemq", "jruby", etc. for examples. - The offending files are: - #{jars * "\n "} - EOS - ] + <<-EOS.undent + JARs were installed to "#{f.lib}" + Installing JARs to "lib" can cause conflicts between packages. + For Java software, it is typically better for the formula to + install to "libexec" and then symlink or wrap binaries into "bin". + See "activemq", "jruby", etc. for examples. + The offending files are: + #{jars * "\n "} + EOS end def check_non_libraries @@ -66,13 +65,12 @@ module FormulaCellarChecks end return if non_libraries.empty? - ["Non-libraries were installed to \"#{f.lib}\".", - <<-EOS.undent - Installing non-libraries to "lib" is discouraged. - The offending files are: - #{non_libraries * "\n "} - EOS - ] + <<-EOS.undent + Non-libraries were installed to "#{f.lib}" + Installing non-libraries to "lib" is discouraged. + The offending files are: + #{non_libraries * "\n "} + EOS end def check_non_executables bin @@ -81,12 +79,11 @@ module FormulaCellarChecks non_exes = bin.children.select { |g| g.directory? or not g.executable? } return if non_exes.empty? - ["Non-executables were installed to \"#{bin}\".", - <<-EOS.undent - The offending files are: - #{non_exes * "\n "} - EOS - ] + <<-EOS.undent + Non-executables were installed to "#{bin}" + The offending files are: + #{non_exes * "\n "} + EOS end def check_generic_executables bin @@ -95,16 +92,15 @@ module FormulaCellarChecks generics = bin.children.select { |g| generic_names.include? g.basename.to_s } return if generics.empty? - ["Generic binaries were installed to \"#{bin}\".", - <<-EOS.undent - Binaries with generic names are likely to conflict with other software, - and suggest that this software should be installed to "libexec" and - then symlinked as needed. + <<-EOS.undent + Generic binaries were installed to "#{bin}" + Binaries with generic names are likely to conflict with other software, + and suggest that this software should be installed to "libexec" and then + symlinked as needed. - The offending files are: - #{generics * "\n "} - EOS - ] + The offending files are: + #{generics * "\n "} + EOS end def check_shadowed_headers @@ -116,21 +112,25 @@ module FormulaCellarChecks return if files.empty? - ["Header files that shadow system header files were installed to \"#{f.include}\".", - "The offending files are: \n #{files * "\n "}"] + <<-EOS.undent + Header files that shadow system header files were installed to "#{f.include}" + The offending files are: + #{files * "\n "} + EOS end def check_easy_install_pth lib pth_found = Dir["#{lib}/python{2.7,3.4}/site-packages/easy-install.pth"].map { |f| File.dirname(f) } return if pth_found.empty? - ["easy-install.pth files were found in #{pth_found.join(", ")}.", - <<-EOS.undent - These .pth files are likely to cause link conflicts. Please - invoke setup.py with options --single-version-externally-managed - --record=install.txt. - EOS - ] + <<-EOS.undent + easy-install.pth files were found + These .pth files are likely to cause link conflicts. Please invoke + setup.py with options + --single-version-externally-managed --record=install.txt + The offending files are + #{pth_found * "\n "} + EOS end private diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 7723c0f8d8..4b437e61de 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -639,12 +639,11 @@ class FormulaInstaller ## checks - def print_check_output warning_and_description - return unless warning_and_description - warning, description = *warning_and_description - opoo warning - puts description - @show_summary_heading = true + def print_check_output(output) + if output + opoo output + @show_summary_heading = true + end end def audit_bin