bundler 4.0.24 → 4.0.25

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 567f97bf89a588c5a651c2b3f49298bb655349d8058b21d50c417b733485151d
4
- data.tar.gz: 804d2843f77a7e567a90874cf52d528e2244b0ba7cbcb4966cf405d7d6121dfa
3
+ metadata.gz: 649559a08a7cdf4e7f1e01a09932e27609e953c4a02c209bc211aafab2698d7f
4
+ data.tar.gz: c8f07e60fcab30979e19c7a0e6351f4d613bdb5cc55db9eb233409784e32f0f8
5
5
  SHA512:
6
- metadata.gz: aa6563d132a3f30113d97077ed5feb832306f9ef1511eb4a57c1017b55eedba715a3613426c7cc19bd4595f4ba71c1d6d0b1f204f95c6a4e903af9f33208ac9f
7
- data.tar.gz: 55a6eaccc845bfd3a5154331a245da04956c05f8ddf3df029d3e4ce5a9742916a237fb5004f461e7b31cfc29ae4f7acd3bf0089bec1476224aa289a3a4723e3b
6
+ metadata.gz: 1d27bbacf73937cc1abcfebd619a5aebe3ed3b01fcc93853725d241de1b922bedc190c7580fb6cb1fac94f7e0f3f0621ced80e76e9ac018d05fdd7589b3a3cc9
7
+ data.tar.gz: 2aa866f87c326b21b518c5bb5e40f4f19bfe2a524e6285fcb809793e15a9c74390d7821873aafef7d10c64bd5506b3954067539e3c38bb106a0f4a3654c95f31
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.25 / 2026-11-25
4
+
5
+ ### Bug fixes:
6
+
7
+ * Retry resolution with transitive prereleases. Pull request [#10110](https://github.com/ruby/rubygems/pull/10110) by Hiroshi SHIBATA
8
+ * Allow full updates to downgrade a yanked gem. Pull request [#10106](https://github.com/ruby/rubygems/pull/10106) by Hiroshi SHIBATA
9
+ * Allow `bundle lock --add-platform` to add native platforms from JRuby. Pull request [#10105](https://github.com/ruby/rubygems/pull/10105) by Hiroshi SHIBATA
10
+ * Show fourth-segment and prerelease updates in `bundle outdated --filter-patch`. Pull request [#10103](https://github.com/ruby/rubygems/pull/10103) by Hiroshi SHIBATA
11
+ * Resolve dependencies before `bundle add` updates the Gemfile. Pull request [#10101](https://github.com/ruby/rubygems/pull/10101) by Hiroshi SHIBATA
12
+ * Read plugin index files that Bundler 4.1 writes. Pull request [#10077](https://github.com/ruby/rubygems/pull/10077) by Hiroshi SHIBATA
13
+ * Preload git sources that share a cache one after another: 4.0.x. Pull request [#10069](https://github.com/ruby/rubygems/pull/10069) by Hiroshi SHIBATA
14
+ * Fix Bundler mirror probing with `fallback_timeout`. Pull request [#10046](https://github.com/ruby/rubygems/pull/10046) by Hiroshi SHIBATA
15
+
3
16
  ## 4.0.24 / 2026-11-05
4
17
 
5
18
  ### Enhancements:
@@ -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 = "2026-11-05".freeze
8
- @git_commit_sha = "3b396e4".freeze
7
+ @built_at = "2026-11-25".freeze
8
+ @git_commit_sha = "0b572c1".freeze
9
9
  # end ivars
10
10
 
11
11
  # A hash representation of the build metadata.
@@ -303,10 +303,7 @@ module Bundler
303
303
  update_present = active_minor > current_minor if options["filter-minor"]
304
304
 
305
305
  if !update_present && options["filter-patch"] && current_minor == active_minor
306
- current_patch = get_version_semver_portion_value(current_spec, 2)
307
- active_patch = get_version_semver_portion_value(active_spec, 2)
308
-
309
- update_present = active_patch > current_patch
306
+ update_present = active_spec.version > current_spec.version
310
307
  end
311
308
  end
312
309
 
@@ -795,10 +795,10 @@ module Bundler
795
795
  @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
796
796
 
797
797
  @new_platforms.each do |platform|
798
- incomplete_specs = result.incomplete_specs_for_platform(current_dependencies, platform)
798
+ incomplete_specs = result.incomplete_specs_for_platform(dependencies, platform)
799
799
 
800
800
  if incomplete_specs.any?
801
- resolver.raise_incomplete! incomplete_specs
801
+ resolver.raise_incomplete! incomplete_specs, platform
802
802
  end
803
803
  end
804
804
 
@@ -1181,7 +1181,7 @@ module Bundler
1181
1181
  def preload_git_source_worker
1182
1182
  workers = Bundler.settings.installation_parallelization
1183
1183
 
1184
- @preload_git_source_worker ||= Bundler::Worker.new(workers, "Git source preloading", ->(source, _) { source.specs })
1184
+ @preload_git_source_worker ||= Bundler::Worker.new(workers, "Git source preloading", ->(sources, _) { sources.each(&:specs) })
1185
1185
  end
1186
1186
 
1187
1187
  def preload_git_sources
@@ -1192,7 +1192,13 @@ module Bundler
1192
1192
  end
1193
1193
 
1194
1194
  begin
1195
- needed_git_sources.each {|source| preload_git_source_worker.enq(source) }
1195
+ # Sources from the same repository share one cache directory, and
1196
+ # running git in that directory from two workers at once makes the
1197
+ # fetches collide. Preload sources that share a cache in one job, one
1198
+ # after the other, and run the separate caches in parallel.
1199
+ needed_git_sources.group_by(&:cache_path).each_value do |sources|
1200
+ preload_git_source_worker.enq(sources)
1201
+ end
1196
1202
  ensure
1197
1203
  preload_git_source_worker.stop
1198
1204
  end
@@ -106,8 +106,8 @@ module Bundler
106
106
  @expanded_platforms ||= platforms.filter_map {|pl| CurrentRuby::PLATFORM_MAP[pl] }.flatten.uniq
107
107
  end
108
108
 
109
- def should_include?
110
- should_include && current_env? && current_platform?
109
+ def should_include?(platform = nil)
110
+ should_include && current_env? && (platform ? matches_platform?(platform) : current_platform?)
111
111
  end
112
112
 
113
113
  def gemspec_dev_dep?
@@ -147,5 +147,20 @@ module Bundler
147
147
  rescue NoMethodError
148
148
  requirement != ">= 0"
149
149
  end
150
+
151
+ private
152
+
153
+ def matches_platform?(platform)
154
+ return true if platforms.empty?
155
+
156
+ generic = Gem::Platform.generic(platform)
157
+ platforms.any? do |name|
158
+ next false unless [CurrentRuby::PLATFORM_MAP[name]].flatten.include?(generic)
159
+ next Bundler.current_ruby.public_send("#{name}?") if generic == Bundler.generic_local_platform
160
+
161
+ version = name.to_s[/_(\d+)\z/, 1]
162
+ !version || Bundler.current_ruby.public_send("on_#{version}?")
163
+ end
164
+ end
150
165
  end
151
166
  end
@@ -41,7 +41,7 @@ module Bundler
41
41
 
42
42
  # resolve to see if the new deps broke anything
43
43
  @definition = builder.to_definition(lockfile_path, {})
44
- @definition.remotely!
44
+ @definition.resolve_remotely!
45
45
 
46
46
  # since nothing broke, we can add those gems to the gemfile
47
47
  append_to(gemfile_path, build_gem_lines(@options[:conservative_versioning])) if @deps.any?
@@ -151,9 +151,11 @@ module Bundler
151
151
  socket.connect_nonblock(address)
152
152
  rescue Errno::EINPROGRESS
153
153
  wait_for_writtable_socket(socket, address, timeout)
154
- rescue RuntimeError # Connection failed somehow, again
154
+ rescue SystemCallError # Connection failed somehow, again
155
155
  false
156
156
  end
157
+ rescue SocketError # The mirror host does not resolve
158
+ false
157
159
  end
158
160
 
159
161
  private
@@ -185,7 +187,7 @@ module Bundler
185
187
  class MirrorSockets
186
188
  def initialize(mirror)
187
189
  @timeout = mirror.fallback_timeout
188
- @addresses = Socket.getaddrinfo(mirror.uri.host, mirror.uri.port).map do |address|
190
+ @addresses = Socket.getaddrinfo(mirror.uri.hostname, mirror.uri.port, nil, Socket::SOCK_STREAM).map do |address|
189
191
  SocketAddress.new(address[0], address[3], address[1])
190
192
  end
191
193
  end
@@ -194,9 +196,9 @@ module Bundler
194
196
  @addresses.any? do |address|
195
197
  socket = Socket.new(Socket.const_get(address.type), Socket::SOCK_STREAM, 0)
196
198
  socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
197
- value = yield socket, address.to_socket_address, @timeout
198
- socket.close unless socket.closed?
199
- value
199
+ yield socket, address.to_socket_address, @timeout
200
+ ensure
201
+ socket&.close
200
202
  end
201
203
  end
202
204
  end
@@ -163,6 +163,8 @@ module Bundler
163
163
  # @param [Pathname] index file path
164
164
  # @param [Boolean] is the index file global index
165
165
  def load_index(index_file, global = false)
166
+ base = global ? Plugin.global_root : Plugin.root
167
+
166
168
  SharedHelpers.filesystem_access(index_file, :read) do |index_f|
167
169
  valid_file = index_f&.exist? && !index_f.size.zero?
168
170
  break unless valid_file
@@ -170,16 +172,40 @@ module Bundler
170
172
  data = index_f.read
171
173
 
172
174
  require_relative "../yaml_serializer"
173
- index = YAMLSerializer.load(data)
175
+ loaded = YAMLSerializer.load(data)
176
+ # Bundler 4.1 writes empty sections as "{}", which this serializer
177
+ # reads as a string.
178
+ index = %w[commands hooks load_paths plugin_paths sources].to_h do |key|
179
+ [key, loaded[key].is_a?(Hash) ? loaded[key] : {}]
180
+ end
174
181
 
175
182
  @commands.merge!(index["commands"])
176
183
  @hooks.merge!(index["hooks"])
177
- @load_paths.merge!(index["load_paths"])
178
- @plugin_paths.merge!(index["plugin_paths"])
184
+ @load_paths.merge!(absolutize_paths(index["load_paths"], base))
185
+ @plugin_paths.merge!(absolutize_paths(index["plugin_paths"], base))
179
186
  @sources.merge!(index["sources"]) unless global
180
187
  end
181
188
  end
182
189
 
190
+ # Bundler 4.1 records the paths of a plugin installed in the plugin root
191
+ # relative to it.
192
+ def absolutize_paths(paths, base)
193
+ paths.transform_values do |value|
194
+ if value.is_a?(Array)
195
+ value.map {|path| absolutize_path(path, base) }
196
+ else
197
+ absolutize_path(value, base)
198
+ end
199
+ end
200
+ end
201
+
202
+ def absolutize_path(path, base)
203
+ pathname = Pathname.new(path)
204
+ return path if pathname.absolute?
205
+
206
+ Pathname.new(base).join(pathname).to_s
207
+ end
208
+
183
209
  # Should be called when any of the instance variables change. Stores the
184
210
  # instance variables in YAML format. (The instance variables are supposed
185
211
  # to be only String key value pairs)
@@ -137,8 +137,10 @@ module Bundler
137
137
  names_to_allow_remote_specs_for = []
138
138
  extended_explanation = nil
139
139
 
140
+ satisfiers = []
140
141
  while incompatibility.conflict?
141
142
  cause = incompatibility.cause
143
+ satisfiers << cause.satisfier
142
144
  incompatibility = cause.incompatibility
143
145
 
144
146
  incompatibility.terms.each do |term|
@@ -147,7 +149,7 @@ module Bundler
147
149
 
148
150
  if base_requirements[name]
149
151
  names_to_unlock << name
150
- elsif package.ignores_prereleases? && @all_specs[name].any? {|s| s.version.prerelease? }
152
+ elsif filtered_prereleases?(package)
151
153
  names_to_allow_prereleases_for << name
152
154
  elsif package.prefer_local? && @all_specs[name].any? {|s| !s.is_a?(StubSpecification) }
153
155
  names_to_allow_remote_specs_for << name
@@ -160,6 +162,11 @@ module Bundler
160
162
  end
161
163
  end
162
164
 
165
+ # Preserve the usual retry order when it can already resolve the conflict.
166
+ if names_to_unlock.empty? && names_to_allow_prereleases_for.empty? && names_to_allow_remote_specs_for.empty?
167
+ names_to_allow_prereleases_for = prerelease_names_in(satisfiers)
168
+ end
169
+
163
170
  [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, names_to_allow_remote_specs_for.uniq, extended_explanation]
164
171
  end
165
172
 
@@ -321,8 +328,10 @@ module Bundler
321
328
  "Gemfile"
322
329
  end
323
330
 
324
- def raise_incomplete!(incomplete_specs)
325
- raise_not_found!(@base.get_package(incomplete_specs.first.name))
331
+ def raise_incomplete!(incomplete_specs, platform = nil)
332
+ spec = incomplete_specs.first
333
+ # An unresolved dependency may be missing for a different resolution platform.
334
+ raise_not_found!(@base.get_package(spec.name), spec.version && platform)
326
335
  end
327
336
 
328
337
  def sort_versions_by_preferred(package, versions)
@@ -331,7 +340,7 @@ module Bundler
331
340
 
332
341
  private
333
342
 
334
- def raise_not_found!(package)
343
+ def raise_not_found!(package, platform = nil)
335
344
  name = package.name
336
345
  source = source_for(name)
337
346
  specs = @all_specs[name]
@@ -347,7 +356,7 @@ module Bundler
347
356
  not_found_message = if specs_matching_requirement.any?
348
357
  specs = specs_matching_requirement
349
358
  matching_part = requirement_label
350
- platforms = package.platforms
359
+ platforms = platform ? [platform] : package.platforms
351
360
 
352
361
  if platforms.size == 1
353
362
  "Could not find gem '#{requirement_label}' with platform '#{platforms.first}'"
@@ -414,6 +423,30 @@ module Bundler
414
423
  filter_remote_specs(filter_cooldown(filter_prereleases(specs, package)), package)
415
424
  end
416
425
 
426
+ def prerelease_names_in(incompatibilities)
427
+ seen = {}.compare_by_identity
428
+ packages = []
429
+ while (incompatibility = incompatibilities.pop)
430
+ next if seen[incompatibility]
431
+ seen[incompatibility] = true
432
+
433
+ if incompatibility.conflict?
434
+ cause = incompatibility.cause
435
+ incompatibilities.push(cause.incompatibility, cause.satisfier)
436
+ else
437
+ incompatibility.terms.each {|term| packages << term.package }
438
+ end
439
+ end
440
+
441
+ packages.uniq.filter_map do |package|
442
+ package.name if !base_requirements[package.name] && filtered_prereleases?(package)
443
+ end
444
+ end
445
+
446
+ def filtered_prereleases?(package)
447
+ package.ignores_prereleases? && @all_specs[package.name].any? {|s| s.version.prerelease? }
448
+ end
449
+
417
450
  def filter_prereleases(specs, package)
418
451
  return specs unless package.ignores_prereleases? && specs.size > 1
419
452
 
@@ -573,6 +606,13 @@ module Bundler
573
606
  versions = versions_for(dep_package, dep_range)
574
607
  end
575
608
 
609
+ if versions.empty? && locked_version_missing?(dep_package)
610
+ @base.unlock_names([name])
611
+ @all_versions.delete(dep_package)
612
+ @sorted_versions.delete(dep_package)
613
+ versions = versions_for(dep_package, dep_range)
614
+ end
615
+
576
616
  if versions.empty? && select_all_versions(dep_package, dep_range).any?
577
617
  raise_all_versions_filtered_out!(dep_package)
578
618
  end
@@ -585,6 +625,16 @@ module Bundler
585
625
  end.to_h
586
626
  end
587
627
 
628
+ def locked_version_missing?(package)
629
+ return false unless package.unlock?
630
+
631
+ name = package.name
632
+ version = package.locked_version
633
+ return false unless base_requirements[name]&.requirements == [[">=", version]]
634
+
635
+ source_for(name).specs.search([name, version]).empty?
636
+ end
637
+
588
638
  def select_all_versions(package, range)
589
639
  range.select_versions(@all_versions[package])
590
640
  end
@@ -140,14 +140,14 @@ module Bundler
140
140
  end
141
141
 
142
142
  def incomplete_for_platform?(deps, platform)
143
+ return false if @specs.empty?
144
+
143
145
  incomplete_specs_for_platform(deps, platform).any?
144
146
  end
145
147
 
146
148
  def incomplete_specs_for_platform(deps, platform)
147
- return [] if @specs.empty?
148
-
149
149
  validation_set = self.class.new(@specs)
150
- validation_set.for(deps, [platform])
150
+ validation_set.for(deps.select {|dep| dep.should_include?(platform) }, [platform])
151
151
  validation_set.incomplete_specs
152
152
  end
153
153
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.0.24".freeze
4
+ VERSION = "4.0.25".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.24
4
+ version: 4.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko