bundler 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96c3a9a5a42642d473042853b90ec2e07a4be74e6e1b5aba5bfdc3bcc0ed8776
4
- data.tar.gz: 5ccfc33ca9f1b86f30d896fc89db5e556b1dab1ec84361b1f2aa9bb65ff39769
3
+ metadata.gz: 3c7f621c84657b3f3fd279d8a48af66bdbade71a8459089ef0ea88aeb0738963
4
+ data.tar.gz: a4d4671ac30378b6a175ac0293926de0378f3befd00f674920b1900921fcd3c3
5
5
  SHA512:
6
- metadata.gz: f9822abc2d327f47a25c580b932e4cf3108ab8ecc41d8c206db8840c27779ec4943daa0a28c05e36503c1a04f5b3cb82f2b93a5f32538cf52e2a62c8fee5c11c
7
- data.tar.gz: f6f4e921e4c606352f0b2d1e54b2674f999690dda1a8d932b3c78bb0f6561f4527e4bf88fbfadb1061bbeb097014225fae9609262f415d1c3e08d61581e7f387
6
+ metadata.gz: a7b9404efdc5425a84c5cb0352bdc1197ec1659a428f04533dca5572d1b253761f85df3b8837a583d98866e9f49c9edff057eda6804400b747edae9dfb8b24f3
7
+ data.tar.gz: 8893ef747d56291328bfec9bd51a58802d60b51f4077b999971fe76b169d00f636ad853bd0f7238b7c3770aa2e912462f7dc086189e792bb796c18891f07f4c2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 2.5.1 (December 15, 2023)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix `ruby` Gemfile DSL with `file:` parameter no longer working [#7288](https://github.com/rubygems/rubygems/pull/7288)
6
+
7
+ ## Performance:
8
+
9
+ - Save array allocation for every dependency in Gemfile [#7270](https://github.com/rubygems/rubygems/pull/7270)
10
+
1
11
  # 2.5.0 (December 15, 2023)
2
12
 
3
13
  ## Breaking changes:
@@ -5,7 +5,7 @@ module Bundler
5
5
  module BuildMetadata
6
6
  # begin ivars
7
7
  @built_at = "2023-12-15".freeze
8
- @git_commit_sha = "58fdbff35a".freeze
8
+ @git_commit_sha = "c944d05909".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -30,6 +30,7 @@ module Bundler
30
30
 
31
31
  def from_api(digest, source_uri, algo = DEFAULT_ALGORITHM)
32
32
  return if Bundler.settings[:disable_checksum_validation]
33
+
33
34
  Checksum.new(algo, to_hexdigest(digest, algo), Source.new(:api, source_uri))
34
35
  end
35
36
 
@@ -41,11 +42,13 @@ module Bundler
41
42
  def to_hexdigest(digest, algo = DEFAULT_ALGORITHM)
42
43
  return digest unless algo == DEFAULT_ALGORITHM
43
44
  return digest if digest.match?(/\A[0-9a-f]{64}\z/i)
45
+
44
46
  if digest.match?(%r{\A[-0-9a-z_+/]{43}={0,2}\z}i)
45
47
  digest = digest.tr("-_", "+/") # fix urlsafe base64
46
- return digest.unpack1("m0").unpack1("H*")
48
+ digest.unpack1("m0").unpack1("H*")
49
+ else
50
+ raise ArgumentError, "#{digest.inspect} is not a valid SHA256 hex or base64 digest"
47
51
  end
48
- raise ArgumentError, "#{digest.inspect} is not a valid SHA256 hex or base64 digest"
49
52
  end
50
53
  end
51
54
 
@@ -63,6 +66,10 @@ module Bundler
63
66
 
64
67
  alias_method :eql?, :==
65
68
 
69
+ def same_source?(other)
70
+ sources.include?(other.sources.first)
71
+ end
72
+
66
73
  def match?(other)
67
74
  other.is_a?(self.class) && other.digest == digest && other.algo == algo
68
75
  end
@@ -81,6 +88,7 @@ module Bundler
81
88
 
82
89
  def merge!(other)
83
90
  return nil unless match?(other)
91
+
84
92
  @sources.concat(other.sources).uniq!
85
93
  self
86
94
  end
@@ -161,26 +169,17 @@ module Bundler
161
169
 
162
170
  def initialize
163
171
  @store = {}
164
- end
165
-
166
- def initialize_copy(other)
167
- @store = {}
168
- other.store.each do |lock_name, checksums|
169
- store[lock_name] = checksums.dup
170
- end
172
+ @store_mutex = Mutex.new
171
173
  end
172
174
 
173
175
  def inspect
174
176
  "#<#{self.class}:#{object_id} size=#{store.size}>"
175
177
  end
176
178
 
177
- def fetch(spec, algo = DEFAULT_ALGORITHM)
178
- store[spec.name_tuple.lock_name]&.fetch(algo, nil)
179
- end
180
-
181
179
  # Replace when the new checksum is from the same source.
182
- # The primary purpose of this registering checksums from gems where there are
180
+ # The primary purpose is registering checksums from gems where there are
183
181
  # duplicates of the same gem (according to full_name) in the index.
182
+ #
184
183
  # In particular, this is when 2 gems have two similar platforms, e.g.
185
184
  # "darwin20" and "darwin-20", both of which resolve to darwin-20.
186
185
  # In the Index, the later gem replaces the former, so we do that here.
@@ -192,19 +191,19 @@ module Bundler
192
191
  return unless checksum
193
192
 
194
193
  lock_name = spec.name_tuple.lock_name
195
- checksums = (store[lock_name] ||= {})
196
- existing = checksums[checksum.algo]
197
-
198
- # we assume only one source because this is used while building the index
199
- if !existing || existing.sources.first == checksum.sources.first
200
- checksums[checksum.algo] = checksum
201
- else
202
- register_checksum(lock_name, checksum)
194
+ @store_mutex.synchronize do
195
+ existing = fetch_checksum(lock_name, checksum.algo)
196
+ if !existing || existing.same_source?(checksum)
197
+ store_checksum(lock_name, checksum)
198
+ else
199
+ merge_checksum(lock_name, checksum, existing)
200
+ end
203
201
  end
204
202
  end
205
203
 
206
204
  def register(spec, checksum)
207
205
  return unless checksum
206
+
208
207
  register_checksum(spec.name_tuple.lock_name, checksum)
209
208
  end
210
209
 
@@ -218,7 +217,8 @@ module Bundler
218
217
 
219
218
  def to_lock(spec)
220
219
  lock_name = spec.name_tuple.lock_name
221
- if checksums = store[lock_name]
220
+ checksums = @store[lock_name]
221
+ if checksums
222
222
  "#{lock_name} #{checksums.values.map(&:to_lock).sort.join(",")}"
223
223
  else
224
224
  lock_name
@@ -228,18 +228,27 @@ module Bundler
228
228
  private
229
229
 
230
230
  def register_checksum(lock_name, checksum)
231
- return unless checksum
232
- checksums = (store[lock_name] ||= {})
233
- existing = checksums[checksum.algo]
234
-
235
- if !existing
236
- checksums[checksum.algo] = checksum
237
- elsif existing.merge!(checksum)
238
- checksum
239
- else
240
- raise ChecksumMismatchError.new(lock_name, existing, checksum)
231
+ @store_mutex.synchronize do
232
+ existing = fetch_checksum(lock_name, checksum.algo)
233
+ if existing
234
+ merge_checksum(lock_name, checksum, existing)
235
+ else
236
+ store_checksum(lock_name, checksum)
237
+ end
241
238
  end
242
239
  end
240
+
241
+ def merge_checksum(lock_name, checksum, existing)
242
+ existing.merge!(checksum) || raise(ChecksumMismatchError.new(lock_name, existing, checksum))
243
+ end
244
+
245
+ def store_checksum(lock_name, checksum)
246
+ (@store[lock_name] ||= {})[checksum.algo] = checksum
247
+ end
248
+
249
+ def fetch_checksum(lock_name, algo)
250
+ @store[lock_name]&.fetch(algo, nil)
251
+ end
243
252
  end
244
253
  end
245
254
  end
data/lib/bundler/dsl.rb CHANGED
@@ -20,7 +20,7 @@ module Bundler
20
20
 
21
21
  GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}
22
22
 
23
- attr_reader :gemspecs
23
+ attr_reader :gemspecs, :gemfile
24
24
  attr_accessor :dependencies
25
25
 
26
26
  def initialize
@@ -404,13 +404,11 @@ module Bundler
404
404
  end
405
405
 
406
406
  def validate_keys(command, opts, valid_keys)
407
- invalid_keys = opts.keys - valid_keys
408
-
409
- git_source = opts.keys & @git_sources.keys.map(&:to_s)
410
- if opts["branch"] && !(opts["git"] || opts["github"] || git_source.any?)
407
+ if opts["branch"] && !(opts["git"] || opts["github"] || (opts.keys & @git_sources.keys.map(&:to_s)).any?)
411
408
  raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch)
412
409
  end
413
410
 
411
+ invalid_keys = opts.keys - valid_keys
414
412
  return true unless invalid_keys.any?
415
413
 
416
414
  message = String.new
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -20,7 +20,7 @@ autoload :OpenSSL, 'openssl'
20
20
  #
21
21
  # Example:
22
22
  #
23
- # require 'bundler/vendor/net-http/lib/net/http/persistent'
23
+ # require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
24
24
  #
25
25
  # uri = Bundler::URI 'http://example.com/awesome/web/service'
26
26
  #
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -0,0 +1 @@
1
+ # Vendored files do not need to be documented
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.0".freeze
4
+ VERSION = "2.5.1".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/bundler.rb CHANGED
@@ -100,9 +100,7 @@ module Bundler
100
100
  end
101
101
 
102
102
  def create_bundle_path
103
- SharedHelpers.filesystem_access(bundle_path.to_s) do |p|
104
- mkdir_p(p)
105
- end unless bundle_path.exist?
103
+ mkdir_p(bundle_path) unless bundle_path.exist?
106
104
 
107
105
  @bundle_path = bundle_path.realpath
108
106
  rescue Errno::EEXIST
@@ -119,7 +117,7 @@ module Bundler
119
117
  @bin_path ||= begin
120
118
  path = settings[:bin] || "bin"
