Allow missing libraries

This commit is contained in:
Maxim Belkin 2020-06-28 04:33:00 +00:00
parent f28f1f17e3
commit e7b3b8e559
2 changed files with 22 additions and 5 deletions

View File

@ -1131,6 +1131,13 @@ class Formula
end end
end end
# Whether this {Formula} is allowed to have broken linkage.
# Defaults to false.
# @return [Boolean]
def allow_missing_libs?
false
end
# Whether this {Formula} is deprecated (i.e. warns on installation). # Whether this {Formula} is deprecated (i.e. warns on installation).
# Defaults to false. # Defaults to false.
# @method deprecated? # @method deprecated?
@ -2596,6 +2603,10 @@ class Formula
@skip_clean_paths ||= Set.new @skip_clean_paths ||= Set.new
end end
def allow_missing_libs
define_method(:allow_missing_libs?) { true }
end
# Software that will not be symlinked into the `brew --prefix` will only # Software that will not be symlinked into the `brew --prefix` will only
# live in its Cellar. Other formulae can depend on it and then brew will # live in its Cellar. Other formulae can depend on it and then brew will
# add the necessary includes and libs (etc.) during the brewing of that # add the necessary includes and libs (etc.) during the brewing of that

View File

@ -59,14 +59,20 @@ class LinkageChecker
display_items "Broken dependencies", @broken_deps, puts_output: puts_output display_items "Broken dependencies", @broken_deps, puts_output: puts_output
display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output display_items "Unwanted system libraries", @unwanted_system_dylibs, puts_output: puts_output
display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output display_items "Conflicting libraries", @version_conflict_deps, puts_output: puts_output
puts "No broken library linkage" unless broken_library_linkage? if got_library_issues?
puts "Broken library linkage ignored" if @formula.allow_missing_libs?
else
puts "No broken library linkage"
end
end end
def broken_library_linkage? def broken_library_linkage?
!@broken_dylibs.empty? || !@formula.allow_missing_libs? && got_library_issues?
!@broken_deps.empty? || end
!@unwanted_system_dylibs.empty? ||
!@version_conflict_deps.empty? def got_library_issues?
issues = [@broken_dylibs, @broken_deps, @unwanted_system_dylibs, @version_conflict_deps]
issues.any?(&:present?)
end end
private private