1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Fix matching of eabihf platforms

https://github.com/rubygems/rubygems/commit/a03d30cd58
This commit is contained in:
David Rodríguez 2022-09-29 20:31:23 +02:00 committed by git
parent 8252ea2140
commit f04d249e83
3 changed files with 12 additions and 4 deletions

View file

@ -261,7 +261,7 @@ module Gem
# version # version
( (
(@os != "linux" && (@version.nil? || other.version.nil?)) || (@os != "linux" && (@version.nil? || other.version.nil?)) ||
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || other.version == "musl#{@version}" || other.version == "musleabi#{@version}")) || (@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
@version == other.version @version == other.version
) )
end end
@ -271,7 +271,7 @@ module Gem
def normalized_linux_version_ext def normalized_linux_version_ext
return nil unless @version return nil unless @version
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi\Z/, "") without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
return nil if without_gnu_nor_abi_modifiers.empty? return nil if without_gnu_nor_abi_modifiers.empty?
without_gnu_nor_abi_modifiers without_gnu_nor_abi_modifiers

View file

@ -181,7 +181,7 @@ class Gem::Platform
# version # version
( (
(@os != "linux" && (@version.nil? || other.version.nil?)) || (@os != "linux" && (@version.nil? || other.version.nil?)) ||
(@os == "linux" && (normalized_linux_version == other.normalized_linux_version || other.version == "musl#{@version}" || other.version == "musleabi#{@version}")) || (@os == "linux" && (normalized_linux_version == other.normalized_linux_version || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
@version == other.version @version == other.version
) )
end end
@ -189,7 +189,7 @@ class Gem::Platform
def normalized_linux_version def normalized_linux_version
return nil unless @version return nil unless @version
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi\Z/, "") without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
return nil if without_gnu_nor_abi_modifiers.empty? return nil if without_gnu_nor_abi_modifiers.empty?
without_gnu_nor_abi_modifiers without_gnu_nor_abi_modifiers

View file

@ -336,21 +336,29 @@ class TestGemPlatform < Gem::TestCase
def test_eabi_and_nil_version_combination_strictness def test_eabi_and_nil_version_combination_strictness
arm_linux = Gem::Platform.new "arm-linux" arm_linux = Gem::Platform.new "arm-linux"
arm_linux_eabi = Gem::Platform.new "arm-linux-eabi" arm_linux_eabi = Gem::Platform.new "arm-linux-eabi"
arm_linux_eabihf = Gem::Platform.new "arm-linux-eabihf"
arm_linux_gnueabi = Gem::Platform.new "arm-linux-gnueabi" arm_linux_gnueabi = Gem::Platform.new "arm-linux-gnueabi"
arm_linux_gnueabihf = Gem::Platform.new "arm-linux-gnueabihf"
arm_linux_musleabi = Gem::Platform.new "arm-linux-musleabi" arm_linux_musleabi = Gem::Platform.new "arm-linux-musleabi"
arm_linux_musleabihf = Gem::Platform.new "arm-linux-musleabihf"
arm_linux_uclibceabi = Gem::Platform.new "arm-linux-uclibceabi" arm_linux_uclibceabi = Gem::Platform.new "arm-linux-uclibceabi"
arm_linux_uclibceabihf = Gem::Platform.new "arm-linux-uclibceabihf"
# generic arm host runtime with eabi modifier accepts generic arm gems # generic arm host runtime with eabi modifier accepts generic arm gems
assert(arm_linux === arm_linux_eabi, "arm-linux =~ arm-linux-eabi") assert(arm_linux === arm_linux_eabi, "arm-linux =~ arm-linux-eabi")
assert(arm_linux === arm_linux_eabihf, "arm-linux =~ arm-linux-eabihf")
# explicit gnu arm host runtime with eabi modifier accepts generic arm gems # explicit gnu arm host runtime with eabi modifier accepts generic arm gems
assert(arm_linux === arm_linux_gnueabi, "arm-linux =~ arm-linux-gnueabi") assert(arm_linux === arm_linux_gnueabi, "arm-linux =~ arm-linux-gnueabi")
assert(arm_linux === arm_linux_gnueabihf, "arm-linux =~ arm-linux-gnueabihf")
# musl arm host runtime accepts libc-generic or statically linked gems... # musl arm host runtime accepts libc-generic or statically linked gems...
assert(arm_linux === arm_linux_musleabi, "arm-linux =~ arm-linux-musleabi") assert(arm_linux === arm_linux_musleabi, "arm-linux =~ arm-linux-musleabi")
assert(arm_linux === arm_linux_musleabihf, "arm-linux =~ arm-linux-musleabihf")
# other libc arm hosts are not glibc compatible # other libc arm hosts are not glibc compatible
refute(arm_linux === arm_linux_uclibceabi, "arm-linux =~ arm-linux-uclibceabi") refute(arm_linux === arm_linux_uclibceabi, "arm-linux =~ arm-linux-uclibceabi")
refute(arm_linux === arm_linux_uclibceabihf, "arm-linux =~ arm-linux-uclibceabihf")
end end
def test_equals3_cpu_arm def test_equals3_cpu_arm