ruby-changes:73031
From: David <ko1@a...>
Date: Tue, 23 Aug 2022 05:50:44 +0900 (JST)
Subject: [ruby-changes:73031] 59f27445ea (master): [rubygems/rubygems] Implement extra rules for libc versioning
https://git.ruby-lang.org/ruby.git/commit/?id=59f27445ea From 59f27445eaf1f28b4c9769bbfd13e3a4bffa17da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 5 Aug 2022 16:16:34 +0200 Subject: [rubygems/rubygems] Implement extra rules for libc versioning https://github.com/rubygems/rubygems/commit/7e976d790a --- lib/rubygems/platform.rb | 4 ++-- test/rubygems/test_gem_platform.rb | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 78fff703a2..8c5e7993ca 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -102,7 +102,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L102 when /^dalvik(\d+)?$/ then [ "dalvik", $1 ] when /^dotnet$/ then [ "dotnet", nil ] when /^dotnet([\d.]*)/ then [ "dotnet", $1 ] - when /linux-?((?!gnu)\w+)?/ then [ "linux", $1 ] + when /linux-?(\w+)?/ then [ "linux", $1 ] when /mingw32/ then [ "mingw32", nil ] when /mingw-?(\w+)?/ then [ "mingw", $1 ] when /(mswin\d+)(\_(\d+))?/ then @@ -180,7 +180,7 @@ class Gem::Platform https://github.com/ruby/ruby/blob/trunk/lib/rubygems/platform.rb#L180 # version ( (@os != "linux" && (@version.nil? || other.version.nil?)) || - (@os == "linux" && (@version.nil? && !other.version.nil?)) || + (@os == "linux" && ((@version.nil? && ["gnu", "musl"].include?(other.version)) || (@version == "gnu" && other.version.nil?))) || @version == other.version ) end diff --git a/test/rubygems/test_gem_platform.rb b/test/rubygems/test_gem_platform.rb index 197f19e53c..e0e635e533 100644 --- a/test/rubygems/test_gem_platform.rb +++ b/test/rubygems/test_gem_platform.rb @@ -119,8 +119,8 @@ class TestGemPlatform < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_platform.rb#L119 "i586-linux" => ["x86", "linux", nil], "i486-linux" => ["x86", "linux", nil], "i386-linux" => ["x86", "linux", nil], - "i586-linux-gnu" => ["x86", "linux", nil], - "i386-linux-gnu" => ["x86", "linux", nil], + "i586-linux-gnu" => ["x86", "linux", "gnu"], + "i386-linux-gnu" => ["x86", "linux", "gnu"], "i386-mingw32" => ["x86", "mingw32", nil], "x64-mingw-ucrt" => ["x64", "mingw", "ucrt"], "i386-mswin32" => ["x86", "mswin32", nil], @@ -135,7 +135,7 @@ class TestGemPlatform < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_platform.rb#L135 "i386-solaris2.8" => ["x86", "solaris", "2.8"], "mswin32" => ["x86", "mswin32", nil], "x86_64-linux" => ["x86_64", "linux", nil], - "x86_64-linux-gnu" => ["x86_64", "linux", nil], + "x86_64-linux-gnu" => ["x86_64", "linux", "gnu"], "x86_64-linux-musl" => ["x86_64", "linux", "musl"], "x86_64-linux-uclibc" => ["x86_64", "linux", "uclibc"], "x86_64-openbsd3.9" => ["x86_64", "openbsd", "3.9"], @@ -283,6 +283,10 @@ class TestGemPlatform < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_platform.rb#L283 assert(x86_linux === x86_linux_gnu, "linux =~ linux-gnu") assert(x86_linux_gnu === x86_linux, "linux-gnu =~ linux") + # musl and explicit gnu should differ + refute(x86_linux_gnu === x86_linux_musl, "linux-gnu =~ linux-musl") + refute(x86_linux_musl === x86_linux_gnu, "linux-musl =~ linux-gnu") + # explicit libc differ refute(x86_linux_uclibc === x86_linux_musl, "linux-uclibc =~ linux-musl") refute(x86_linux_musl === x86_linux_uclibc, "linux-musl =~ linux-uclibc") @@ -291,6 +295,10 @@ class TestGemPlatform < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_platform.rb#L295 assert(x86_linux === x86_linux_musl, "linux =~ linux-musl") # ...but implicit gnu runtime generally does not accept musl-specific gems refute(x86_linux_musl === x86_linux, "linux-musl =~ linux") + + # other libc are not glibc compatible + refute(x86_linux === x86_linux_uclibc, "linux =~ linux-uclibc") + refute(x86_linux_uclibc === x86_linux, "linux-uclibc =~ linux") end def test_equals3_cpu_arm -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/