rubygems-update 3.4.5 → 3.4.6

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1115 -1095
  3. data/Manifest.txt +5 -5
  4. data/bundler/CHANGELOG.md +12 -0
  5. data/bundler/lib/bundler/build_metadata.rb +2 -2
  6. data/bundler/lib/bundler/cli/binstubs.rb +5 -1
  7. data/bundler/lib/bundler/inline.rb +6 -8
  8. data/bundler/lib/bundler/installer/standalone.rb +11 -7
  9. data/bundler/lib/bundler/rubygems_integration.rb +8 -4
  10. data/bundler/lib/bundler/version.rb +1 -1
  11. data/lib/rubygems/core_ext/kernel_require.rb +113 -109
  12. data/lib/rubygems/ext/builder.rb +1 -2
  13. data/lib/rubygems/ext/cargo_builder.rb +129 -89
  14. data/lib/rubygems/specification_policy.rb +1 -1
  15. data/lib/rubygems.rb +11 -1
  16. data/rubygems-update.gemspec +1 -1
  17. data/test/rubygems/bundler_test_gem.rb +419 -0
  18. data/test/rubygems/test_gem.rb +0 -412
  19. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +2 -4
  20. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.lock → ext/custom_name_lib/Cargo.lock} +0 -0
  21. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{Cargo.toml → ext/custom_name_lib/Cargo.toml} +0 -0
  22. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/{src → ext/custom_name_lib/src}/lib.rs +1 -1
  23. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb +1 -0
  24. data/test/rubygems/test_gem_ext_cargo_builder.rb +9 -16
  25. data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +5 -10
  26. metadata +8 -8
  27. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +0 -21
  28. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +0 -21
data/Manifest.txt CHANGED
@@ -545,6 +545,7 @@ test/rubygems/alternate_cert.pem
545
545
  test/rubygems/alternate_cert_32.pem
546
546
  test/rubygems/alternate_key.pem
547
547
  test/rubygems/bad_rake.rb
548
+ test/rubygems/bundler_test_gem.rb
548
549
  test/rubygems/ca_cert.pem
549
550
  test/rubygems/child_cert.pem
550
551
  test/rubygems/child_cert_32.pem
@@ -652,15 +653,14 @@ test/rubygems/test_gem_doctor.rb
652
653
  test/rubygems/test_gem_ext_builder.rb
653
654
  test/rubygems/test_gem_ext_cargo_builder.rb
654
655
  test/rubygems/test_gem_ext_cargo_builder/custom_name/.gitignore
655
- test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
656
- test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml
657
- test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb
658
656
  test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec
659
- test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs
657
+ test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.lock
658
+ test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/Cargo.toml
659
+ test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib/src/lib.rs
660
+ test/rubygems/test_gem_ext_cargo_builder/custom_name/lib/custom_name.rb
660
661
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/.gitignore
661
662
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
662
663
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml
663
- test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb
664
664
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/rust_ruby_example.gemspec
665
665
  test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs
666
666
  test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.4.6 (January 31, 2023)
2
+
3
+ ## Enhancements:
4
+
5
+ - Don't warn on `bundle binstubs --standalone --all` [#6312](https://github.com/rubygems/rubygems/pull/6312)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Don't undo require decorations made by other gems [#6308](https://github.com/rubygems/rubygems/pull/6308)
10
+ - Fix `bundler/inline` not properly installing gems with extensions when used more than once [#6306](https://github.com/rubygems/rubygems/pull/6306)
11
+ - Fix `bundler/inline` not skipping installation when gems already there, when used more than once [#6305](https://github.com/rubygems/rubygems/pull/6305)
12
+
1
13
  # 2.4.5 (January 21, 2023)
2
14
 
3
15
  ## Bug fixes:
@@ -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-21".freeze
8
- @git_commit_sha = "d8ff3b6e4a".freeze
7
+ @built_at = "2023-01-31".freeze
8
+ @git_commit_sha = "598c04d54a".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -40,7 +40,11 @@ module Bundler
40
40
  end
41
41
 
42
42
  if options[:standalone]
43
- next Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") if gem_name == "bundler"
43
+ if gem_name == "bundler"
44
+ Bundler.ui.warn("Sorry, Bundler can only be run via RubyGems.") unless options[:all]
45
+ next
46
+ end
47
+
44
48
  Bundler.settings.temporary(:path => (Bundler.settings[:path] || Bundler.root)) do
45
49
  installer.generate_standalone_bundler_executable_stubs(spec, installer_opts)
46
50
  end
@@ -31,6 +31,7 @@
31
31
  #
32
32
  def gemfile(install = false, options = {}, &gemfile)
33
33
  require_relative "../bundler"
34
+ Bundler.reset!
34
35
 
35
36
  opts = options.dup
36
37
  ui = opts.delete(:ui) { Bundler::UI::Shell.new }
@@ -38,9 +39,8 @@ def gemfile(install = false, options = {}, &gemfile)
38
39
  Bundler.ui = ui
39
40
  raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
40
41
 
41
- begin
42
+ Bundler.with_unbundled_env do
42
43
  Bundler.instance_variable_set(:@bundle_path, Pathname.new(Gem.dir))
43
- old_gemfile = ENV["BUNDLE_GEMFILE"]
44
44
  Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", "Gemfile"
45
45
 
46
46
  Bundler::Plugin.gemfile_install(&gemfile) if Bundler.feature_flag.plugins?
@@ -65,11 +65,9 @@ def gemfile(install = false, options = {}, &gemfile)
65
65
  runtime = Bundler::Runtime.new(nil, definition)
66
66
  runtime.setup.require
67
67
  end
68
- ensure
69
- if old_gemfile
70
- ENV["BUNDLE_GEMFILE"] = old_gemfile
71
- else
72
- ENV["BUNDLE_GEMFILE"] = ""
73
- end
68
+ end
69
+
70
+ if ENV["BUNDLE_GEMFILE"].nil?
71
+ ENV["BUNDLE_GEMFILE"] = ""
74
72
  end
75
73
  end
@@ -84,13 +84,17 @@ module Bundler
84
84
 
85
85
  def reverse_rubygems_kernel_mixin
86
86
  <<~END
87
- kernel = (class << ::Kernel; self; end)
88
- [kernel, ::Kernel].each do |k|
89
- if k.private_method_defined?(:gem_original_require)
90
- private_require = k.private_method_defined?(:require)
91
- k.send(:remove_method, :require)
92
- k.send(:define_method, :require, k.instance_method(:gem_original_require))
93
- k.send(:private, :require) if private_require
87
+ if Gem.respond_to?(:discover_gems_on_require=)
88
+ Gem.discover_gems_on_require = false
89
+ else
90
+ kernel = (class << ::Kernel; self; end)
91
+ [kernel, ::Kernel].each do |k|
92
+ if k.private_method_defined?(:gem_original_require)
93
+ private_require = k.private_method_defined?(:require)
94
+ k.send(:remove_method, :require)
95
+ k.send(:define_method, :require, k.instance_method(:gem_original_require))
96
+ k.send(:private, :require) if private_require
97
+ end
94
98
  end
95
99
  end
96
100
  END
@@ -227,10 +227,14 @@ module Bundler
227
227
 
228
228
  def reverse_rubygems_kernel_mixin
229
229
  # Disable rubygems' gem activation system
230
- kernel = (class << ::Kernel; self; end)
231
- [kernel, ::Kernel].each do |k|
232
- if k.private_method_defined?(:gem_original_require)
233
- redefine_method(k, :require, k.instance_method(:gem_original_require))
230
+ if Gem.respond_to?(:discover_gems_on_require=)
231
+ Gem.discover_gems_on_require = false
232
+ else
233
+ kernel = (class << ::Kernel; self; end)
234
+ [kernel, ::Kernel].each do |k|
235
+ if k.private_method_defined?(:gem_original_require)
236
+ redefine_method(k, :require, k.instance_method(:gem_original_require))
237
+ end
234
238
  end
235
239
  end
236
240
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.5".freeze
4
+ VERSION = "2.4.6".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -34,137 +34,141 @@ module Kernel
34
34
  # that file has already been loaded is preserved.
35
35
 
36
36
  def require(path) # :doc:
37
- if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
38
- monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
39
- end
40
- RUBYGEMS_ACTIVATION_MONITOR.enter
41
-
42
- path = path.to_path if path.respond_to? :to_path
43
-
44
- if spec = Gem.find_unresolved_default_spec(path)
45
- # Ensure -I beats a default gem
46
- resolved_path = begin
47
- rp = nil
48
- load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
49
- Gem.suffixes.each do |s|
50
- $LOAD_PATH[0...load_path_check_index].each do |lp|
51
- safe_lp = lp.dup.tap(&Gem::UNTAINT)
52
- begin
53
- if File.symlink? safe_lp # for backward compatibility
54
- next
37
+ return gem_original_require(path) unless Gem.discover_gems_on_require
38
+
39
+ begin
40
+ if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
41
+ monitor_owned = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?
42
+ end
43
+ RUBYGEMS_ACTIVATION_MONITOR.enter
44
+
45
+ path = path.to_path if path.respond_to? :to_path
46
+
47
+ if spec = Gem.find_unresolved_default_spec(path)
48
+ # Ensure -I beats a default gem
49
+ resolved_path = begin
50
+ rp = nil
51
+ load_path_check_index = Gem.load_path_insert_index - Gem.activated_gem_paths
52
+ Gem.suffixes.each do |s|
53
+ $LOAD_PATH[0...load_path_check_index].each do |lp|
54
+ safe_lp = lp.dup.tap(&Gem::UNTAINT)
55
+ begin
56
+ if File.symlink? safe_lp # for backward compatibility
57
+ next
58
+ end
59
+ rescue SecurityError
60
+ RUBYGEMS_ACTIVATION_MONITOR.exit
61
+ raise
55
62
  end
56
- rescue SecurityError
57
- RUBYGEMS_ACTIVATION_MONITOR.exit
58
- raise
59
- end
60
63
 
61
- full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
62
- if File.file?(full_path)
63
- rp = full_path
64
- break
64
+ full_path = File.expand_path(File.join(safe_lp, "#{path}#{s}"))
65
+ if File.file?(full_path)
66
+ rp = full_path
67
+ break
68
+ end
65
69
  end
70
+ break if rp
66
71
  end
67
- break if rp
72
+ rp
68
73
  end
69
- rp
74
+
75
+ begin
76
+ Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
77
+ rescue Exception
78
+ RUBYGEMS_ACTIVATION_MONITOR.exit
79
+ raise
80
+ end unless resolved_path
70
81
  end
71
82
 
72
- begin
73
- Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
74
- rescue Exception
75
- RUBYGEMS_ACTIVATION_MONITOR.exit
76
- raise
77
- end unless resolved_path
78
- end
83
+ # If there are no unresolved deps, then we can use just try
84
+ # normal require handle loading a gem from the rescue below.
79
85
 
80
- # If there are no unresolved deps, then we can use just try
81
- # normal require handle loading a gem from the rescue below.
86
+ if Gem::Specification.unresolved_deps.empty?
87
+ RUBYGEMS_ACTIVATION_MONITOR.exit
88
+ return gem_original_require(path)
89
+ end
82
90
 
83
- if Gem::Specification.unresolved_deps.empty?
84
- RUBYGEMS_ACTIVATION_MONITOR.exit
85
- return gem_original_require(path)
86
- end
91
+ # If +path+ is for a gem that has already been loaded, don't
92
+ # bother trying to find it in an unresolved gem, just go straight
93
+ # to normal require.
94
+ #--
95
+ # TODO request access to the C implementation of this to speed up RubyGems
87
96
 
88
- # If +path+ is for a gem that has already been loaded, don't
89
- # bother trying to find it in an unresolved gem, just go straight
90
- # to normal require.
91
- #--
92
- # TODO request access to the C implementation of this to speed up RubyGems
97
+ if Gem::Specification.find_active_stub_by_path(path)
98
+ RUBYGEMS_ACTIVATION_MONITOR.exit
99
+ return gem_original_require(path)
100
+ end
93
101
 
94
- if Gem::Specification.find_active_stub_by_path(path)
95
- RUBYGEMS_ACTIVATION_MONITOR.exit
96
- return gem_original_require(path)
97
- end
102
+ # Attempt to find +path+ in any unresolved gems...
103
+
104
+ found_specs = Gem::Specification.find_in_unresolved path
105
+
106
+ # If there are no directly unresolved gems, then try and find +path+
107
+ # in any gems that are available via the currently unresolved gems.
108
+ # For example, given:
109
+ #
110
+ # a => b => c => d
111
+ #
112
+ # If a and b are currently active with c being unresolved and d.rb is
113
+ # requested, then find_in_unresolved_tree will find d.rb in d because
114
+ # it's a dependency of c.
115
+ #
116
+ if found_specs.empty?
117
+ found_specs = Gem::Specification.find_in_unresolved_tree path
118
+
119
+ found_specs.each do |found_spec|
120
+ found_spec.activate
121
+ end
98
122
 
99
- # Attempt to find +path+ in any unresolved gems...
100
-
101
- found_specs = Gem::Specification.find_in_unresolved path
102
-
103
- # If there are no directly unresolved gems, then try and find +path+
104
- # in any gems that are available via the currently unresolved gems.
105
- # For example, given:
106
- #
107
- # a => b => c => d
108
- #
109
- # If a and b are currently active with c being unresolved and d.rb is
110
- # requested, then find_in_unresolved_tree will find d.rb in d because
111
- # it's a dependency of c.
112
- #
113
- if found_specs.empty?
114
- found_specs = Gem::Specification.find_in_unresolved_tree path
115
-
116
- found_specs.each do |found_spec|
117
- found_spec.activate
118
- end
123
+ # We found +path+ directly in an unresolved gem. Now we figure out, of
124
+ # the possible found specs, which one we should activate.
125
+ else
119
126
 
120
- # We found +path+ directly in an unresolved gem. Now we figure out, of
121
- # the possible found specs, which one we should activate.
122
- else
127
+ # Check that all the found specs are just different
128
+ # versions of the same gem
129
+ names = found_specs.map(&:name).uniq
123
130
 
124
- # Check that all the found specs are just different
125
- # versions of the same gem
126
- names = found_specs.map(&:name).uniq
131
+ if names.size > 1
132
+ RUBYGEMS_ACTIVATION_MONITOR.exit
133
+ raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
134
+ end
127
135
 
128
- if names.size > 1
129
- RUBYGEMS_ACTIVATION_MONITOR.exit
130
- raise Gem::LoadError, "#{path} found in multiple gems: #{names.join ', '}"
131
- end
136
+ # Ok, now find a gem that has no conflicts, starting
137
+ # at the highest version.
138
+ valid = found_specs.find {|s| !s.has_conflicts? }
132
139
 
133
- # Ok, now find a gem that has no conflicts, starting
134
- # at the highest version.
135
- valid = found_specs.find {|s| !s.has_conflicts? }
140
+ unless valid
141
+ le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
142
+ le.name = names.first
143
+ RUBYGEMS_ACTIVATION_MONITOR.exit
144
+ raise le
145
+ end
136
146
 
137
- unless valid
138
- le = Gem::LoadError.new "unable to find a version of '#{names.first}' to activate"
139
- le.name = names.first
140
- RUBYGEMS_ACTIVATION_MONITOR.exit
141
- raise le
147
+ valid.activate
142
148
  end
143
149
 
144
- valid.activate
145
- end
146
-
147
- RUBYGEMS_ACTIVATION_MONITOR.exit
148
- return gem_original_require(path)
149
- rescue LoadError => load_error
150
- if load_error.path == path
151
- RUBYGEMS_ACTIVATION_MONITOR.enter
150
+ RUBYGEMS_ACTIVATION_MONITOR.exit
151
+ return gem_original_require(path)
152
+ rescue LoadError => load_error
153
+ if load_error.path == path
154
+ RUBYGEMS_ACTIVATION_MONITOR.enter
155
+
156
+ begin
157
+ require_again = Gem.try_activate(path)
158
+ ensure
159
+ RUBYGEMS_ACTIVATION_MONITOR.exit
160
+ end
152
161
 
153
- begin
154
- require_again = Gem.try_activate(path)
155
- ensure
156
- RUBYGEMS_ACTIVATION_MONITOR.exit
162
+ return gem_original_require(path) if require_again
157
163
  end
158
164
 
159
- return gem_original_require(path) if require_again
160
- end
161
-
162
- raise load_error
163
- ensure
164
- if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
165
- if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?)
166
- STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $!
167
- raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}"
165
+ raise load_error
166
+ ensure
167
+ if RUBYGEMS_ACTIVATION_MONITOR.respond_to?(:mon_owned?)
168
+ if monitor_owned != (ow = RUBYGEMS_ACTIVATION_MONITOR.mon_owned?)
169
+ STDERR.puts [$$, Thread.current, $!, $!.backtrace].inspect if $!
170
+ raise "CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before #{monitor_owned} -> after #{ow}"
171
+ end
168
172
  end
169
173
  end
170
174
  end
@@ -131,8 +131,7 @@ class Gem::Ext::Builder
131
131
  when /CMakeLists.txt/ then
132
132
  Gem::Ext::CmakeBuilder
133
133
  when /Cargo.toml/ then
134
- # We use the spec name here to ensure we invoke the correct init function later
135
- Gem::Ext::CargoBuilder.new(@spec)
134
+ Gem::Ext::CargoBuilder.new
136
135
  else
137
136
  build_error("No builder for extension '#{extension}'")
138
137
  end