mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] Make sure to not re-resolve when a not fully specific local platform is locked
36a02c6128
This commit is contained in:
parent
c6a28b02c9
commit
758e01d39d
2 changed files with 42 additions and 1 deletions
|
@ -621,11 +621,13 @@ module Bundler
|
|||
end
|
||||
|
||||
def start_resolution
|
||||
@platforms |= [local_platform]
|
||||
|
||||
result = SpecSet.new(resolver.start)
|
||||
|
||||
@resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
|
||||
|
||||
if @current_ruby_locked_platform && @current_ruby_locked_platform != local_platform
|
||||
if most_specific_ruby_locked_platform_is_not_local_platform?
|
||||
@platforms.delete(result.incomplete_for_platform?(dependencies, @current_ruby_locked_platform) ? @current_ruby_locked_platform : local_platform)
|
||||
end
|
||||
|
||||
|
@ -667,10 +669,15 @@ module Bundler
|
|||
|
||||
def add_current_platform
|
||||
@current_ruby_locked_platform = most_specific_locked_platform if current_ruby_platform_locked?
|
||||
return if most_specific_ruby_locked_platform_is_not_local_platform?
|
||||
|
||||
add_platform(local_platform)
|
||||
end
|
||||
|
||||
def most_specific_ruby_locked_platform_is_not_local_platform?
|
||||
@current_ruby_locked_platform && @current_ruby_locked_platform != local_platform
|
||||
end
|
||||
|
||||
def change_reason
|
||||
if unlocking?
|
||||
unlock_targets = if @gems_to_unlock.any?
|
||||
|
|
|
@ -1434,6 +1434,40 @@ RSpec.describe "bundle install with specific platforms" do
|
|||
end
|
||||
end
|
||||
|
||||
it "does not re-resolve when a specific platform, but less specific than the current platform, is locked" do
|
||||
build_repo4 do
|
||||
build_gem "nokogiri"
|
||||
end
|
||||
|
||||
gemfile <<~G
|
||||
source "#{file_uri_for(gem_repo4)}"
|
||||
|
||||
gem "nokogiri"
|
||||
G
|
||||
|
||||
lockfile <<~L
|
||||
GEM
|
||||
remote: #{file_uri_for(gem_repo4)}/
|
||||
specs:
|
||||
nokogiri (1.0)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin
|
||||
|
||||
DEPENDENCIES
|
||||
nokogiri!
|
||||
|
||||
BUNDLED WITH
|
||||
#{Bundler::VERSION}
|
||||
L
|
||||
|
||||
simulate_platform "arm64-darwin-23" do
|
||||
bundle "install --verbose"
|
||||
|
||||
expect(out).to include("Found no changes, using resolution from the lockfile")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def setup_multiplatform_gem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue