Skip to content

Commit d766ece

Browse files
hsbtk0kubun
authored andcommitted
Merge RubyGems-3.6.8 and Bundler-2.6.8
1 parent 8125827 commit d766ece

File tree

18 files changed

+367
-137
lines changed

18 files changed

+367
-137
lines changed

lib/bundler/definition.rb

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,7 @@ def resolve
337337
end
338338
end
339339
else
340-
if lockfile_exists?
341-
Bundler.ui.debug "Found changes from the lockfile, re-resolving dependencies because #{change_reason}"
342-
else
343-
Bundler.ui.debug "Resolving dependencies because there's no lockfile"
344-
end
340+
Bundler.ui.debug resolve_needed_reason
345341

346342
start_resolution
347343
end
@@ -465,7 +461,7 @@ def validate_platforms!
465461
end
466462

467463
def normalize_platforms
468-
@platforms = resolve.normalize_platforms!(current_dependencies, platforms)
464+
resolve.normalize_platforms!(current_dependencies, platforms)
469465

470466
@resolve = SpecSet.new(resolve.for(current_dependencies, @platforms))
471467
end
@@ -537,9 +533,7 @@ def lockfile_changes_summary(update_refused_reason)
537533

538534
return unless added.any? || deleted.any? || changed.any? || resolve_needed?
539535

540-
reason = resolve_needed? ? change_reason : "some dependencies were deleted from your gemfile"
541-
542-
msg = String.new("#{reason.capitalize.strip}, but ")
536+
msg = String.new("#{change_reason.capitalize.strip}, but ")
543537
msg << "the lockfile " unless msg.start_with?("Your lockfile")
544538
msg << "can't be updated because #{update_refused_reason}"
545539
msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
@@ -796,22 +790,47 @@ def find_most_specific_locked_platform
796790
@most_specific_locked_platform
797791
end
798792

799-
def change_reason
800-
if unlocking?
801-
unlock_targets = if @gems_to_unlock.any?
802-
["gems", @gems_to_unlock]
803-
elsif @sources_to_unlock.any?
804-
["sources", @sources_to_unlock]
793+
def resolve_needed_reason
794+
if lockfile_exists?
795+
if unlocking?
796+
"Re-resolving dependencies because #{unlocking_reason}"
797+
else
798+
"Found changes from the lockfile, re-resolving dependencies because #{lockfile_changed_reason}"
805799
end
800+
else
801+
"Resolving dependencies because there's no lockfile"
802+
end
803+
end
806804

807-
unlock_reason = if unlock_targets
808-
"#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
805+
def change_reason
806+
if resolve_needed?
807+
if unlocking?
808+
unlocking_reason
809809
else
810-
@unlocking_ruby ? "ruby" : ""
810+
lockfile_changed_reason
811811
end
812+
else
813+
"some dependencies were deleted from your gemfile"
814+
end
815+
end
812816

813-
return "bundler is unlocking #{unlock_reason}"
817+
def unlocking_reason
818+
unlock_targets = if @gems_to_unlock.any?
819+
["gems", @gems_to_unlock]
820+
elsif @sources_to_unlock.any?
821+
["sources", @sources_to_unlock]
814822
end
823+
824+
unlock_reason = if unlock_targets
825+
"#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
826+
else
827+
@unlocking_ruby ? "ruby" : ""
828+
end
829+
830+
"bundler is unlocking #{unlock_reason}"
831+
end
832+
833+
def lockfile_changed_reason
815834
[
816835
[@source_changes, "the list of sources changed"],
817836
[@dependency_changes, "the dependencies in your gemfile changed"],

lib/bundler/friendly_errors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def request_issue_report_for(e)
8080
First, try this link to see if there are any existing issue reports for this error:
8181
#{issues_url(e)}
8282
83-
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}, and copy and paste the report template above in there.
83+
If there aren't any reports for this error yet, please fill in the new issue form located at #{new_issue_url}. Make sure to copy and paste the full output of this command under the "What happened instead?" section.
8484
EOS
8585
end
8686

lib/bundler/installer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def installation_parallelization
212212
def load_plugins
213213
Gem.load_plugins
214214

215-
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
215+
requested_path_gems = @definition.specs.select {|s| s.source.is_a?(Source::Path) }
216216
path_plugin_files = requested_path_gems.flat_map do |spec|
217217
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
218218
rescue TypeError

lib/bundler/spec_set.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def for(dependencies, platforms_or_legacy_check = [nil], legacy_platforms = [nil
2929
end
3030

3131
def normalize_platforms!(deps, platforms)
32-
complete_platforms = add_extra_platforms!(platforms)
32+
add_extra_platforms!(platforms)
3333

34-
complete_platforms.map do |platform|
34+
platforms.map! do |platform|
3535
next platform if platform == Gem::Platform::RUBY
3636

3737
begin
@@ -44,7 +44,7 @@ def normalize_platforms!(deps, platforms)
4444
next platform if incomplete_for_platform?(deps, less_specific_platform)
4545

4646
less_specific_platform
47-
end.uniq
47+
end.uniq!
4848
end
4949

5050
def add_originally_invalid_platforms!(platforms, originally_invalid_platforms)
@@ -68,6 +68,7 @@ def add_extra_platforms!(platforms)
6868
return if new_platforms.empty?
6969

7070
platforms.concat(new_platforms)
71+
return if new_platforms.include?(Bundler.local_platform)
7172

7273
less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && Bundler.local_platform === platform && platform === Bundler.local_platform }
7374
platforms.delete(Bundler.local_platform) if less_specific_platform
@@ -180,7 +181,7 @@ def delete_by_name(name)
180181
end
181182

182183
def version_for(name)
183-
self[name].first&.version
184+
exemplary_spec(name)&.version
184185
end
185186

186187
def what_required(spec)
@@ -285,8 +286,13 @@ def all_platforms
285286
end
286287

287288
def additional_variants_from(other)
288-
other.select do |spec|
289-
version_for(spec.name) == spec.version && valid_dependencies?(spec)
289+
other.select do |other_spec|
290+
spec = exemplary_spec(other_spec.name)
291+
next unless spec
292+
293+
selected = spec.version == other_spec.version && valid_dependencies?(other_spec)
294+
other_spec.source = spec.source if selected
295+
selected
290296
end
291297
end
292298

@@ -363,5 +369,9 @@ def index_spec(hash, key, value)
363369
hash[key] ||= []
364370
hash[key] << value
365371
end
372+
373+
def exemplary_spec(name)
374+
self[name].first
375+
end
366376
end
367377
end

lib/bundler/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22

33
module Bundler
4-
VERSION = "2.6.7".freeze
4+
VERSION = "2.6.8".freeze
55

66
def self.bundler_major_version
77
@bundler_major_version ||= VERSION.split(".").first.to_i

lib/rubygems.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
require "rbconfig"
1010

1111
module Gem
12-
VERSION = "3.6.7"
12+
VERSION = "3.6.8"
1313
end
1414

1515
# Must be first since it unloads the prelude from 1.9.2

spec/bundler/bin/parallel_rspec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require_relative "../bundler/support/setup"
5+
6+
require "turbo_tests"
7+
TurboTests::CLI.new(ARGV).run

0 commit comments

Comments
 (0)