rubygems-update 3.4.3 → 3.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea0dc92a8c2b9c77f350a299c75d894d9cf62dcd841bdceb82990cf0c3173089
4
- data.tar.gz: bd630bc8ee7e8453efc849359fed24af280b88602207ba0e1e05d8ed2802d4a7
3
+ metadata.gz: e731d4ed24a0a921d89268a3434f7206ff3fd69b60fad4aa4994599453d366af
4
+ data.tar.gz: b605f1b59a612e68f947ea8ab1bce26f1e04cd965b0e626b89ac5180b27ebe3f
5
5
  SHA512:
6
- metadata.gz: d9bf62a3e6d05b1f03bfb5e93781eb1e0ba0fb9c3d6b32692bbb96aa62119b8407e13646afb3f91a0bb170ddc7a8974799611299f12d94bc162b28f07acd010b
7
- data.tar.gz: 66041a9e9a6f7a3bd2ac6a6da9934ad3d9af90ab50668b028b1ee758608f884493c1bed46af996583fb7cee15d2c0f11094d068429c0a618b90da9721314dfcf
6
+ metadata.gz: 8911316827bae22805af01029490d6dfa2e8b1fe4e67c1e1c753c6d73910b4c91f8ec6cab6c5673ea327f57ce4fe57f06901a894b04c323fe0f5db329d268c34
7
+ data.tar.gz: d5d6ff48dd8e598b2930047ea867dfe2560a3a9eacb8183f8da99ba24c4bac54612446b3dc4f9919d55274b52b41758d6aa2b7d96125786608972c5ad6a1ce53
data/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ # 3.4.5 / 2023-01-21
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.4.5 as a default gem.
6
+
7
+ # 3.4.4 / 2023-01-16
8
+
9
+ ## Enhancements:
10
+
11
+ * Installs bundler 2.4.4 as a default gem.
12
+
13
+ ## Documentation:
14
+
15
+ * Improve documentation about `Kernel` monkeypatches. Pull request #6217
16
+ by nobu
17
+
1
18
  # 3.4.3 / 2023-01-06
2
19
 
3
20
  ## Enhancements:
data/CONTRIBUTING.md CHANGED
@@ -56,15 +56,15 @@ To run commands like `bundle install` from the repo:
56
56
 
57
57
  ### Running Tests
58
58
 
59
- To run the entire test suite you can use:
59
+ To run the entire test suite you can use:
60
60
 
61
61
  rake test
62
62
 
63
- To run an individual test file located for example in `test/rubygems/test_deprecate.rb` you can use:
63
+ To run an individual test file located for example in `test/rubygems/test_deprecate.rb` you can use:
64
64
 
65
65
  ruby -Ilib:test:bundler/lib test/rubygems/test_deprecate.rb
66
-
67
- And to run an individual test method named `test_default` within a test file, you can use:
66
+
67
+ And to run an individual test method named `test_default` within a test file, you can use:
68
68
 
69
69
  ruby -Ilib:test:bundler/lib test/rubygems/test_deprecate.rb -n /test_default/
70
70
 
@@ -80,9 +80,9 @@ To run the entire bundler test suite in parallel (it takes a while):
80
80
 
81
81
  bin/parallel_rspec
82
82
 
