Merge pull request #7847 from maxim-belkin/allow_missing_libs
Allow missing libraries
This commit is contained in:
commit
13f0d4ad2b
@ -7,11 +7,38 @@ class Formula
|
|||||||
"#{name}.so#{"." unless version.nil?}#{version}"
|
"#{name}.so#{"." unless version.nil?}#{version}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
undef allowed_missing_lib?
|
||||||
|
def allowed_missing_lib?(lib)
|
||||||
|
# lib: Full path to the missing library
|
||||||
|
# Ex.: /home/linuxbrew/.linuxbrew/lib/libsomething.so.1
|
||||||
|
# x - Name of or a pattern for a library, linkage to which is allowed to be missing.
|
||||||
|
# Ex. 1: "libONE.so.1"
|
||||||
|
# Ex. 2: %r{(libONE|libTWO)\.so}
|
||||||
|
self.class.allowed_missing_libraries.any? do |x|
|
||||||
|
case x
|
||||||
|
when Regexp
|
||||||
|
x.match? lib
|
||||||
|
when String
|
||||||
|
lib.include? x
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
undef on_linux
|
undef on_linux
|
||||||
|
|
||||||
def on_linux(&_block)
|
def on_linux(&_block)
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ignore_missing_libraries(*libs)
|
||||||
|
libs.flatten!
|
||||||
|
allowed_missing_libraries.merge(libs)
|
||||||
|
end
|
||||||
|
|
||||||
|
# @private
|
||||||
|
def allowed_missing_libraries
|
||||||
|
@allowed_missing_libraries ||= Set.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1131,6 +1131,13 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Whether this {Formula} is allowed to have a broken linkage to specified library.
|
||||||
|
# Defaults to false.
|
||||||
|
# @return [Boolean]
|
||||||
|
def allowed_missing_lib?(*)
|
||||||
|
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?
|
||||||
|
|||||||
@ -55,18 +55,35 @@ class LinkageChecker
|
|||||||
end
|
end
|
||||||
|
|
||||||
def display_test_output(puts_output: true)
|
def display_test_output(puts_output: true)
|
||||||
display_items "Missing libraries", @broken_dylibs, puts_output: puts_output
|
display_items "Missing libraries", broken_dylibs_with_expectations, puts_output: puts_output
|
||||||
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 @broken_dylibs.empty?
|
||||||
|
puts "No broken library linkage detected"
|
||||||
|
elsif unexpected_broken_libs.empty?
|
||||||
|
puts "No unexpected broken library linkage detected."
|
||||||
|
else
|
||||||
|
puts "Broken library linkage detected"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def broken_library_linkage?
|
def broken_library_linkage?
|
||||||
!@broken_dylibs.empty? ||
|
issues = [@broken_deps, @unwanted_system_dylibs, @version_conflict_deps]
|
||||||
!@broken_deps.empty? ||
|
[issues, unexpected_broken_libs].flatten.any?(&:present?)
|
||||||
!@unwanted_system_dylibs.empty? ||
|
end
|
||||||
!@version_conflict_deps.empty?
|
|
||||||
|
def unexpected_broken_libs
|
||||||
|
@broken_dylibs.reject { |lib| @formula.allowed_missing_lib? lib }
|
||||||
|
end
|
||||||
|
|
||||||
|
def broken_dylibs_with_expectations
|
||||||
|
output = {}
|
||||||
|
@broken_dylibs.each do |lib|
|
||||||
|
output[lib] = (unexpected_broken_libs.include? lib) ? ["unexpected"] : ["expected"]
|
||||||
|
end
|
||||||
|
output
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user