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

[rubygems/rubygems] Fix gem install still choosing musl incorrectly

https://github.com/rubygems/rubygems/commit/1b9f7f50a5
This commit is contained in:
David Rodríguez 2022-08-05 13:24:24 +02:00 committed by git
parent 06ae78f8fb
commit 492e70c7b4
2 changed files with 36 additions and 1 deletions

View file

@ -25,7 +25,7 @@ class Gem::Platform
platforms.any? do |local_platform|
platform.nil? ||
local_platform == platform ||
(local_platform != Gem::Platform::RUBY && local_platform =~ platform)
(local_platform != Gem::Platform::RUBY && platform =~ local_platform)
end
end
private_class_method :match_platforms?

View file

@ -356,6 +356,41 @@ class TestGemResolver < Gem::TestCase
assert_resolves_to [a2_p1.spec], res
end
def test_does_not_pick_musl_variants_on_non_musl_linux
util_set_arch "aarch64-linux" do
is = Gem::Resolver::IndexSpecification
linux_musl = Gem::Platform.new("aarch64-linux-musl")
spec_fetcher do |fetcher|
fetcher.spec "libv8-node", "15.14.0.1" do |s|
s.platform = Gem::Platform.local
end
fetcher.spec "libv8-node", "15.14.0.1" do |s|
s.platform = linux_musl
end
end
v15 = v("15.14.0.1")
source = Gem::Source.new @gem_repo
s = set
v15_linux = is.new s, "libv8-node", v15, source, Gem::Platform.local.to_s
v15_linux_musl = is.new s, "libv8-node", v15, source, linux_musl.to_s
s.add v15_linux
s.add v15_linux_musl
ad = make_dep "libv8-node", "= 15.14.0.1"
res = Gem::Resolver.new([ad], s)
assert_resolves_to [v15_linux.spec], res
end
end
def test_only_returns_spec_once
a1 = util_spec "a", "1", "c" => "= 1"
b1 = util_spec "b", "1", "c" => "= 1"