rubygems-update 3.6.3 → 3.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/bundler/CHANGELOG.md +42 -0
  4. data/bundler/README.md +1 -1
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/console.rb +8 -6
  7. data/bundler/lib/bundler/cli/doctor.rb +9 -5
  8. data/bundler/lib/bundler/cli/info.rb +4 -4
  9. data/bundler/lib/bundler/cli/issue.rb +1 -1
  10. data/bundler/lib/bundler/cli/show.rb +1 -1
  11. data/bundler/lib/bundler/current_ruby.rb +23 -33
  12. data/bundler/lib/bundler/definition.rb +70 -68
  13. data/bundler/lib/bundler/dependency.rb +92 -47
  14. data/bundler/lib/bundler/dsl.rb +83 -78
  15. data/bundler/lib/bundler/endpoint_specification.rb +10 -3
  16. data/bundler/lib/bundler/errors.rb +4 -0
  17. data/bundler/lib/bundler/gem_helpers.rb +4 -10
  18. data/bundler/lib/bundler/gem_version_promoter.rb +0 -2
  19. data/bundler/lib/bundler/installer.rb +1 -1
  20. data/bundler/lib/bundler/lazy_specification.rb +50 -45
  21. data/bundler/lib/bundler/match_metadata.rb +13 -0
  22. data/bundler/lib/bundler/resolver/package.rb +7 -3
  23. data/bundler/lib/bundler/resolver/spec_group.rb +1 -25
  24. data/bundler/lib/bundler/resolver.rb +12 -3
  25. data/bundler/lib/bundler/rubygems_ext.rb +82 -81
  26. data/bundler/lib/bundler/rubygems_integration.rb +2 -3
  27. data/bundler/lib/bundler/runtime.rb +19 -24
  28. data/bundler/lib/bundler/source/rubygems.rb +19 -4
  29. data/bundler/lib/bundler/source.rb +2 -0
  30. data/bundler/lib/bundler/source_list.rb +4 -0
  31. data/bundler/lib/bundler/spec_set.rb +50 -27
  32. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -0
  33. data/bundler/lib/bundler/version.rb +1 -1
  34. data/lib/rubygems/command.rb +0 -3
  35. data/lib/rubygems/requirement.rb +5 -3
  36. data/lib/rubygems/specification.rb +4 -6
  37. data/lib/rubygems.rb +1 -1
  38. data/rubygems-update.gemspec +1 -1
  39. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05b48c959a72f6c09600fc229b86f0587fe2e308d407ebbe7a3d2444d77ce4b6
4
- data.tar.gz: ec85019892569d684769e03bedd955c668fec081214e8514427ae1d20d2e3cac
3
+ metadata.gz: 5d1ec8a0b30ce414d0ea85439f4759b5142e0d75936af1cb6942f99487de49da
4
+ data.tar.gz: b9298777fcbf694f471da4b1ca6e2a533e21d50358b601cf6b040ee5c0ffb828
5
5
  SHA512:
6
- metadata.gz: cc9a21273636b54d13930fa08afa013f4d4797856ffb54834e8db61361d2338e0566d6c66523574fb3be687f023b324eb1743d3e207edeb9683e2a2726676788
7
- data.tar.gz: ca935beea58e18ebf286292958f9abcf9ce2872f4792d30ee132505980e4edd128a9cfde5c52534ba4b42537906f018adfec0ead0be34b6ccc10ba8e1c1adf25
6
+ metadata.gz: 47499f9c05064f71bd1fa0819a47bce356b3495923cc8920a56677667a64811ec44e328079b549a8b53d1b6a8a9bed3a28ee6c82f0f959754a2405b8fce196b4
7
+ data.tar.gz: 4190fea70cdfdf8e212c7c7fe6c5e71a6228b1235bb5d9f229bfae52a514f43331df82232bef5085d11907cc14ee522f40e9af60b4c3b54ae4ee81dc021127f1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ # 3.6.5 / 2025-02-20
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.6.5 as a default gem.
6
+
7
+ ## Documentation:
8
+
9
+ * Removed `gem server` from `gem help`. Pull request
10
+ [#8507](https://github.com/rubygems/rubygems/pull/8507) by hsbt
11
+
12
+ # 3.6.4 / 2025-02-17
13
+
14
+ ## Enhancements:
15
+
16
+ * Raise a simpler error when RubyGems fails to activate a dependency. Pull
17
+ request [#8449](https://github.com/rubygems/rubygems/pull/8449) by
18
+ deivid-rodriguez
19
+ * Installs bundler 2.6.4 as a default gem.
20
+
21
+ ## Performance:
22
+
23
+ * Allocate strings from Requirement match only once. Pull request
24
+ [#8245](https://github.com/rubygems/rubygems/pull/8245) by segiddins
25
+
1
26
  # 3.6.3 / 2025-01-16
2
27
 
3
28
  ## Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ # 2.6.5 (February 20, 2025)
2
+
3
+ ## Enhancements:
4
+
5
+ - Fix lockfile platforms inconveniently added on JRuby [#8494](https://github.com/rubygems/rubygems/pull/8494)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix resolver issue due to ill-defined version ranges being created [#8503](https://github.com/rubygems/rubygems/pull/8503)
10
+ - Make sure empty gems are not reinstalled every time [#8502](https://github.com/rubygems/rubygems/pull/8502)
11
+
12
+ # 2.6.4 (February 17, 2025)
13
+
14
+ ## Enhancements:
15
+
16
+ - Make Bundler never instantiate development dependencies [#8486](https://github.com/rubygems/rubygems/pull/8486)
17
+ - Fix some invalid options to `gem` DSL not getting reported as invalid [#8480](https://github.com/rubygems/rubygems/pull/8480)
18
+ - Add `irb` to a Gemfile for a newly created gem [#8467](https://github.com/rubygems/rubygems/pull/8467)
19
+ - Auto-heal empty installation directory [#8457](https://github.com/rubygems/rubygems/pull/8457)
20
+ - Fix `bundle console` unnecessarily trying to load IRB twice [#8443](https://github.com/rubygems/rubygems/pull/8443)
21
+ - Add ruby_34 and ruby_35 as valid platform: [#8430](https://github.com/rubygems/rubygems/pull/8430)
22
+ - Consider gems under `platform: :windows` filter in Gemfile when running on Windows with ARM architecture [#8428](https://github.com/rubygems/rubygems/pull/8428)
23
+
24
+ ## Bug fixes:
25
+
26
+ - Fix regression when running `bundle update <foo>` would sometimes downgrade a top level dependency [#8491](https://github.com/rubygems/rubygems/pull/8491)
27
+ - Fix dependency locking when Bundler finds incorrect lockfile dependencies [#8489](https://github.com/rubygems/rubygems/pull/8489)
28
+ - Raise error when lockfile is missing deps in frozen mode [#8483](https://github.com/rubygems/rubygems/pull/8483)
29
+ - Fix `bundle install --prefer-local` sometimes installing very old versions [#8484](https://github.com/rubygems/rubygems/pull/8484)
30
+ - Fix incorrect error message when running `bundle update` in frozen mode [#8481](https://github.com/rubygems/rubygems/pull/8481)
31
+ - Keep platform variants in `vendor/cache` even if incompatible with the current Ruby version [#8471](https://github.com/rubygems/rubygems/pull/8471)
32
+ - Fix `bundle console` printing bug report template incorrectly [#8436](https://github.com/rubygems/rubygems/pull/8436)
33
+ - Fix `--prefer-local` not respecting default gems [#8412](https://github.com/rubygems/rubygems/pull/8412)
34
+
35
+ ## Performance:
36
+
37
+ - Improve resolution performance [#8458](https://github.com/rubygems/rubygems/pull/8458)
38
+
39
+ ## Documentation:
40
+
41
+ - Fix more broken links [#8416](https://github.com/rubygems/rubygems/pull/8416)
42
+
1
43
  # 2.6.3 (January 16, 2025)
2
44
 
3
45
  ## Enhancements:
data/bundler/README.md CHANGED
@@ -41,7 +41,7 @@ To get in touch with the Bundler core team and other Bundler users, please join
41
41
 
42
42
  ### Contributing
43
43
 
44
- If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/README.md) with all of the information you need to get started.
44
+ If you'd like to contribute to Bundler, that's awesome, and we <3 you. We've put together [the Bundler contributor guide](https://github.com/rubygems/rubygems/blob/master/doc/bundler/contributing/README.md) with all of the information you need to get started.
45
45
 
46
46
  If you'd like to request a substantial change to Bundler or its documentation, refer to the [Bundler RFC process](https://github.com/rubygems/rfcs) for more information.
47
47
 
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2025-01-16".freeze
8
- @git_commit_sha = "3c7c4ff2d8f".freeze
7
+ @built_at = "2025-02-20".freeze
8
+ @git_commit_sha = "cffd973142d".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -20,9 +20,14 @@ module Bundler
20
20
  require name
21
21
  get_constant(name)
22
22
  rescue LoadError
23
- Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
24
- require "irb"
25
- get_constant("irb")
23
+ if name == "irb"
24
+ Bundler.ui.error "#{name} is not available"
25
+ exit 1
26
+ else
27
+ Bundler.ui.error "Couldn't load console #{name}, falling back to irb"
28
+ name = "irb"
29
+ retry
30
+ end
26
31
  end
27
32
 
28
33
  def get_constant(name)
@@ -32,9 +37,6 @@ module Bundler
32
37
  "irb" => :IRB,
33
38
  }[name]
34
39
  Object.const_get(const_name)
35
- rescue NameError
36
- Bundler.ui.error "Could not find constant #{const_name}"
37
- exit 1
38
40
  end
39
41
  end
40
42
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "rbconfig"
4
4
  require "shellwords"
5
- require "fiddle"
6
5
 
7
6
  module Bundler
8
7
  class CLI::Doctor
@@ -57,6 +56,14 @@ module Bundler
57
56
  Dir.glob("#{spec.full_gem_path}/**/*.bundle")
58
57
  end
59
58
 
59
+ def lookup_with_fiddle(path)
60
+ require "fiddle"
61
+ Fiddle.dlopen(path)
62
+ false
63
+ rescue Fiddle::DLError
64
+ true
65
+ end
66
+
60
67
  def check!
61
68
  require_relative "check"
62
69
  Bundler::CLI::Check.new({}).run
@@ -73,10 +80,7 @@ module Bundler
73
80
  definition.specs.each do |spec|
74
81
  bundles_for_gem(spec).each do |bundle|
75
82
  bad_paths = dylibs(bundle).select do |f|
76
- Fiddle.dlopen(f)
77
- false
78
- rescue Fiddle::DLError
79
- true
83
+ lookup_with_fiddle(f)
80
84
  end
81
85
  if bad_paths.any?
82
86
  broken_links[spec] ||= []
@@ -39,8 +39,8 @@ module Bundler
39
39
  path = File.expand_path("../../..", __dir__)
40
40
  else
41
41
  path = spec.full_gem_path
42
- if spec.deleted_gem?
43
- return Bundler.ui.warn "The gem #{name} has been deleted. It was installed at: #{path}"
42
+ if spec.installation_missing?
43
+ return Bundler.ui.warn "The gem #{name} is missing. It should be installed at #{path}, but was not found"
44
44
  end
45
45
  end
46
46
 
@@ -65,8 +65,8 @@ module Bundler
65
65
  gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem?
66
66
  gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any?
67
67
 
68
- if name != "bundler" && spec.deleted_gem?
69
- return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
68
+ if name != "bundler" && spec.installation_missing?
69
+ return Bundler.ui.warn "The gem #{name} is missing. Gemspec information is still available though:\n#{gem_info}"
70
70
  end
71
71
 
72
72
  Bundler.ui.info gem_info
@@ -10,7 +10,7 @@ module Bundler
10
10
  be sure to check out these resources:
11
11
 
12
12
  1. Check out our troubleshooting guide for quick fixes to common issues:
13
- https://github.com/rubygems/rubygems/blob/master/bundler/doc/TROUBLESHOOTING.md
13
+ https://github.com/rubygems/rubygems/blob/master/doc/bundler/TROUBLESHOOTING.md
14
14
 
15
15
  2. Instructions for common Bundler uses can be found on the documentation
16
16
  site: https://bundler.io/
@@ -24,7 +24,7 @@ module Bundler
24
24
  return unless spec
25
25
  path = spec.full_gem_path
26
26
  unless File.directory?(path)
27
- return Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at: #{path}"
27
+ return Bundler.ui.warn "The gem #{gem_name} is missing. It should be installed at #{path}, but was not found"
28
28
  end
29
29
  end
30
30
  return Bundler.ui.info(path)
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "rubygems_ext"
4
+
3
5
  module Bundler
4
6
  # Returns current version of Ruby
5
7
  #
@@ -9,38 +11,25 @@ module Bundler
9
11
  end
10
12
 
11
13
  class CurrentRuby
12
- KNOWN_MINOR_VERSIONS = %w[
13
- 1.8
14
- 1.9
15
- 2.0
16
- 2.1
17
- 2.2
18
- 2.3
19
- 2.4
20
- 2.5
21
- 2.6
22
- 2.7
23
- 3.0
24
- 3.1
25
- 3.2
26
- 3.3
27
- ].freeze
28
-
29
- KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
30
-
31
- KNOWN_PLATFORMS = %w[
32
- jruby
33
- maglev
34
- mingw
35
- mri
36
- mswin
37
- mswin64
38
- rbx
39
- ruby
40
- truffleruby
41
- windows
42
- x64_mingw
43
- ].freeze
14
+ ALL_RUBY_VERSIONS = (18..27).to_a.concat((30..35).to_a).freeze
15
+ KNOWN_MINOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.reverse.join(".") }.freeze
16
+ KNOWN_MAJOR_VERSIONS = ALL_RUBY_VERSIONS.map {|v| v.digits.last.to_s }.uniq.freeze
17
+ PLATFORM_MAP = {
18
+ ruby: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS],
19
+ mri: [Gem::Platform::RUBY, CurrentRuby::ALL_RUBY_VERSIONS],
20
+ rbx: [Gem::Platform::RUBY],
21
+ truffleruby: [Gem::Platform::RUBY],
22
+ jruby: [Gem::Platform::JAVA, [18, 19]],
23
+ windows: [Gem::Platform::WINDOWS, CurrentRuby::ALL_RUBY_VERSIONS],
24
+ # deprecated
25
+ mswin: [Gem::Platform::MSWIN, CurrentRuby::ALL_RUBY_VERSIONS],
26
+ mswin64: [Gem::Platform::MSWIN64, CurrentRuby::ALL_RUBY_VERSIONS - [18]],
27
+ mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS],
28
+ x64_mingw: [Gem::Platform::UNIVERSAL_MINGW, CurrentRuby::ALL_RUBY_VERSIONS - [18, 19]],
29
+ }.each_with_object({}) do |(platform, spec), hash|
30
+ hash[platform] = spec[0]
31
+ spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
32
+ end.freeze
44
33
 
45
34
  def ruby?
46
35
  return true if Bundler::GemHelpers.generic_local_platform_is_ruby?
@@ -82,7 +71,8 @@ module Bundler
82
71
  RUBY_VERSION.start_with?("#{version}.")
83
72
  end
84
73
 
85
- KNOWN_PLATFORMS.each do |platform|
74
+ all_platforms = PLATFORM_MAP.keys << "maglev"
75
+ all_platforms.each do |platform|
86
76
  define_method(:"#{platform}_#{trimmed_version}?") do
87
77
  send(:"#{platform}?") && send(:"on_#{trimmed_version}?")
88
78
  end
@@ -58,17 +58,28 @@ module Bundler
58
58
  # @param ruby_version [Bundler::RubyVersion, nil] Requested Ruby Version
59
59
  # @param optional_groups [Array(String)] A list of optional groups
60
60
  def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = [], gemfiles = [])
61
- if [true, false].include?(unlock)
61
+ unlock ||= {}
62
+
63
+ if unlock == true
64
+ @unlocking_all = true
62
65
  @unlocking_bundler = false
63
66
  @unlocking = unlock
67
+ @sources_to_unlock = []
68
+ @unlocking_ruby = false
69
+ @explicit_unlocks = []
70
+ conservative = false
64
71
  else
72
+ @unlocking_all = false
65
73
  @unlocking_bundler = unlock.delete(:bundler)
66
74
  @unlocking = unlock.any? {|_k, v| !Array(v).empty? }
75
+ @sources_to_unlock = unlock.delete(:sources) || []
76
+ @unlocking_ruby = unlock.delete(:ruby)
77
+ @explicit_unlocks = unlock.delete(:gems) || []
78
+ conservative = unlock.delete(:conservative)
67
79
  end
68
80
 
69
81
  @dependencies = dependencies
70
82
  @sources = sources
71
- @unlock = unlock
72
83
  @optional_groups = optional_groups
73
84
  @prefer_local = false
74
85
  @specs = nil
@@ -93,29 +104,24 @@ module Bundler
93
104
  @platforms = @locked_platforms.dup
94
105
  @locked_bundler_version = @locked_gems.bundler_version
95
106
  @locked_ruby_version = @locked_gems.ruby_version
96
- @originally_locked_deps = @locked_gems.dependencies
107
+ @locked_deps = @locked_gems.dependencies
97
108
  @originally_locked_specs = SpecSet.new(@locked_gems.specs)
98
109
  @locked_checksums = @locked_gems.checksums
99
110
 
100
- if unlock != true
101
- @locked_deps = @originally_locked_deps
102
- @locked_specs = @originally_locked_specs
103
- @locked_sources = @locked_gems.sources
104
- else
105
- @unlock = {}
106
- @locked_deps = {}
111
+ if @unlocking_all
107
112
  @locked_specs = SpecSet.new([])
108
113
  @locked_sources = []
114
+ else
115
+ @locked_specs = @originally_locked_specs
116
+ @locked_sources = @locked_gems.sources
109
117
  end
110
118
  else
111
- @unlock = {}
112
- @locked_gems = nil
119
+ @locked_gems = nil
113
120
  @locked_platforms = []
114
121
  @most_specific_locked_platform = nil
115
122
  @platforms = []
116
123
  @locked_deps = {}
117
124
  @locked_specs = SpecSet.new([])
118
- @originally_locked_deps = {}
119
125
  @originally_locked_specs = @locked_specs
120
126
  @locked_sources = []
121
127
  @locked_checksums = Bundler.feature_flag.lockfile_checksums?
@@ -134,11 +140,10 @@ module Bundler
134
140
  @sources.merged_gem_lockfile_sections!(locked_gem_sources.first)
135
141
  end
136
142
 
137
- @sources_to_unlock = @unlock.delete(:sources) || []
138
- @unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
143
+ @unlocking_ruby ||= if @ruby_version && locked_ruby_version_object
139
144
  @ruby_version.diff(locked_ruby_version_object)
140
145
  end
141
- @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
146
+ @unlocking ||= @unlocking_ruby ||= (!@locked_ruby_version ^ !@ruby_version)
142
147
 
143
148
  @current_platform_missing = add_current_platform unless Bundler.frozen_bundle?
144
149
 
@@ -146,9 +151,7 @@ module Bundler
146
151
  @path_changes = converge_paths
147
152
  @source_changes = converge_sources
148
153
 
149
- @explicit_unlocks = @unlock.delete(:gems) || []
150
-
151
- if @unlock[:conservative]
154
+ if conservative
152
155
  @gems_to_unlock = @explicit_unlocks.any? ? @explicit_unlocks : @dependencies.map(&:name)
153
156
  else
154
157
  eager_unlock = @explicit_unlocks.map {|name| Dependency.new(name, ">= 0") }
@@ -220,6 +223,8 @@ module Bundler
220
223
 
221
224
  def prefer_local!
222
225
  @prefer_local = true
226
+
227
+ sources.prefer_local!
223
228
  end
224
229
 
225
230
  # For given dependency list returns a SpecSet with Gemspec of all the required
@@ -374,7 +379,7 @@ module Bundler
374
379
 
375
380
  def locked_ruby_version
376
381
  return unless ruby_version
377
- if @unlock[:ruby] || !@locked_ruby_version
382
+ if @unlocking_ruby || !@locked_ruby_version
378
383
  Bundler::RubyVersion.system
379
384
  else
380
385
  @locked_ruby_version
@@ -435,23 +440,23 @@ module Bundler
435
440
  changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
436
441
  end
437
442
 
438
- reason = nothing_changed? ? "some dependencies were deleted from your gemfile" : change_reason
443
+ reason = resolve_needed? ? change_reason : "some dependencies were deleted from your gemfile"
439
444
  msg = String.new
440
445
  msg << "#{reason.capitalize.strip}, but the lockfile can't be updated because frozen mode is set"
441
446
  msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
442
447
  msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
443
448
  msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
444
- msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_gemfile_path} to version control.\n"
449
+ msg << "\n\nRun `bundle install` elsewhere and add the updated #{SharedHelpers.relative_gemfile_path} to version control.\n" unless unlocking?
445
450
 
446
451
  unless explicit_flag
447
452
  suggested_command = unless Bundler.settings.locations("frozen").keys.include?(:env)
448
453
  "bundle config set frozen false"
449
454
  end
450
- msg << "If this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} " \
455
+ msg << "\n\nIf this is a development machine, remove the #{SharedHelpers.relative_lockfile_path} " \
451
456
  "freeze by running `#{suggested_command}`." if suggested_command
452
457
  end
453
458
 
454
- raise ProductionError, msg if added.any? || deleted.any? || changed.any? || !nothing_changed?
459
+ raise ProductionError, msg if added.any? || deleted.any? || changed.any? || resolve_needed?
455
460
  end
456
461
 
457
462
  def validate_runtime!
@@ -485,7 +490,7 @@ module Bundler
485
490
  end
486
491
 
487
492
  def validate_platforms!
488
- return if current_platform_locked?
493
+ return if current_platform_locked? || @platforms.include?(Gem::Platform::RUBY)
489
494
 
490
495
  raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
491
496
  "but your local platform is #{local_platform}. " \
@@ -620,8 +625,8 @@ module Bundler
620
625
  @resolution_packages ||= begin
621
626
  last_resolve = converge_locked_specs
622
627
  remove_invalid_platforms!
623
- packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local)
624
- packages = additional_base_requirements_to_prevent_downgrades(packages, last_resolve)
628
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, locked_specs: @originally_locked_specs, unlock: @unlocking_all || @gems_to_unlock, prerelease: gem_version_promoter.pre?, prefer_local: @prefer_local, new_platforms: @new_platforms)
629
+ packages = additional_base_requirements_to_prevent_downgrades(packages)
625
630
  packages = additional_base_requirements_to_force_updates(packages)
626
631
  packages
627
632
  end
@@ -639,6 +644,8 @@ module Bundler
639
644
  specs = begin
640
645
  resolve.materialize(dependencies)
641
646
  rescue IncorrectLockfileDependencies => e
647
+ raise if Bundler.frozen_bundle?
648
+
642
649
  spec = e.spec
643
650
  raise "Infinite loop while fixing lockfile dependencies" if incorrect_spec == spec
644
651
 
@@ -724,7 +731,7 @@ module Bundler
724
731
  end
725
732
 
726
733
  def start_resolution
727
- local_platform_needed_for_resolvability = @most_specific_non_local_locked_ruby_platform && !@platforms.include?(local_platform)
734
+ local_platform_needed_for_resolvability = @most_specific_non_local_locked_platform && !@platforms.include?(local_platform)
728
735
  @platforms << local_platform if local_platform_needed_for_resolvability
729
736
  add_platform(Gem::Platform::RUBY) if RUBY_ENGINE == "truffleruby"
730
737
 
@@ -732,9 +739,9 @@ module Bundler
732
739
 
733
740
  @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
734
741
 
735
- if @most_specific_non_local_locked_ruby_platform
736
- if spec_set_incomplete_for_platform?(result, @most_specific_non_local_locked_ruby_platform)
737
- @platforms.delete(@most_specific_non_local_locked_ruby_platform)
742
+ if @most_specific_non_local_locked_platform
743
+ if spec_set_incomplete_for_platform?(result, @most_specific_non_local_locked_platform)
744
+ @platforms.delete(@most_specific_non_local_locked_platform)
738
745
  elsif local_platform_needed_for_resolvability
739
746
  @platforms.delete(local_platform)
740
747
  end
@@ -751,22 +758,23 @@ module Bundler
751
758
 
752
759
  def current_platform_locked?
753
760
  @platforms.any? do |bundle_platform|
754
- MatchPlatform.platforms_match?(bundle_platform, local_platform)
761
+ generic_local_platform == bundle_platform || local_platform === bundle_platform
755
762
  end
756
763
  end
757
764
 
758
765
  def add_current_platform
759
766
  return if @platforms.include?(local_platform)
760
767
 
761
- @most_specific_non_local_locked_ruby_platform = find_most_specific_locked_ruby_platform
762
- return if @most_specific_non_local_locked_ruby_platform
768
+ @most_specific_non_local_locked_platform = find_most_specific_locked_platform
769
+ return if @most_specific_non_local_locked_platform
763
770
 
771
+ @new_platforms << local_platform
764
772
  @platforms << local_platform
765
773
  true
766
774
  end
767
775
 
768
- def find_most_specific_locked_ruby_platform
769
- return unless generic_local_platform_is_ruby? && current_platform_locked?
776
+ def find_most_specific_locked_platform
777
+ return unless current_platform_locked?
770
778
 
771
779
  @most_specific_locked_platform
772
780
  end
@@ -782,7 +790,7 @@ module Bundler
782
790
  unlock_reason = if unlock_targets
783
791
  "#{unlock_targets.first}: (#{unlock_targets.last.join(", ")})"
784
792
  else
785
- @unlock[:ruby] ? "ruby" : ""
793
+ @unlocking_ruby ? "ruby" : ""
786
794
  end
787
795
 
788
796
  return "bundler is unlocking #{unlock_reason}"
@@ -852,8 +860,6 @@ module Bundler
852
860
  end
853
861
 
854
862
  def check_lockfile
855
- @missing_lockfile_dep = nil
856
-
857
863
  @locked_spec_with_invalid_deps = nil
858
864
  @locked_spec_with_missing_deps = nil
859
865
 
@@ -871,10 +877,6 @@ module Bundler
871
877
  @locked_specs.delete(missing)
872
878
 
873
879
  @locked_spec_with_missing_deps = missing.first.name
874
- elsif !@dependency_changes
875
- @missing_lockfile_dep = current_dependencies.find do |d|
876
- @locked_specs[d.name].empty? && d.name != "bundler"
877
- end&.name
878
880
  end
879
881
 
880
882
  if invalid.any?
@@ -935,32 +937,33 @@ module Bundler
935
937
  end
936
938
 
937
939
  def converge_dependencies
938
- changes = false
940
+ @missing_lockfile_dep = nil
941
+ @changed_dependencies = []
939
942
 
940
- @dependencies.each do |dep|
943
+ current_dependencies.each do |dep|
941
944
  if dep.source
942
945
  dep.source = sources.get(dep.source)
943
946
  end
944
947
 
945
- unless locked_dep = @originally_locked_deps[dep.name]
946
- changes = true
947
- next
948
+ name = dep.name
949
+
950
+ dep_changed = @locked_deps[name].nil?
951
+
952
+ unless name == "bundler"
953
+ locked_specs = @originally_locked_specs[name]
954
+
955
+ if locked_specs.any? && !dep.matches_spec?(locked_specs.first)
956
+ @gems_to_unlock << name
957
+ dep_changed = true
958
+ elsif locked_specs.empty? && dep_changed == false
959
+ @missing_lockfile_dep = name
960
+ end
948
961
  end
949
962
 
950
- # Gem::Dependency#== matches Gem::Dependency#type. As the lockfile
951
- # doesn't carry a notion of the dependency type, if you use
952
- # add_development_dependency in a gemspec that's loaded with the gemspec
953
- # directive, the lockfile dependencies and resolved dependencies end up
954
- # with a mismatch on #type. Work around that by setting the type on the
955
- # dep from the lockfile.
956
- locked_dep.instance_variable_set(:@type, dep.type)
957
-
958
- # We already know the name matches from the hash lookup
959
- # so we only need to check the requirement now
960
- changes ||= dep.requirement != locked_dep.requirement
963
+ @changed_dependencies << name if dep_changed
961
964
  end
962
965
 
963
- changes
966
+ @changed_dependencies.any?
964
967
  end
965
968
 
966
969
  # Remove elements from the locked specs that are expired. This will most
@@ -1022,11 +1025,6 @@ module Bundler
1022
1025
  end
1023
1026
  end
1024
1027
 
1025
- if dep.nil? && requested_dep = requested_dependencies.find {|d| name == d.name }
1026
- @gems_to_unlock << name
1027
- deps << requested_dep
1028
- end
1029
-
1030
1028
  converged << s
1031
1029
  end
1032
1030
 
@@ -1095,11 +1093,15 @@ module Bundler
1095
1093
  current == proposed
1096
1094
  end
1097
1095
 
1098
- def additional_base_requirements_to_prevent_downgrades(resolution_packages, last_resolve)
1096
+ def additional_base_requirements_to_prevent_downgrades(resolution_packages)
1099
1097
  return resolution_packages unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
1100
- converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
1098
+ @originally_locked_specs.each do |locked_spec|
1101
1099
  next if locked_spec.source.is_a?(Source::Path)
1102
- resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
1100
+
1101
+ name = locked_spec.name
1102
+ next if @changed_dependencies.include?(name)
1103
+
1104
+ resolution_packages.base_requirements[name] = Gem::Requirement.new(">= #{locked_spec.version}")
1103
1105
  end
1104
1106
  resolution_packages
1105
1107
  end