121
119
  path = Pathname.new(path).expand_path(root).expand_path
122
- SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) }
120
+ mkdir_p(path)
123
121
  path
124
122
  end
125
123
  end
@@ -483,7 +481,7 @@ module Bundler
483
481
  configured_bundle_path.use_system_gems?
484
482
  end
485
483
 
486
- def mkdir_p(path, options = {})
484
+ def mkdir_p(path)
487
485
  SharedHelpers.filesystem_access(path, :write) do |p|
488
486
  FileUtils.mkdir_p(p)
489
487
  end
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: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -273,18 +273,22 @@ files:
273
273
  - lib/bundler/uri_credentials_filter.rb
274
274
  - lib/bundler/uri_normalizer.rb
275
275
  - lib/bundler/vendor/.document
276
+ - lib/bundler/vendor/connection_pool/.document
276
277
  - lib/bundler/vendor/connection_pool/LICENSE
277
278
  - lib/bundler/vendor/connection_pool/lib/connection_pool.rb
278
279
  - lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb
279
280
  - lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb
280
281
  - lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
282
+ - lib/bundler/vendor/fileutils/.document
281
283
  - lib/bundler/vendor/fileutils/LICENSE.txt
282
284
  - lib/bundler/vendor/fileutils/lib/fileutils.rb
285
+ - lib/bundler/vendor/net-http-persistent/.document
283
286
  - lib/bundler/vendor/net-http-persistent/README.rdoc
284
287
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb
285
288
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb
286
289
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb
287
290
  - lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb
291
+ - lib/bundler/vendor/pub_grub/.document
288
292
  - lib/bundler/vendor/pub_grub/LICENSE.txt
289
293
  - lib/bundler/vendor/pub_grub/lib/pub_grub.rb
290
294
  - lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb
@@ -302,6 +306,7 @@ files:
302
306
  - lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb
303
307
  - lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb
304
308
  - lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
309
+ - lib/bundler/vendor/thor/.document
305
310
  - lib/bundler/vendor/thor/LICENSE.md
306
311
  - lib/bundler/vendor/thor/lib/thor.rb
307
312
  - lib/bundler/vendor/thor/lib/thor/actions.rb
@@ -339,8 +344,10 @@ files:
339
344
  - lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb
340
345
  - lib/bundler/vendor/thor/lib/thor/util.rb
341
346
  - lib/bundler/vendor/thor/lib/thor/version.rb
347
+ - lib/bundler/vendor/tsort/.document
342
348
  - lib/bundler/vendor/tsort/LICENSE.txt
343
349
  - lib/bundler/vendor/tsort/lib/tsort.rb
350
+ - lib/bundler/vendor/uri/.document
344
351
  - lib/bundler/vendor/uri/LICENSE.txt
345
352
  - lib/bundler/vendor/uri/lib/uri.rb
346
353
  - lib/bundler/vendor/uri/lib/uri/common.rb
@@ -392,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
392
399
  - !ruby/object:Gem::Version
393
400
  version: 3.2.3
394
401
  requirements: []
395
- rubygems_version: 3.5.0
402
+ rubygems_version: 3.5.1
396
403
  signing_key:
397
404
  specification_version: 4
398
405
  summary: The best way to manage your application's dependencies