Skip to content
Snippets Groups Projects
Commit f281ea3a authored by Jack Nagel's avatar Jack Nagel
Browse files

Simplify config script doctor check

parent d494c9db
No related branches found
No related tags found
No related merge requests found
...@@ -654,20 +654,20 @@ def check_for_config_scripts ...@@ -654,20 +654,20 @@ def check_for_config_scripts
return unless HOMEBREW_CELLAR.exist? return unless HOMEBREW_CELLAR.exist?
real_cellar = HOMEBREW_CELLAR.realpath real_cellar = HOMEBREW_CELLAR.realpath
config_scripts = [] scripts = []
whitelist = %W[/usr/bin /usr/sbin /usr/X11/bin /usr/X11R6/bin /opt/X11/bin #{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin] whitelist = %W[/usr/bin /usr/sbin /usr/X11/bin /usr/X11R6/bin /opt/X11/bin #{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/sbin]
whitelist.map! { |d| d.downcase } whitelist.map! { |d| d.downcase }
paths.each do |p| paths.each do |p|
next if whitelist.include? p.downcase next if whitelist.include?(p.downcase) ||
next if p.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s) p.start_with?(real_cellar.to_s, HOMEBREW_CELLAR.to_s) ||
!File.directory?(p)
configs = Dir["#{p}/*-config"] scripts += Dir.chdir(p) { Dir["*-config"] }.map { |c| File.join(p, c) }
config_scripts << [p, configs.map { |c| File.basename(c) }] unless configs.empty?
end end
unless config_scripts.empty? unless scripts.empty?
s = <<-EOS.undent s = <<-EOS.undent
"config" scripts exist outside your system or Homebrew directories. "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if `./configure` scripts often look for *-config scripts to determine if
...@@ -680,10 +680,7 @@ def check_for_config_scripts ...@@ -680,10 +680,7 @@ def check_for_config_scripts
EOS EOS
config_scripts.each do |dir, files| s << scripts.map { |f| " #{f}" }.join("\n")
files.each { |fn| s << " #{dir}/#{fn}\n" }
end
s
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment