[rubygems/rubygems] Restrict generic arm to only match 32-bit arm

https://github.com/rubygems/rubygems/commit/14c4c16e96
This commit is contained in:
なつき 2024-07-03 11:19:25 -07:00 committed by git
parent cd1ea98bdc
commit 88a2a46e23
3 changed files with 12 additions and 3 deletions

View File

@ -258,7 +258,7 @@ module Gem
# cpu
([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
(@cpu == "arm" && other.cpu.start_with?("arm"))) &&
(@cpu == "arm" && other.cpu.start_with?("armv"))) &&
# os
@os == other.os &&

View File

@ -177,7 +177,7 @@ class Gem::Platform
# they have the same version, or either one has no version
#
# Additionally, the platform will match if the local CPU is 'arm' and the
# other CPU starts with "arm" (for generic ARM family support).
# other CPU starts with "armv" (for generic 32-bit ARM family support).
#
# Of note, this method is not commutative. Indeed the OS 'linux' has a
# special case: the version is the libc name, yet while "no version" stands
@ -198,7 +198,7 @@ class Gem::Platform
# cpu
([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
(@cpu == "arm" && other.cpu.start_with?("arm"))) &&
(@cpu == "arm" && other.cpu.start_with?("armv"))) &&
# os
@os == other.os &&

View File

@ -368,18 +368,27 @@ class TestGemPlatform < Gem::TestCase
arm = Gem::Platform.new "arm-linux"
armv5 = Gem::Platform.new "armv5-linux"
armv7 = Gem::Platform.new "armv7-linux"
arm64 = Gem::Platform.new "arm64-linux"
util_set_arch "armv5-linux"
assert((arm === Gem::Platform.local), "arm === armv5")
assert((armv5 === Gem::Platform.local), "armv5 === armv5")
refute((armv7 === Gem::Platform.local), "armv7 === armv5")
refute((arm64 === Gem::Platform.local), "arm64 === armv5")
refute((Gem::Platform.local === arm), "armv5 === arm")
util_set_arch "armv7-linux"
assert((arm === Gem::Platform.local), "arm === armv7")
refute((armv5 === Gem::Platform.local), "armv5 === armv7")
assert((armv7 === Gem::Platform.local), "armv7 === armv7")
refute((arm64 === Gem::Platform.local), "arm64 === armv7")
refute((Gem::Platform.local === arm), "armv7 === arm")
util_set_arch "arm64-linux"
refute((arm === Gem::Platform.local), "arm === arm64")
refute((armv5 === Gem::Platform.local), "armv5 === arm64")
refute((armv7 === Gem::Platform.local), "armv7 === arm64")
assert((arm64 === Gem::Platform.local), "arm64 === arm64")
end
def test_equals3_universal_mingw