mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Refactor platform matching on Linux
I think this highlights better how musl is special.
4075771697
This commit is contained in:
parent
850cfb021e
commit
4d58ee3de0
2 changed files with 22 additions and 2 deletions
|
@ -261,10 +261,21 @@ module Gem
|
||||||
# version
|
# version
|
||||||
(
|
(
|
||||||
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
||||||
(@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
|
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || other.version == "musl#{@version}")) ||
|
||||||
@version == other.version
|
@version == other.version
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
|
||||||
|
# Once only 3.3.23 is supported, we can use the method in RubyGems.
|
||||||
|
def normalized_linux_version_ext
|
||||||
|
return nil unless @version
|
||||||
|
|
||||||
|
without_gnu = @version.sub(/\Agnu/, "")
|
||||||
|
return nil if without_gnu.empty?
|
||||||
|
|
||||||
|
without_gnu
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -181,11 +181,20 @@ class Gem::Platform
|
||||||
# version
|
# version
|
||||||
(
|
(
|
||||||
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
|
||||||
(@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
|
(@os == "linux" && (normalized_linux_version == other.normalized_linux_version || other.version == "musl#{@version}")) ||
|
||||||
@version == other.version
|
@version == other.version
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def normalized_linux_version
|
||||||
|
return nil unless @version
|
||||||
|
|
||||||
|
without_gnu = @version.sub(/\Agnu/, "")
|
||||||
|
return nil if without_gnu.empty?
|
||||||
|
|
||||||
|
without_gnu
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Does +other+ match this platform? If +other+ is a String it will be
|
# Does +other+ match this platform? If +other+ is a String it will be
|
||||||
# converted to a Gem::Platform first. See #=== for matching rules.
|
# converted to a Gem::Platform first. See #=== for matching rules.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue