Merge pull request #13639 from carlocab/linux-doctor-dependents
linux/diagnostic: add check for versioned GCC linkage
This commit is contained in:
commit
d550d57f78
@ -139,6 +139,34 @@ module Homebrew
|
|||||||
e.g. by using homebrew instead).
|
e.g. by using homebrew instead).
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_gcc_dependent_linkage
|
||||||
|
gcc_dependents = Formula.installed.select do |formula|
|
||||||
|
next false unless formula.tap&.core_tap?
|
||||||
|
|
||||||
|
formula.recursive_dependencies.map(&:name).include? "gcc"
|
||||||
|
rescue TapFormulaUnavailableError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
return if gcc_dependents.empty?
|
||||||
|
|
||||||
|
badly_linked = gcc_dependents.select do |dependent|
|
||||||
|
keg = Keg.new(dependent.prefix)
|
||||||
|
keg.binary_executable_or_library_files.any? do |binary|
|
||||||
|
paths = binary.rpath.split(":")
|
||||||
|
versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) }
|
||||||
|
unversioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/current$}) }
|
||||||
|
|
||||||
|
versioned_linkage && !unversioned_linkage
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return if badly_linked.empty?
|
||||||
|
|
||||||
|
inject_file_list badly_linked, <<~EOS
|
||||||
|
Formulae which link to GCC through a versioned path were found. These formulae
|
||||||
|
are prone to breaking when GCC is updated. You should `brew reinstall` these formulae:
|
||||||
|
EOS
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user