83
- To run the entire bundler test suite sequentially (get a coffee because it's very slow):
83
+ There are some realworld higher level specs run in CI, but not run by `bin/parallel_rspec`. You can run those with:
84
84
 
85
- bin/rspec
85
+ bin/rake spec:realworld
86
86
 
87
87
  To run an individual test file location for example in `spec/install/gems/standalone_spec.rb` you can use:
88
88
 
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ # 2.4.5 (January 21, 2023)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix `bundler/inline` not resolving properly if gems not preinstalled [#6282](https://github.com/rubygems/rubygems/pull/6282)
6
+ - Fix packages for external platforms being introduced in lockfile when Bundler retries resolution [#6285](https://github.com/rubygems/rubygems/pull/6285)
7
+
8
+ ## Documentation:
9
+
10
+ - Update bundle-exec man page to not use deprecated `Bundler.with_clean_env` [#6284](https://github.com/rubygems/rubygems/pull/6284)
11
+
12
+ # 2.4.4 (January 16, 2023)
13
+
14
+ ## Bug fixes:
15
+
16
+ - Fix platform specific gems removed from the lockfile [#6266](https://github.com/rubygems/rubygems/pull/6266)
17
+ - Properly handle incompatibilities on platform specific gems [#6270](https://github.com/rubygems/rubygems/pull/6270)
18
+ - Optimistically exclude prereleases from initial resolution [#6246](https://github.com/rubygems/rubygems/pull/6246)
19
+ - Fix another case of not properly falling back to ruby variant when materializing [#6261](https://github.com/rubygems/rubygems/pull/6261)
20
+ - Skip setting `BUNDLER_SETUP` on Ruby 2.6 [#6252](https://github.com/rubygems/rubygems/pull/6252)
21
+ - Let resolver deal with legacy gems with equivalent version and different dependencies [#6219](https://github.com/rubygems/rubygems/pull/6219)
22
+
1
23
  # 2.4.3 (January 6, 2023)
2
24
 
3
25
  ## 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 = "2023-01-06".freeze
8
- @git_commit_sha = "ed1f27f75c".freeze
7
+ @built_at = "2023-01-21".freeze
8
+ @git_commit_sha = "d8ff3b6e4a".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -159,13 +159,6 @@ module Bundler
159
159
  resolve
160
160
  end
161
161
 
162
- def resolve_prefering_local!
163
- @prefer_local = true
164
- @remote = true
165
- sources.remote!
166
- resolve
167
- end
168
-
169
162
  def resolve_with_cache!
170
163
  sources.cached!
171
164
  resolve
@@ -177,6 +170,23 @@ module Bundler
177
170
  resolve
178
171
  end
179
172
 
173
+ def resolution_mode=(options)
174
+ if options["local"]
175
+ @remote = false
176
+ else
177
+ @remote = true
178
+ @prefer_local = options["prefer-local"]
179
+ end
180
+ end
181
+
182
+ def setup_sources_for_resolve
183
+ if @remote == false
184
+ sources.cached!
185
+ else
186
+ sources.remote!
187
+ end
188
+ end
189
+
180
190
  # For given dependency list returns a SpecSet with Gemspec of all the required
181
191
  # dependencies.
182
192
  # 1. The method first resolves the dependencies specified in Gemfile
@@ -473,31 +483,19 @@ module Bundler
473
483
  private
474
484
 
475
485
  def resolver
476
- @resolver ||= begin
477
- last_resolve = converge_locked_specs
478
- remove_ruby_from_platforms_if_necessary!(current_dependencies)
479
- Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve))
480
- end
486
+ @resolver ||= Resolver.new(resolution_packages, gem_version_promoter)
481
487
  end
482
488
 
483
489
  def expanded_dependencies
484
- @expanded_dependencies ||= dependencies + metadata_dependencies
490
+ dependencies + metadata_dependencies
485
491
  end
486
492
 
487
493
  def resolution_packages
488
494
  @resolution_packages ||= begin
489
- packages = Hash.new do |h, k|
490
- h[k] = Resolver::Package.new(k, @platforms, @originally_locked_specs, @unlock[:gems])
491
- end
492
-
493
- expanded_dependencies.each do |dep|
494
- name = dep.name
495
- platforms = dep.gem_platforms(@platforms)
496
-
497
- packages[name] = Resolver::Package.new(name, platforms, @originally_locked_specs, @unlock[:gems], :dependency => dep)
498
- end
499
-
500
- packages
495
+ last_resolve = converge_locked_specs
496
+ remove_ruby_from_platforms_if_necessary!(current_dependencies)
497
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
498
+ additional_base_requirements_for_resolve(packages, last_resolve)
501
499
  end
502
500
  end
503
501
 
@@ -531,13 +529,15 @@ module Bundler
531
529
  break if incomplete_specs.empty?
532
530
 
533
531
  Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
534
- @resolve = start_resolution(:exclude_specs => incomplete_specs)
532
+ setup_sources_for_resolve
533
+ resolution_packages.delete(incomplete_specs)
534
+ @resolve = start_resolution
535
535
  specs = resolve.materialize(dependencies)
536
536
 
537
537
  still_incomplete_specs = specs.incomplete_specs
538
538
 
539
539
  if still_incomplete_specs == incomplete_specs
540
- package = resolution_packages[incomplete_specs.first.name]
540
+ package = resolution_packages.get_package(incomplete_specs.first.name)
541
541
  resolver.raise_not_found! package
542
542
  end
543
543
 
@@ -550,14 +550,14 @@ module Bundler
550
550
  specs
551
551
  end
552
552
 
553
- def start_resolution(exclude_specs: [])
554
- result = resolver.start(expanded_dependencies, resolution_packages, :exclude_specs => exclude_specs)
553
+ def start_resolution
554
+ result = resolver.start
555
555
 
556
556
  SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
557
557
  end
558
558
 
559
559
  def precompute_source_requirements_for_indirect_dependencies?
560
- @remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
560
+ sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
561
561
  end
562
562
 
563
563
  def pin_locally_available_names(source_requirements)
@@ -885,11 +885,12 @@ module Bundler
885
885
  current == proposed
886
886
  end
887
887
 
888
- def additional_base_requirements_for_resolve(last_resolve)
889
- return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
890
- converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
891
- Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
892
- end.uniq
888
+ def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
889
+ return resolution_packages unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
890
+ converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
891
+ resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
892
+ end
893
+ resolution_packages
893
894
  end
894
895
 
895
896
  def remove_ruby_from_platforms_if_necessary!(dependencies)
@@ -249,17 +249,13 @@ module Bundler
249
249
 
250
250
  # returns whether or not a re-resolve was needed
251
251
  def resolve_if_needed(options)
252
+ @definition.resolution_mode = options
253
+
252
254
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
253
255
  return false if @definition.nothing_changed? && !@definition.missing_specs?
254
256
  end
255
257
 
256
- if options["local"]
257
- @definition.resolve_with_cache!
258
- elsif options["prefer-local"]
259
- @definition.resolve_prefering_local!
260
- else
261
- @definition.resolve_remotely!
262
- end
258
+ @definition.setup_sources_for_resolve
263
259
 
264
260
  true
265
261
  end
@@ -89,7 +89,7 @@ module Bundler
89
89
 
90
90
  installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
91
91
 
92
- specification = __materialize__(installable_candidates)
92
+ specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
93
93
  return specification unless specification.nil?
94
94
 
95
95
  if target_platform != platform
@@ -102,13 +102,18 @@ module Bundler
102
102
  __materialize__(candidates)
103
103
  end
104
104
 
105
- def __materialize__(candidates)
105
+ # If in frozen mode, we fallback to a non-installable candidate because by
106
+ # doing this we avoid re-resolving and potentially end up changing the
107
+ # lock file, which is not allowed. In that case, we will give a proper error
108
+ # about the mismatch higher up the stack, right before trying to install the
109
+ # bad gem.
110
+ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
106
111
  search = candidates.reverse.find do |spec|
107
112
  spec.is_a?(StubSpecification) ||
108
113
  (spec.matches_current_ruby? &&
109
114
  spec.matches_current_rubygems?)
110
115
  end
111
- if search.nil? && Bundler.frozen_bundle?
116
+ if search.nil? && fallback_to_non_installable
112
117
  search = candidates.last
113
118
  else
114
119
  search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
@@ -74,13 +74,13 @@ Finally, \fBbundle exec\fR also implicitly modifies \fBGemfile\.lock\fR if the l
74
74
  By default, when attempting to \fBbundle exec\fR to a file with a ruby shebang, Bundler will \fBKernel\.load\fR that file instead of using \fBKernel\.exec\fR\. For the vast majority of cases, this is a performance improvement\. In a rare few cases, this could cause some subtle side\-effects (such as dependence on the exact contents of \fB$0\fR or \fB__FILE__\fR) and the optimization can be disabled by enabling the \fBdisable_exec_load\fR setting\.
75
75
  .
76
76
  .SS "Shelling out"
77
- Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_clean_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle:
77
+ Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_unbundled_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle:
78
78
  .
79
79
  .IP "" 4
80
80
  .
81
81
  .nf
82
82
 
83
- Bundler\.with_clean_env do
83
+ Bundler\.with_unbundled_env do
84
84
  `brew install wget`
85
85
  end
86
86
  .
@@ -89,13 +89,13 @@ end
89
89
  .IP "" 0
90
90
  .
91
91
  .P
92
- Using \fBwith_clean_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_clean_env\fR\.
92
+ Using \fBwith_unbundled_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_unbundled_env\fR\.
93
93
  .
94
94
  .IP "" 4
95
95
  .
96
96
  .nf
97
97
 
98
- Bundler\.with_clean_env do
98
+ Bundler\.with_unbundled_env do
99
99
  Dir\.chdir "/other/bundler/project" do
100
100
  `bundle exec \./script`
101
101
  end
@@ -84,20 +84,20 @@ the `disable_exec_load` setting.
84
84
  Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will
85
85
  automatically use the current Bundler environment. If you need to shell out to
86
86
  a Ruby command that is not part of your current bundle, use the
87
- `with_clean_env` method with a block. Any subshells created inside the block
87
+ `with_unbundled_env` method with a block. Any subshells created inside the block
88
88
  will be given the environment present before Bundler was activated. For
89
89
  example, Homebrew commands run Ruby, but don't work inside a bundle:
90
90
 
91
- Bundler.with_clean_env do
91
+ Bundler.with_unbundled_env do
92
92
  `brew install wget`
93
93
  end
94
94
 
95
- Using `with_clean_env` is also necessary if you are shelling out to a different
95
+ Using `with_unbundled_env` is also necessary if you are shelling out to a different
96
96
  bundle. Any Bundler commands run in a subshell will inherit the current
97
97
  Gemfile, so commands that need to run in the context of a different bundle also
98
- need to use `with_clean_env`.
98
+ need to use `with_unbundled_env`.
99
99
 
100
- Bundler.with_clean_env do
100
+ Bundler.with_unbundled_env do
101
101
  Dir.chdir "/other/bundler/project" do
102
102
  `bundle exec ./script`
103
103
  end
@@ -1,19 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "package"
4
+
3
5
  module Bundler
4
6
  class Resolver
5
7
  class Base
6
- def initialize(base, additional_base_requirements)
8
+ attr_reader :packages, :requirements, :source_requirements
9
+
10
+ def initialize(source_requirements, dependencies, base, platforms, options)
11
+ @source_requirements = source_requirements
12
+
7
13
  @base = base
8
- @additional_base_requirements = additional_base_requirements
14
+
15
+ @packages = Hash.new do |hash, name|
16
+ hash[name] = Package.new(name, platforms, **options)
17
+ end
18
+
19
+ @requirements = dependencies.map do |dep|
20
+ dep_platforms = dep.gem_platforms(platforms)
21
+
22
+ # Dependencies scoped to external platforms are ignored
23
+ next if dep_platforms.empty?
24
+
25
+ name = dep.name
26
+
27
+ @packages[name] = Package.new(name, dep_platforms, **options.merge(:dependency => dep))
28
+
29
+ dep
30
+ end.compact
9
31
  end
10
32
 
11
33
  def [](name)
12
34
  @base[name]
13
35
  end
14
36
 
15
- def delete(spec)
16
- @base.delete(spec)
37
+ def delete(specs)
38
+ specs.each do |spec|
39
+ @base.delete(spec)
40
+ end
41
+ end
42
+
43
+ def get_package(name)
44
+ @packages[name]
17
45
  end
18
46
 
19
47
  def base_requirements
@@ -24,10 +52,14 @@ module Bundler
24
52
  names.each do |name|
25
53
  @base.delete_by_name(name)
26
54
 
27
- @additional_base_requirements.reject! {|dep| dep.name == name }
55
+ @base_requirements.delete(name)
28
56
  end
57
+ end
29
58
 
30
- @base_requirements = nil
59
+ def include_prereleases(names)
60
+ names.each do |name|
61
+ get_package(name).consider_prereleases!
62
+ end
31
63
  end
32
64
 
33
65
  private
@@ -38,7 +70,6 @@ module Bundler
38
70
  req = Gem::Requirement.new(ls.version)
39
71
  base_requirements[ls.name] = req
40
72
  end
41
- @additional_base_requirements.each {|d| base_requirements[d.name] = d.requirement }
42
73
  base_requirements
43
74
  end
44
75
  end
@@ -26,9 +26,8 @@ module Bundler
26
26
 
27
27
  def initialize(version, specs: [])
28
28
  @spec_group = Resolver::SpecGroup.new(specs)
29
- @platforms = specs.map(&:platform).sort_by(&:to_s).uniq
30
29
  @version = Gem::Version.new(version)
31
- @ruby_only = @platforms == [Gem::Platform::RUBY]
30
+ @ruby_only = specs.map(&:platform).uniq == [Gem::Platform::RUBY]
32
31
  end
33
32
 
34
33
  def dependencies
@@ -88,9 +87,7 @@ module Bundler
88
87
  end
89
88
 
90
89
  def to_s
91
- return @version.to_s if @platforms.empty? || @ruby_only
92
-
93
- "#{@version} (#{@platforms.join(", ")})"
90
+ @version.to_s
94
91
  end
95
92
  end
96
93
  end
@@ -15,12 +15,13 @@ module Bundler
15
15
  class Package
16
16
  attr_reader :name, :platforms, :dependency, :locked_version
17
17
 
18
- def initialize(name, platforms, locked_specs, unlock, dependency: nil)
18
+ def initialize(name, platforms, locked_specs:, unlock:, prerelease: false, dependency: nil)
19
19
  @name = name
20
20
  @platforms = platforms
21
21
  @locked_version = locked_specs[name].first&.version
22
22
  @unlock = unlock
23
23
  @dependency = dependency || Dependency.new(name, @locked_version)
24
+ @prerelease = @dependency.prerelease? || @locked_version&.prerelease? || prerelease ? :consider_first : :ignore
24
25
  end
25
26
 
26
27
  def to_s
@@ -47,8 +48,16 @@ module Bundler
47
48
  @unlock.empty? || @unlock.include?(name)
48
49
  end
49
50
 
51
+ def ignores_prereleases?
52
+ @prerelease == :ignore
53
+ end
54
+
50
55
  def prerelease_specified?
51
- @dependency.prerelease?
56
+ @prerelease == :consider_first
57
+ end
58
+
59
+ def consider_prereleases!
60
+ @prerelease = :consider_last
52
61
  end
53
62
 
54
63
  def force_ruby_platform?
@@ -9,26 +9,21 @@ module Bundler
9
9
  class Resolver
10
10
  require_relative "vendored_pub_grub"
11
11
  require_relative "resolver/base"
12
- require_relative "resolver/package"
13
12
  require_relative "resolver/candidate"
14
13
  require_relative "resolver/incompatibility"
15
14
  require_relative "resolver/root"
16
15
 
17
16
  include GemHelpers
18
17
 
19
- def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements)
20
- @source_requirements = source_requirements
21
- @base = Resolver::Base.new(base, additional_base_requirements)
18
+ def initialize(base, gem_version_promoter)
19
+ @source_requirements = base.source_requirements
20
+ @base = base
22
21
  @gem_version_promoter = gem_version_promoter
23
22
  end
24
23
 
25
- def start(requirements, packages, exclude_specs: [])
26
- exclude_specs.each do |spec|
27
- remove_from_candidates(spec)
28
- end
29
-
30
- @requirements = requirements
31
- @packages = packages
24
+ def start
25
+ @requirements = @base.requirements
26
+ @packages = @base.packages
32
27
 
33
28
  root, logger = setup_solver
34
29
 
@@ -78,33 +73,26 @@ module Bundler
78
73
  rescue PubGrub::SolveFailure => e
79
74
  incompatibility = e.incompatibility
80
75
 
81
- names_to_unlock = []
82
- extended_explanation = nil
76
+ names_to_unlock, names_to_allow_prereleases_for, extended_explanation = find_names_to_relax(incompatibility)
83
77
 
84
- while incompatibility.conflict?
85
- cause = incompatibility.cause
86
- incompatibility = cause.incompatibility
87
-
88
- incompatibility.terms.each do |term|
89
- name = term.package.name
90
- names_to_unlock << name if base_requirements[name]
78
+ names_to_relax = names_to_unlock + names_to_allow_prereleases_for
91
79
 
92
- no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
93
- next unless no_versions_incompat
80
+ if names_to_relax.any?
81
+ if names_to_unlock.any?
82
+ Bundler.ui.debug "Found conflicts with locked dependencies. Will retry with #{names_to_unlock.join(", ")} unlocked...", true
94
83
 
95
- extended_explanation = no_versions_incompat.extended_explanation
84
+ @base.unlock_names(names_to_unlock)
96
85
  end
97
- end
98
-
99
- names_to_unlock.uniq!
100
86
 
101
- if names_to_unlock.any?
102
- Bundler.ui.debug "Found conflicts with locked dependencies. Retrying with #{names_to_unlock.join(", ")} unlocked...", true
87
+ if names_to_allow_prereleases_for.any?
88
+ Bundler.ui.debug "Found conflicts with dependencies with prereleases. Will retrying considering prereleases for #{names_to_allow_prereleases_for.join(", ")}...", true
103
89
 
104
- @base.unlock_names(names_to_unlock)
90
+ @base.include_prereleases(names_to_allow_prereleases_for)
91
+ end
105
92
 
106
93
  root, logger = setup_solver
107
94
 
95
+ Bundler.ui.debug "Retrying resolution...", true
108
96
  retry
109
97
  end
110
98
 
@@ -118,6 +106,35 @@ module Bundler
118
106
  raise SolveFailure.new(explanation)
119
107
  end
120
108
 
109
+ def find_names_to_relax(incompatibility)
110
+ names_to_unlock = []
111
+ names_to_allow_prereleases_for = []
112
+ extended_explanation = nil
113
+
114
+ while incompatibility.conflict?
115
+ cause = incompatibility.cause
116
+ incompatibility = cause.incompatibility
117
+
118
+ incompatibility.terms.each do |term|
119
+ package = term.package
120
+ name = package.name
121
+
122
+ if base_requirements[name]
123
+ names_to_unlock << name
124
+ elsif package.ignores_prereleases?
125
+ names_to_allow_prereleases_for << name
126
+ end
127
+
128
+ no_versions_incompat = [cause.incompatibility, cause.satisfier].find {|incompat| incompat.cause.is_a?(PubGrub::Incompatibility::NoVersions) }
129
+ next unless no_versions_incompat
130
+
131
+ extended_explanation = no_versions_incompat.extended_explanation
132
+ end
133
+ end
134
+
135
+ [names_to_unlock.uniq, names_to_allow_prereleases_for.uniq, extended_explanation]
136
+ end
137
+
121
138
  def parse_dependency(package, dependency)
122
139
  range = if repository_for(package).is_a?(Source::Gemspec)
123
140
  PubGrub::VersionRange.any
@@ -215,7 +232,7 @@ module Bundler
215
232
 
216
233
  def all_versions_for(package)
217
234
  name = package.name
218
- results = (@base[name] + @all_specs[name]).uniq(&:full_name)
235
+ results = (@base[name] + filter_prereleases(@all_specs[name], package)).uniq {|spec| [spec.version.hash, spec.platform] }
219
236
  locked_requirement = base_requirements[name]
220
237
  results = filter_matching_specs(results, locked_requirement) if locked_requirement
221
238
 
@@ -284,6 +301,12 @@ module Bundler
284
301
  end
285
302
  end
286
303
 
304
+ def filter_prereleases(specs, package)
305
+ return specs unless package.ignores_prereleases?
306
+
307
+ specs.reject {|s| s.version.prerelease? }
308
+ end
309
+
287
310
  def requirement_satisfied_by?(requirement, spec)
288
311
  requirement.satisfied_by?(spec.version) || spec.source.is_a?(Source::Gemspec)
289
312
  end
@@ -304,25 +327,20 @@ module Bundler
304
327
  @base.base_requirements
305
328
  end
306
329
 
307
- def remove_from_candidates(spec)
308
- @base.delete(spec)
309
- end
310
-
311
330
  def prepare_dependencies(requirements, packages)
312
331
  to_dependency_hash(requirements, packages).map do |dep_package, dep_constraint|
313
332
  name = dep_package.name
314
333
 
315
- # If a dependency is scoped to a platform different from the current
316
- # one, we ignore it. However, it may reappear during resolution as a
317
- # transitive dependency of another package, so we need to reset the
318
- # package so the proper versions are considered if reintroduced later.
319
- if dep_package.platforms.empty?
320
- @packages.delete(name)
321
- next
334
+ next [dep_package, dep_constraint] if name == "bundler"
335
+
336
+ versions = versions_for(dep_package, dep_constraint.range)
337
+ if versions.empty? && dep_package.ignores_prereleases?
338
+ @sorted_versions.delete(dep_package)
339
+ dep_package.consider_prereleases!
340
+ versions = versions_for(dep_package, dep_constraint.range)
322
341
  end
342
+ next [dep_package, dep_constraint] unless versions.empty?
323
343
 
324
- next [dep_package, dep_constraint] if name == "bundler"
325
- next [dep_package, dep_constraint] unless versions_for(dep_package, dep_constraint.range).empty?
326
344
  next unless dep_package.current_platform?
327
345
 
328
346
  raise_not_found!(dep_package)
@@ -284,7 +284,7 @@ module Bundler
284
284
  Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
285
285
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
286
286
  Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
287
- Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__)
287
+ Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__) unless RUBY_VERSION < "2.7"
288
288
  end
289
289
 
290
290
  def set_path
@@ -292,7 +292,7 @@ module Bundler
292
292
  end
293
293
 
294
294
  def dependency_api_available?
295
- api_fetchers.any?
295
+ @allow_remote && api_fetchers.any?
296
296
  end
297
297
 
298
298
  protected
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.3".freeze
4
+ VERSION = "2.4.5".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -1,9 +1,4 @@
1
1
  # frozen_string_literal: true
2
- ##
3
- # RubyGems adds the #gem method to allow activation of specific gem versions
4
- # and overrides the #require method on Kernel to make gems appear as if they
5
- # live on the <code>$LOAD_PATH</code>. See the documentation of these methods
6
- # for further detail.
7
2
 
8
3
  module Kernel
9
4
 
@@ -13,12 +13,12 @@ module Kernel
13
13
 
14
14
  # Make sure we have a reference to Ruby's original Kernel#require
15
15
  unless defined?(gem_original_require)
16
+ # :stopdoc:
16
17
  alias gem_original_require require
17
18
  private :gem_original_require
19
+ # :startdoc:
18
20
  end
19
21
 
20
- file = Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES ? "<internal:#{__FILE__}>" : __FILE__
21
- module_eval <<'RUBY', file, __LINE__ + 1 # rubocop:disable Style/EvalWithLocation
22
22
  ##
23
23
  # When RubyGems is required, Kernel#require is replaced with our own which
24
24
  # is capable of loading gems on demand.
@@ -33,7 +33,7 @@ module Kernel
33
33
  # The normal <tt>require</tt> functionality of returning false if
34
34
  # that file has already been loaded is preserved.
35
35
 
36
- def require(path)
36
+ def require(path) # :doc:
37
37
  if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
38
38
  monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
39
39
  end
@@ -147,17 +147,17 @@ module Kernel
147
147
  RUBYGEMS_ACTIVATION_MONITOR.exit
148
148
  return gem_original_require(path)
149
149
  rescue LoadError => load_error
150
- RUBYGEMS_ACTIVATION_MONITOR.enter
150
+ if load_error.path == path
151
+ RUBYGEMS_ACTIVATION_MONITOR.enter
151
152
 
152
- begin
153
- if load_error.path == path and Gem.try_activate(path)
154
- require_again = true
153
+ begin
154
+ require_again = Gem.try_activate(path)
155
+ ensure
156
+ RUBYGEMS_ACTIVATION_MONITOR.exit
155
157
  end
156
- ensure
157
- RUBYGEMS_ACTIVATION_MONITOR.exit
158
- end
159
158
 
160
- return gem_original_require(path) if require_again
159
+ return gem_original_require(path) if require_again
160
+ end
161
161
 
162
162
  raise load_error
163
163
  ensure
@@ -168,7 +168,6 @@ module Kernel
168
168
  end
169
169
  end
170
170
  end
171
- RUBY
172
171
 
173
172
  private :require
174
173
 
@@ -1,53 +1,50 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- if !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
3
+ module Kernel
4
+ rubygems_path = "#{__dir__}/" # Frames to be skipped start with this path.
4
5
 
5
- module Kernel
6
- rubygems_path = "#{__dir__}/" # Frames to be skipped start with this path.
6
+ original_warn = instance_method(:warn)
7
7
 
8
- original_warn = instance_method(:warn)
8
+ remove_method :warn
9
9
 
10
+ class << self
10
11
  remove_method :warn
12
+ end
11
13
 
12
- class << self
13
- remove_method :warn
14
+ module_function define_method(:warn) {|*messages, **kw|
15
+ unless uplevel = kw[:uplevel]
16
+ if Gem.java_platform? && RUBY_VERSION < "3.1"
17
+ return original_warn.bind(self).call(*messages)
18
+ else
19
+ return original_warn.bind(self).call(*messages, **kw)
20
+ end
14
21
  end
15
22
 
16
- module_function define_method(:warn) {|*messages, **kw|
17
- unless uplevel = kw[:uplevel]
18
- if Gem.java_platform? && RUBY_VERSION < "3.1"
19
- return original_warn.bind(self).call(*messages)
20
- else
21
- return original_warn.bind(self).call(*messages, **kw)
23
+ # Ensure `uplevel` fits a `long`
24
+ uplevel, = [uplevel].pack("l!").unpack("l!")
25
+
26
+ if uplevel >= 0
27
+ start = 0
28
+ while uplevel >= 0
29
+ loc, = caller_locations(start, 1)
30
+ unless loc
31
+ # No more backtrace
32
+ start += uplevel
33
+ break
22
34
  end
23
- end
24
35
 
25
- # Ensure `uplevel` fits a `long`
26
- uplevel, = [uplevel].pack("l!").unpack("l!")
27
-
28
- if uplevel >= 0
29
- start = 0
30
- while uplevel >= 0
31
- loc, = caller_locations(start, 1)
32
- unless loc
33
- # No more backtrace
34
- start += uplevel
35
- break
36
- end
36
+ start += 1
37
37
 
38
- start += 1
39
-
40
- if path = loc.path
41
- unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
42
- # Non-rubygems frames
43
- uplevel -= 1
44
- end
38
+ if path = loc.path
39
+ unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
40
+ # Non-rubygems frames
41
+ uplevel -= 1
45
42
  end
46
43
  end
47
- kw[:uplevel] = start
48
44
  end
45
+ kw[:uplevel] = start
46
+ end
49
47
 
50
- original_warn.bind(self).call(*messages, **kw)
51
- }
52
- end
48
+ original_warn.bind(self).call(*messages, **kw)
49
+ }
53
50
  end
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require "rbconfig"
9
9
 
10
10
  module Gem
11
- VERSION = "3.4.3".freeze
11
+ VERSION = "3.4.5".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -119,10 +119,6 @@ module Gem
119
119
  # to avoid deprecation warnings in Ruby 2.7.
120
120
  UNTAINT = RUBY_VERSION < "2.7" ? :untaint.to_sym : proc {}
121
121
 
122
- # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
123
- KERNEL_WARN_IGNORES_INTERNAL_ENTRIES = RUBY_ENGINE == "truffleruby" ||
124
- (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
125
-
126
122
  ##
127
123
  # An Array of Regexps that match windows Ruby platforms.
128
124
 
@@ -1349,7 +1345,16 @@ end
1349
1345
  Gem::Specification.load_defaults
1350
1346
 
1351
1347
  require_relative "rubygems/core_ext/kernel_gem"
1352
- require_relative "rubygems/core_ext/kernel_require"
1353
- require_relative "rubygems/core_ext/kernel_warn"
1348
+
1349
+ path = File.join(__dir__, "rubygems/core_ext/kernel_require.rb")
1350
+ # When https://bugs.ruby-lang.org/issues/17259 is available, there is no need to override Kernel#warn
1351
+ if RUBY_ENGINE == "truffleruby" ||
1352
+ (RUBY_ENGINE == "ruby" && RUBY_VERSION >= "3.0")
1353
+ file = "<internal:#{path}>"
1354
+ else
1355
+ require_relative "rubygems/core_ext/kernel_warn"
1356
+ file = path
1357
+ end
1358
+ eval File.read(path), nil, file
1354
1359
 
1355
1360
  require ENV["BUNDLER_SETUP"] if ENV["BUNDLER_SETUP"] && !defined?(Bundler)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.4.3"
5
+ s.version = "3.4.5"
6
6
  s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
7
7
  s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
8
8
 
@@ -151,18 +151,18 @@ dependencies = [
151
151
 
152
152
  [[package]]
153
153
  name = "rb-sys"
154
- version = "0.9.52"
154
+ version = "0.9.54"
155
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
156
- checksum = "02fffdb0162fc4cc1b6509b2d9b32a75f7e7ed392f58bde639e0c33b23e74b97"
156
+ checksum = "b3277448b8eee18de8bedb18883ae02dcd60d47922ddfc6ab408def77da0a9b4"
157
157
  dependencies = [
158
158
  "rb-sys-build",
159
159
  ]
160
160
 
161
161
  [[package]]
162
162
  name = "rb-sys-build"
163
- version = "0.9.52"
163
+ version = "0.9.54"
164
164
  source = "registry+https://github.com/rust-lang/crates.io-index"
165
- checksum = "85d1a236755f879fc155d16d9ba4cd3b1975fd52ef6a28113702ae3881b73c03"
165
+ checksum = "c9baae802c93180af02cccb21819589d109070f8e28e14e7070a9ffdeca9b464"
166
166
  dependencies = [
167
167
  "bindgen",
168
168
  "regex",
@@ -7,4 +7,4 @@ edition = "2021"
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
- rb-sys = "0.9.52"
10
+ rb-sys = "0.9.54"
@@ -144,18 +144,18 @@ dependencies = [
144
144
 
145
145
  [[package]]
146
146
  name = "rb-sys"
147
- version = "0.9.52"
147
+ version = "0.9.54"
148
148
  source = "registry+https://github.com/rust-lang/crates.io-index"
149
- checksum = "02fffdb0162fc4cc1b6509b2d9b32a75f7e7ed392f58bde639e0c33b23e74b97"
149
+ checksum = "b3277448b8eee18de8bedb18883ae02dcd60d47922ddfc6ab408def77da0a9b4"
150
150
  dependencies = [
151
151
  "rb-sys-build",
152
152
  ]
153
153
 
154
154
  [[package]]
155
155
  name = "rb-sys-build"
156
- version = "0.9.52"
156
+ version = "0.9.54"
157
157
  source = "registry+https://github.com/rust-lang/crates.io-index"
158
- checksum = "85d1a236755f879fc155d16d9ba4cd3b1975fd52ef6a28113702ae3881b73c03"
158
+ checksum = "c9baae802c93180af02cccb21819589d109070f8e28e14e7070a9ffdeca9b464"
159
159
  dependencies = [
160
160
  "bindgen",
161
161
  "regex",
@@ -7,4 +7,4 @@ edition = "2021"
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
- rb-sys = "0.9.52"
10
+ rb-sys = "0.9.54"
@@ -680,8 +680,7 @@ class TestGemRequire < Gem::TestCase
680
680
  require "json"
681
681
  RUBY
682
682
  out = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, "-e", cmd)
683
- puts out
684
- assert $?.success?
683
+ assert_predicate $?, :success?, "Require failed due to #{out}"
685
684
  end
686
685
 
687
686
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
4
+ version: 3.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2023-01-06 00:00:00.000000000 Z
19
+ date: 2023-01-21 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality
@@ -834,7 +834,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
834
834
  - !ruby/object:Gem::Version
835
835
  version: '0'
836
836
  requirements: []
837
- rubygems_version: 3.4.3
837
+ rubygems_version: 3.4.5
838
838
  signing_key:
839
839
  specification_version: 4
840
840
  summary: RubyGems is a package management framework for Ruby.