bundler 2.4.8 → 2.4.10

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: ef4e6f9cc4c071e0c5d5c389813ae098b7aa7977da99d1f83801d8602700e267
4
- data.tar.gz: f7f223fd0aa6a6548842126a155bea516b1b5cdc9c8440842d1f657cd8d8b4cc
3
+ metadata.gz: ce72b26ab92bb2518537d2dad1f4b2c68bc82f4a1a17ad16d3647df275981937
4
+ data.tar.gz: b6afc954f239e845d5127921fa29b114648a075c154e4c13dcbd25f100af4f03
5
5
  SHA512:
6
- metadata.gz: 3bfa3a3201b3ec0eb2bfe836374f0c16c9a36230fa9c05b19ffdb255f55bdd04d8be03de9ba0bb1872aab2362f1e7f5425d085cd36441f245b754c208188d0a0
7
- data.tar.gz: b681f7ba478ff42fc2d380c0757192f959b27688ea6aef50839612f8da20242bec4fa6096e6c98bddde9ea561e3dd7e582cc4563c1dc87627b41a2d1bacc885c
6
+ metadata.gz: 4fd7c530ab5761267f729fc16d40f287c2ab7873f45bdd7ec18bd9334fdec0466b521a5b369a8e1c485dd178def2c31c3aac5b38dba2e1816aa1ba2f7a0f3bdb
7
+ data.tar.gz: 4cca0f7b51657657ea12aa35620c0d14f23043d4bf78706e37c50c174cf5f7bc158b8549036b6f058691ecd93a67be1a25b98ffe9ecc9a26b3644181fcd2098c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # 2.4.10 (March 27, 2023)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix some unnecessary top level dependency downgrades [#6535](https://github.com/rubygems/rubygems/pull/6535)
6
+ - Fix incorrect ruby platform removal from lockfile when adding Gemfile dependencies [#6540](https://github.com/rubygems/rubygems/pull/6540)
7
+ - Fix installing plugins in frozen mode [#6543](https://github.com/rubygems/rubygems/pull/6543)
8
+ - Restore "enumerability" of `SpecSet` [#6532](https://github.com/rubygems/rubygems/pull/6532)
9
+
10
+ # 2.4.9 (March 20, 2023)
11
+
12
+ ## Security:
13
+
14
+ - Don't recommend `--full-index` on errors [#6493](https://github.com/rubygems/rubygems/pull/6493)
15
+
16
+ ## Enhancements:
17
+
18
+ - Fix duplicated specs in some error messages [#6475](https://github.com/rubygems/rubygems/pull/6475)
19
+ - When running `bundle lock --update <name>`, checkout locked revision of unrelated git sources directly [#6459](https://github.com/rubygems/rubygems/pull/6459)
20
+ - Avoid expiring git sources when unnecessary [#6458](https://github.com/rubygems/rubygems/pull/6458)
21
+ - Use `RbSys::ExtensionTask` when creating new rust gems [#6352](https://github.com/rubygems/rubygems/pull/6352)
22
+ - Don't ignore pre-releases when there's only one candidate [#6441](https://github.com/rubygems/rubygems/pull/6441)
23
+
24
+ ## Bug fixes:
25
+
26
+ - Fix incorrect removal of ruby platform when auto-healing corrupted lockfiles [#6495](https://github.com/rubygems/rubygems/pull/6495)
27
+ - Don't consider platform specific candidates when `force_ruby_platform` set [#6442](https://github.com/rubygems/rubygems/pull/6442)
28
+ - Better deal with circular dependencies [#6330](https://github.com/rubygems/rubygems/pull/6330)
29
+
30
+ ## Documentation:
31
+
32
+ - Add debugging docs [#6387](https://github.com/rubygems/rubygems/pull/6387)
33
+ - Document our current release policy [#6450](https://github.com/rubygems/rubygems/pull/6450)
34
+
1
35
  # 2.4.8 (March 8, 2023)
2
36
 
3
37
  ## Security:
@@ -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 = "2023-03-08".freeze
8
- @git_commit_sha = "a67b2657a0".freeze
7
+ @built_at = "2023-03-27".freeze
8
+ @git_commit_sha = "7ffdec80d0".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -726,6 +726,8 @@ module Bundler
726
726
  dep.source = sources.get(dep.source)
727
727
  end
728
728
 
729
+ next if unlocking?
730
+
729
731
  unless locked_dep = @locked_deps[dep.name]
730
732
  changes = true
731
733
  next
@@ -886,8 +888,9 @@ module Bundler
886
888
  end
887
889
 
888
890
  def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
889
- return resolution_packages unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
891
+ return resolution_packages unless @locked_gems && !sources.expired_sources?(@locked_gems.sources)
890
892
  converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
893
+ next if locked_spec.source.is_a?(Source::Path)
891
894
  resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
892
895
  end
893
896
  resolution_packages
@@ -898,6 +901,7 @@ module Bundler
898
901
  Bundler.local_platform == Gem::Platform::RUBY ||
899
902
  !platforms.include?(Gem::Platform::RUBY) ||
900
903
  (@new_platform && platforms.last == Gem::Platform::RUBY) ||
904
+ @dependency_changes ||
901
905
  !@originally_locked_specs.incomplete_ruby_specs?(dependencies)
902
906
 
903
907
  remove_platform(Gem::Platform::RUBY)
@@ -26,10 +26,6 @@ module Bundler
26
26
  @platform
27
27
  end
28
28
 
29
- def identifier
30
- @__identifier ||= [name, version, platform.to_s]
31
- end
32
-
33
29
  # needed for standalone, load required_paths from local gemspec
34
30
  # after the gem is installed
35
31
  def require_paths
@@ -34,14 +34,10 @@ module Bundler
34
34
 
35
35
  returned_gems = spec_list.map(&:first).uniq
36
36
  specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list)
37
- rescue MarshalError
37
+ rescue MarshalError, HTTPError, GemspecError
38
38
  Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
39
39
  Bundler.ui.debug "could not fetch from the dependency API, trying the full index"
40
40
  nil
41
- rescue HTTPError, GemspecError
42
- Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over
43
- Bundler.ui.debug "could not fetch from the dependency API\nit's suggested to retry using the full index via `bundle install --full-index`"
44
- nil
45
41
  end
46
42
 
47
43
  def dependency_specs(gem_names)
@@ -20,7 +20,7 @@ module Bundler
20
20
  end
21
21
 
22
22
  def full_name
23
- if platform == Gem::Platform::RUBY
23
+ @full_name ||= if platform == Gem::Platform::RUBY
24
24
  "#{@name}-#{@version}"
25
25
  else
26
26
  "#{@name}-#{@version}-#{platform}"
@@ -28,15 +28,15 @@ module Bundler
28
28
  end
29
29
 
30
30
  def ==(other)
31
- identifier == other.identifier
31
+ full_name == other.full_name
32
32
  end
33
33
 
34
34
  def eql?(other)
35
- identifier.eql?(other.identifier)
35
+ full_name.eql?(other.full_name)
36
36
  end
37
37
 
38
38
  def hash
39
- identifier.hash
39
+ full_name.hash
40
40
  end
41
41
 
42
42
  ##
@@ -129,10 +129,6 @@ module Bundler
129
129
  end
130
130
  end
131
131
 
132
- def identifier
133
- @__identifier ||= [name, version, platform.to_s]
134
- end
135
-
136
132
  def git_version
137
133
  return unless source.is_a?(Bundler::Source::Git)
138
134
  " #{source.revision[0..6]}"
@@ -86,7 +86,7 @@ module Bundler
86
86
  send("parse_#{@state}", line)
87
87
  end
88
88
  end
89
- @specs = @specs.values.sort_by(&:identifier)
89
+ @specs = @specs.values.sort_by(&:full_name)
90
90
  rescue ArgumentError => e
91
91
  Bundler.ui.debug(e)
92
92
  raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \
@@ -199,7 +199,7 @@ module Bundler
199
199
  @current_spec.source = @current_source
200
200
  @current_source.add_dependency_names(name)
201
201
 
202
- @specs[@current_spec.identifier] = @current_spec
202
+ @specs[@current_spec.full_name] = @current_spec
203
203
  elsif spaces.size == 6
204
204
  version = version.split(",").map(&:strip) if version
205
205
  dep = Gem::Dependency.new(name, version)
@@ -83,8 +83,11 @@ module Bundler
83
83
 
84
84
  Bundler.configure_gem_home_and_path(Plugin.root)
85
85
 
86
- definition = Definition.new(nil, deps, source_list, true)
87
- install_definition(definition)
86
+ Bundler.settings.temporary(:deployment => false, :frozen => false) do
87
+ definition = Definition.new(nil, deps, source_list, true)
88
+
89
+ install_definition(definition)
90
+ end
88
91
  end
89
92
 
90
93
  # Installs the plugins and deps from the provided specs and returns map of
@@ -29,12 +29,8 @@ module Bundler
29
29
  @platform = _remote_specification.platform
30
30
  end
31
31
 
32
- def identifier
33
- @__identifier ||= [name, version, @platform.to_s]
34
- end
35
-
36
32
  def full_name
37
- if @platform == Gem::Platform::RUBY
33
+ @full_name ||= if @platform == Gem::Platform::RUBY
38
34
  "#{@name}-#{@version}"
39
35
  else
40
36
  "#{@name}-#{@version}-#{@platform}"
@@ -106,7 +102,7 @@ module Bundler
106
102
  def _remote_specification
107
103
  @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @original_platform])
108
104
  @_remote_specification || raise(GemspecError, "Gemspec data for #{full_name} was" \
109
- " missing from the server! Try installing with `--full-index` as a workaround.")
105
+ " missing from the server!")
110
106
  end
111
107
 
112
108
  def method_missing(method, *args, &blk)
@@ -49,10 +49,18 @@ module Bundler
49
49
  end
50
50
 
51
51
  def unlock_names(names)
52
- names.each do |name|
53
- @base.delete_by_name(name)
54
-
55
- @base_requirements.delete(name)
52
+ indirect_pins = indirect_pins(names)
53
+
54
+ if indirect_pins.any?
55
+ loosen_names(indirect_pins)
56
+ else
57
+ pins = pins(names)
58
+
59
+ if pins.any?
60
+ loosen_names(pins)
61
+ else
62
+ unrestrict_names(names)
63
+ end
56
64
  end
57
65
  end
58
66
 
@@ -64,6 +72,30 @@ module Bundler
64
72
 
65
73
  private
66
74
 
75
+ def indirect_pins(names)
76
+ names.select {|name| @base_requirements[name].exact? && @requirements.none? {|dep| dep.name == name } }
77
+ end
78
+
79
+ def pins(names)
80
+ names.select {|name| @base_requirements[name].exact? }
81
+ end
82
+
83
+ def loosen_names(names)
84
+ names.each do |name|
85
+ version = @base_requirements[name].requirements.first[1]
86
+
87
+ @base_requirements[name] = Gem::Requirement.new(">= #{version}")
88
+
89
+ @base.delete_by_name(name)
90
+ end
91
+ end
92
+
93
+ def unrestrict_names(names)
94
+ names.each do |name|
95
+ @base_requirements.delete(name)
96
+ end
97
+ end
98
+
67
99
  def build_base_requirements
68
100
  base_requirements = {}
69
101
  @base.each do |ls|
@@ -37,7 +37,9 @@ module Bundler
37
37
  root_version = Resolver::Candidate.new(0)
38
38
 
39
39
  @all_specs = Hash.new do |specs, name|
40
- specs[name] = source_for(name).specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
40
+ specs[name] = source_for(name).specs.search(name).reject do |s|
41
+ s.dependencies.any? {|d| d.name == name && !d.requirement.satisfied_by?(s.version) } # ignore versions that depend on themselves incorrectly
42
+ end.sort_by {|s| [s.version, s.platform.to_s] }
41
43
  end
42
44
 
43
45
  @sorted_versions = Hash.new do |candidates, package|
@@ -55,7 +57,7 @@ module Bundler
55
57
  { root_version => root_dependencies }
56
58
  else
57
59
  Hash.new do |versions, version|
58
- versions[version] = to_dependency_hash(version.dependencies, @packages)
60
+ versions[version] = to_dependency_hash(version.dependencies.reject {|d| d.name == package.name }, @packages)
59
61
  end
60
62
  end
61
63
  end
@@ -186,11 +188,6 @@ module Bundler
186
188
  package_deps = @cached_dependencies[package]
187
189
  sorted_versions = @sorted_versions[package]
188
190
  package_deps[version].map do |dep_package, dep_constraint|
189
- if package == dep_package
190
- cause = PubGrub::Incompatibility::CircularDependency.new(dep_package, dep_constraint.constraint_string)
191
- return [PubGrub::Incompatibility.new([PubGrub::Term.new(dep_constraint, true)], :cause => cause)]
192
- end
193
-
194
191
  low = high = sorted_versions.index(version)
195
192
 
196
193
  # find version low such that all >= low share the same dep
@@ -243,7 +240,7 @@ module Bundler
243
240
  ruby_specs = select_best_platform_match(specs, Gem::Platform::RUBY)
244
241
  groups << Resolver::Candidate.new(version, :specs => ruby_specs) if ruby_specs.any?
245
242
 
246
- next groups if platform_specs == ruby_specs
243
+ next groups if platform_specs == ruby_specs || package.force_ruby_platform?
247
244
 
248
245
  groups << Resolver::Candidate.new(version, :specs => platform_specs)
249
246
 
@@ -302,7 +299,7 @@ module Bundler
302
299
  end
303
300
 
304
301
  def filter_prereleases(specs, package)
305
- return specs unless package.ignores_prereleases?
302
+ return specs unless package.ignores_prereleases? && specs.size > 1
306
303
 
307
304
  specs.reject {|s| s.version.prerelease? }
308
305
  end
@@ -495,7 +495,7 @@ module Bundler
495
495
  uri = $2
496
496
  suffix = $3
497
497
  end
498
- uri = "#{uri}/" unless uri.end_with?("/")
498
+ uri = URINormalizer.normalize_suffix(uri)
499
499
  require_relative "vendored_uri"
500
500
  uri = Bundler::URI(uri)
501
501
  unless uri.absolute?
@@ -160,7 +160,7 @@ module Bundler
160
160
  " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
161
161
  raise APIResponseMismatchError,
162
162
  "Downloading #{spec.full_name} revealed dependencies not in the API or the lockfile (#{extra_deps.join(", ")})." \
163
- "\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
163
+ "\nRunning `bundle update #{spec.name}` should fix the problem."
164
164
  end
165
165
 
166
166
  def pretty_dependency(dep)
@@ -366,6 +366,11 @@ module Bundler
366
366
  args += ["--single-branch"]
367
367
  args.unshift("--no-tags") if supports_cloning_with_no_tags?
368
368
 
369
+ # If there's a locked revision, no need to clone any specific branch
370
+ # or tag, since we will end up checking out that locked revision
371
+ # anyways.
372
+ return args if @revision
373
+
369
374
  args += ["--branch", branch || tag] if branch || tag
370
375
  args
371
376
  end
@@ -19,7 +19,7 @@ module Bundler
19
19
  # Stringify options that could be set as symbols
20
20
  %w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
21
21
 
22
- @uri = options["uri"] || ""
22
+ @uri = URINormalizer.normalize_suffix(options["uri"] || "", :trailing_slash => false)
23
23
  @safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
24
24
  @branch = options["branch"]
25
25
  @ref = options["ref"] || options["branch"] || options["tag"]
@@ -337,8 +337,7 @@ module Bundler
337
337
  end
338
338
 
339
339
  def normalize_uri(uri)
340
- uri = uri.to_s
341
- uri = "#{uri}/" unless %r{/$}.match?(uri)
340
+ uri = URINormalizer.normalize_suffix(uri.to_s)
342
341
  require_relative "../vendored_uri"
343
342
  uri = Bundler::URI(uri)
344
343
  raise ArgumentError, "The source must be an absolute URI. For example:\n" \
@@ -49,7 +49,7 @@ module Bundler
49
49
  end
50
50
  end
51
51
 
52
- specs
52
+ specs.uniq
53
53
  end
54
54
 
55
55
  def [](key)
@@ -101,6 +101,10 @@ module Bundler
101
101
  end
102
102
 
103
103
  def incomplete_ruby_specs?(deps)
104
+ return false if @specs.empty?
105
+
106
+ @incomplete_specs = []
107
+
104
108
  self.for(deps, true, [Gem::Platform::RUBY])
105
109
 
106
110
  @incomplete_specs.any?
@@ -10,7 +10,7 @@ gem "rake", "~> 13.0"
10
10
 
11
11
  gem "rake-compiler"
12
12
  <%- if config[:ext] == 'rust' -%>
13
- gem "rb_sys"
13
+ gem "rb_sys", "~> 0.9.63"
14
14
  <%- end -%>
15
15
  <%- end -%>
16
16
  <%- if config[:test] -%>
@@ -41,6 +41,15 @@ require "standard/rake"
41
41
  <% if config[:ext] -%>
42
42
  <% default_task_names.unshift(:compile) -%>
43
43
  <% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
44
+ <% if config[:ext] == 'rust' -%>
45
+ require "rb_sys/extensiontask"
46
+
47
+ task build: :compile
48
+
49
+ RbSys::ExtensionTask.new(<%= config[:name].inspect %>) do |ext|
50
+ ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
51
+ end
52
+ <% else -%>
44
53
  require "rake/extensiontask"
45
54
 
46
55
  task build: :compile
@@ -48,6 +57,7 @@ task build: :compile
48
57
  Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext|
49
58
  ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
50
59
  end
60
+ <% end -%>
51
61
 
52
62
  <% end -%>
53
63
  <% if default_task_names.size == 1 -%>
@@ -20,7 +20,7 @@ jobs:
20
20
  - uses: actions/checkout@v3
21
21
  <%- if config[:ext] == 'rust' -%>
22
22
  - name: Set up Ruby & Rust
23
- uses: oxidize-rb/actions/setup-ruby-and-rust@main
23
+ uses: oxidize-rb/actions/setup-ruby-and-rust@v1
24
24
  with:
25
25
  ruby-version: ${{ matrix.ruby }}
26
26
  bundler-cache: true
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bundler
4
+ module URINormalizer
5
+ module_function
6
+
7
+ # Normalizes uri to a consistent version, either with or without trailing
8
+ # slash.
9
+ #
10
+ # TODO: Currently gem sources are locked with a trailing slash, while git
11
+ # sources are locked without a trailing slash. This should be normalized but
12
+ # the inconsistency is there for now to avoid changing all lockfiles
13
+ # including GIT sources. We could normalize this on the next major.
14
+ #
15
+ def normalize_suffix(uri, trailing_slash: true)
16
+ if trailing_slash
17
+ uri.end_with?("/") ? uri : "#{uri}/"
18
+ else
19
+ uri.end_with?("/") ? uri.delete_suffix("/") : uri
20
+ end
21
+ end
22
+ end
23
+ end
@@ -8,9 +8,6 @@ module Bundler::PubGrub
8
8
  InvalidDependency = Struct.new(:package, :constraint) do
9
9
  end
10
10
 
11
- CircularDependency = Struct.new(:package, :constraint) do
12
- end
13
-
14
11
  NoVersions = Struct.new(:constraint) do
15
12
  end
16
13
 
@@ -66,8 +63,6 @@ module Bundler::PubGrub
66
63
  "#{terms[0].to_s(allow_every: true)} depends on #{terms[1].invert}"
67
64
  when Bundler::PubGrub::Incompatibility::InvalidDependency
68
65
  "#{terms[0].to_s(allow_every: true)} depends on unknown package #{cause.package}"
69
- when Bundler::PubGrub::Incompatibility::CircularDependency
70
- "#{terms[0].to_s(allow_every: true)} depends on itself"
71
66
  when Bundler::PubGrub::Incompatibility::NoVersions
72
67
  "no versions satisfy #{cause.constraint}"
73
68
  when Bundler::PubGrub::Incompatibility::ConflictCause
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.8".freeze
4
+ VERSION = "2.4.10".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
@@ -85,6 +85,7 @@ module Bundler
85
85
  autoload :StubSpecification, File.expand_path("bundler/stub_specification", __dir__)
86
86
  autoload :UI, File.expand_path("bundler/ui", __dir__)
87
87
  autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
88
+ autoload :URINormalizer, File.expand_path("bundler/uri_normalizer", __dir__)
88
89
 
89
90
  class << self
90
91
  def configure
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.4.8
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2023-03-08 00:00:00.000000000 Z
25
+ date: 2023-03-27 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -266,6 +266,7 @@ files:
266
266
  - lib/bundler/ui/shell.rb
267
267
  - lib/bundler/ui/silent.rb
268
268
  - lib/bundler/uri_credentials_filter.rb
269
+ - lib/bundler/uri_normalizer.rb
269
270
  - lib/bundler/vendor/.document
270
271
  - lib/bundler/vendor/connection_pool/LICENSE
271
272
  - lib/bundler/vendor/connection_pool/lib/connection_pool.rb
@@ -379,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
379
380
  - !ruby/object:Gem::Version
380
381
  version: 3.0.1
381
382
  requirements: []
382
- rubygems_version: 3.4.8
383
+ rubygems_version: 3.4.10
383
384
  signing_key:
384
385
  specification_version: 4
385
386
  summary: The best way to manage your application's dependencies