ruby-changes:71019
From: David <ko1@a...>
Date: Wed, 26 Jan 2022 13:09:47 +0900 (JST)
Subject: [ruby-changes:71019] c925d3b668 (master): [rubygems/rubygems] Fix `force_ruby_platform` ignored when lockfile includes the current specific platform
https://git.ruby-lang.org/ruby.git/commit/?id=c925d3b668 From c925d3b6689515f76dcfbb1dc419746dac6f0738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Mon, 24 Jan 2022 12:04:11 +0100 Subject: [rubygems/rubygems] Fix `force_ruby_platform` ignored when lockfile includes the current specific platform https://github.com/rubygems/rubygems/commit/9ca371adf8 --- lib/bundler/definition.rb | 1 + spec/bundler/runtime/platform_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index c31c41f76d4..b4a860f519d 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -496,6 +496,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L496 def current_ruby_platform_locked? return false unless generic_local_platform == Gem::Platform::RUBY + return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY) current_platform_locked? end diff --git a/spec/bundler/runtime/platform_spec.rb b/spec/bundler/runtime/platform_spec.rb index b937de80592..f7159635e6e 100644 --- a/spec/bundler/runtime/platform_spec.rb +++ b/spec/bundler/runtime/platform_spec.rb @@ -232,6 +232,20 @@ RSpec.describe "Bundler.setup with multi platform stuff" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/runtime/platform_spec.rb#L232 expect(the_bundle).to include_gems "nokogiri 1.4.2", "platform_specific 1.0 RUBY" end + it "allows specifying only-ruby-platform even if the lockfile is locked to a specific compatible platform" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem "nokogiri" + gem "platform_specific" + G + + bundle "config set force_ruby_platform true" + + bundle "install" + + expect(the_bundle).to include_gems "nokogiri 1.4.2", "platform_specific 1.0 RUBY" + end + it "doesn't pull platform specific gems on truffleruby", :truffleruby do install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/