Simplify post-install audit output

This commit is contained in:
Jack Nagel 2014-10-13 23:13:00 -05:00
parent 09d53f4fc5
commit b46ebf8a29
3 changed files with 62 additions and 65 deletions

View File

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

View File

@ -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
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
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,8 +43,8 @@ module FormulaCellarChecks
jars = f.lib.children.select { |g| g.extname == ".jar" }
return if jars.empty?
["JARs were installed to \"#{f.lib}\".",
<<-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".
@ -52,7 +52,6 @@ module FormulaCellarChecks
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
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
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
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.
and suggest that this software should be installed to "libexec" and then
symlinked as needed.
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.
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

View File

@ -639,13 +639,12 @@ class FormulaInstaller
## checks
def print_check_output warning_and_description
return unless warning_and_description
warning, description = *warning_and_description
opoo warning
puts description
def print_check_output(output)
if output
opoo output
@show_summary_heading = true
end
end
def audit_bin
print_check_output(check_PATH(f.bin)) unless f.keg_only?