Skip to content

Commit a03d30c

Browse files
Fix matching of eabihf platforms
1 parent 89362c1 commit a03d30c

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

bundler/lib/bundler/rubygems_ext.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def ===(other)
261261
# version
262262
(
263263
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
264-
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || other.version == "musl#{@version}" || other.version == "musleabi#{@version}")) ||
264+
(@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
265265
@version == other.version
266266
)
267267
end
@@ -271,7 +271,7 @@ def ===(other)
271271
def normalized_linux_version_ext
272272
return nil unless @version
273273

274-
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi\Z/, "")
274+
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
275275
return nil if without_gnu_nor_abi_modifiers.empty?
276276

277277
without_gnu_nor_abi_modifiers

lib/rubygems/platform.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ def ===(other)
181181
# version
182182
(
183183
(@os != "linux" && (@version.nil? || other.version.nil?)) ||
184-
(@os == "linux" && (normalized_linux_version == other.normalized_linux_version || other.version == "musl#{@version}" || other.version == "musleabi#{@version}")) ||
184+
(@os == "linux" && (normalized_linux_version == other.normalized_linux_version || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
185185
@version == other.version
186186
)
187187
end
188188

189189
def normalized_linux_version
190190
return nil unless @version
191191

192-
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi\Z/, "")
192+
without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
193193
return nil if without_gnu_nor_abi_modifiers.empty?
194194

195195
without_gnu_nor_abi_modifiers

test/rubygems/test_gem_platform.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,21 +336,29 @@ def test_eabi_version_is_stricter_for_linux_os
336336
def test_eabi_and_nil_version_combination_strictness
337337
arm_linux = Gem::Platform.new "arm-linux"
338338
arm_linux_eabi = Gem::Platform.new "arm-linux-eabi"
339+
arm_linux_eabihf = Gem::Platform.new "arm-linux-eabihf"
339340
arm_linux_gnueabi = Gem::Platform.new "arm-linux-gnueabi"
341+
arm_linux_gnueabihf = Gem::Platform.new "arm-linux-gnueabihf"
340342
arm_linux_musleabi = Gem::Platform.new "arm-linux-musleabi"
343+
arm_linux_musleabihf = Gem::Platform.new "arm-linux-musleabihf"
341344
arm_linux_uclibceabi = Gem::Platform.new "arm-linux-uclibceabi"
345+
arm_linux_uclibceabihf = Gem::Platform.new "arm-linux-uclibceabihf"
342346

343347
# generic arm host runtime with eabi modifier accepts generic arm gems
344348
assert(arm_linux === arm_linux_eabi, "arm-linux =~ arm-linux-eabi")
349+
assert(arm_linux === arm_linux_eabihf, "arm-linux =~ arm-linux-eabihf")
345350

346351
# explicit gnu arm host runtime with eabi modifier accepts generic arm gems
347352
assert(arm_linux === arm_linux_gnueabi, "arm-linux =~ arm-linux-gnueabi")
353+
assert(arm_linux === arm_linux_gnueabihf, "arm-linux =~ arm-linux-gnueabihf")
348354

349355
# musl arm host runtime accepts libc-generic or statically linked gems...
350356
assert(arm_linux === arm_linux_musleabi, "arm-linux =~ arm-linux-musleabi")
357+
assert(arm_linux === arm_linux_musleabihf, "arm-linux =~ arm-linux-musleabihf")
351358

352359
# other libc arm hosts are not glibc compatible
353360
refute(arm_linux === arm_linux_uclibceabi, "arm-linux =~ arm-linux-uclibceabi")
361+
refute(arm_linux === arm_linux_uclibceabihf, "arm-linux =~ arm-linux-uclibceabihf")
354362
end
355363

356364
def test_equals3_cpu_arm

0 commit comments

Comments
 (0)