rubygems-update 3.3.16 → 3.3.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/bundler/CHANGELOG.md +21 -0
  4. data/bundler/lib/bundler/build_metadata.rb +2 -2
  5. data/bundler/lib/bundler/cli/cache.rb +1 -1
  6. data/bundler/lib/bundler/cli/install.rb +2 -0
  7. data/bundler/lib/bundler/cli.rb +6 -2
  8. data/bundler/lib/bundler/current_ruby.rb +1 -1
  9. data/bundler/lib/bundler/dependency.rb +1 -1
  10. data/bundler/lib/bundler/friendly_errors.rb +5 -2
  11. data/bundler/lib/bundler/gem_helpers.rb +1 -0
  12. data/bundler/lib/bundler/index.rb +1 -5
  13. data/bundler/lib/bundler/installer/standalone.rb +29 -2
  14. data/bundler/lib/bundler/lazy_specification.rb +2 -2
  15. data/bundler/lib/bundler/man/bundle-add.1 +1 -1
  16. data/bundler/lib/bundler/man/bundle-add.1.ronn +1 -1
  17. data/bundler/lib/bundler/match_platform.rb +0 -1
  18. data/bundler/lib/bundler/resolver.rb +1 -1
  19. data/bundler/lib/bundler/rubygems_ext.rb +6 -5
  20. data/bundler/lib/bundler/source/rubygems.rb +2 -0
  21. data/bundler/lib/bundler/spec_set.rb +11 -8
  22. data/bundler/lib/bundler/version.rb +1 -1
  23. data/lib/rubygems/commands/environment_command.rb +5 -2
  24. data/lib/rubygems/ext/builder.rb +9 -2
  25. data/lib/rubygems/ext/cargo_builder.rb +11 -18
  26. data/lib/rubygems/ext/ext_conf_builder.rb +31 -56
  27. data/lib/rubygems/indexer.rb +2 -0
  28. data/lib/rubygems.rb +3 -2
  29. data/rubygems-update.gemspec +1 -1
  30. data/test/rubygems/helper.rb +6 -0
  31. data/test/rubygems/test_gem_commands_environment_command.rb +24 -0
  32. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +20 -163
  33. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +2 -1
  34. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/src/lib.rs +0 -3
  35. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +20 -163
  36. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +2 -1
  37. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/src/lib.rs +0 -3
  38. data/test/rubygems/test_gem_indexer.rb +4 -0
  39. data/test/rubygems/test_gem_package.rb +1 -3
  40. data/test/rubygems/test_rubygems.rb +9 -6
  41. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f28d959e6c80a1a48380837de462a5d37b8c74ab83db7ddb52c33e923088a819
4
- data.tar.gz: 8492c0f957c64cc02e779d7f23b2c925f5be4d79451ae52e39105c6a52bbcfd0
3
+ metadata.gz: c2ce5bc643d5af5ce3862f3c350ee8ee7c6af9862c2251d6869e976b47a6cf08
4
+ data.tar.gz: bc867727134a42e8c1104aa9897d3f9bd5d82d1c3e67f5a295f4dd26b9238adc
5
5
  SHA512:
6
- metadata.gz: c61d093abdc997d0c015c3323de9404e35e309454fe7541cce731f5a9ed6a46bc9f59aed0cefffad780a2f889e2decd43350562af66cc6ae07a8bc443bdb0c56
7
- data.tar.gz: 55306fc3437106fb9f97379219449b50c875f22a80309c675202e8fbde767bf2066b3395a0cae88e7b065d90e0eb1b452340b753eefba1f33b410f6ff14e9666
6
+ metadata.gz: 8a88993c43161f8e745133d52fc01f5c57a7cb400f6a5f91c068ae8b6b8c6089d441880f115fa134790beb468149c22eb52abb502677144e52e4bf4185c34ea9
7
+ data.tar.gz: 8a49f841a731c5ee6b30ce2e66c195a0565255fb17b757c2e16b73e190ba7a2d9597ae46e6a943b381176d7077684e9496b2a01cf11eb72f209e00e31c795c6a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 3.3.17 / 2022-06-29
2
+
3
+ ## Enhancements:
4
+
5
+ * Document `gem env` argument aliases and add `gem env user_gemhome` and
6
+ `gem env user_gemdir`. Pull request #5644 by deivid-rodriguez
7
+ * Improve error message when `operating_system.rb` fails to load. Pull
8
+ request #5658 by deivid-rodriguez
9
+ * Clean up temporary directory after `generate_index --update`. Pull
10
+ request #5653 by graywolf-at-work
11
+ * Simplify extension builder. Pull request #5626 by deivid-rodriguez
12
+ * Installs bundler 2.3.17 as a default gem.
13
+
14
+ ## Documentation:
15
+
16
+ * Modify RubyGems issue template to be like the one for Bundler. Pull
17
+ request #5643 by deivid-rodriguez
18
+
1
19
  # 3.3.16 / 2022-06-15
2
20
 
3
21
  ## Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # 2.3.17 (June 29, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add support for platform `:x64_mingw` to correctly lookup "x64-mingw-ucrt" [#5649](https://github.com/rubygems/rubygems/pull/5649)
6
+ - Fix some errors being printed twice in `--verbose` mode [#5654](https://github.com/rubygems/rubygems/pull/5654)
7
+ - Fix extension paths in generated standalone script [#5632](https://github.com/rubygems/rubygems/pull/5632)
8
+
9
+ ## Bug fixes:
10
+
11
+ - Raise if ruby platform is forced and there are no ruby variants [#5495](https://github.com/rubygems/rubygems/pull/5495)
12
+ - Fix `bundle package --no-install` no longer skipping install [#5639](https://github.com/rubygems/rubygems/pull/5639)
13
+
14
+ ## Performance:
15
+
16
+ - Improve performance of `Bundler::SpecSet#for` by using hash lookup of handled deps [#5537](https://github.com/rubygems/rubygems/pull/5537)
17
+
18
+ ## Documentation:
19
+
20
+ - Fix formatting issue in `bundle add` man page [#5642](https://github.com/rubygems/rubygems/pull/5642)
21
+
1
22
  # 2.3.16 (June 15, 2022)
2
23
 
3
24
  ## Performance:
@@ -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 = "2022-06-15".freeze
8
- @git_commit_sha = "324ee6e542".freeze
7
+ @built_at = "2022-06-29".freeze
8
+ @git_commit_sha = "539b20c172".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -14,7 +14,7 @@ module Bundler
14
14
  Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
15
15
 
16
16
  setup_cache_all
17
- install unless Bundler.settings[:no_install]
17
+ install
18
18
 
19
19
  # TODO: move cache contents here now that all bundles are locked
20
20
  custom_path = Bundler.settings[:path] if options[:path]
@@ -161,6 +161,8 @@ module Bundler
161
161
 
162
162
  Bundler.settings.set_command_option_if_given :no_prune, options["no-prune"]
163
163
 
164
+ Bundler.settings.set_command_option_if_given :no_install, options["no-install"]
165
+
164
166
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
165
167
 
166
168
  normalize_groups if options[:without] || options[:with]
@@ -251,7 +251,9 @@ module Bundler
251
251
  remembered_negative_flag_deprecation("no-deployment")
252
252
 
253
253
  require_relative "cli/install"
254
- Install.new(options.dup).run
254
+ Bundler.settings.temporary(:no_install => false) do
255
+ Install.new(options.dup).run
256
+ end
255
257
  end
256
258
 
257
259
  map aliases_for("install")
@@ -297,7 +299,9 @@ module Bundler
297
299
  def update(*gems)
298
300
  SharedHelpers.major_deprecation(2, "The `--force` option has been renamed to `--redownload`") if ARGV.include?("--force")
299
301
  require_relative "cli/update"
300
- Update.new(options, gems).run
302
+ Bundler.settings.temporary(:no_install => false) do
303
+ Update.new(options, gems).run
304
+ end
301
305
  end
302
306
 
303
307
  desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem"
@@ -78,7 +78,7 @@ module Bundler
78
78
  end
79
79
 
80
80
  def x64_mingw?
81
- Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu == "x64"
81
+ Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os.start_with?("mingw") && Bundler.local_platform.cpu == "x64"
82
82
  end
83
83
 
84
84
  (KNOWN_MINOR_VERSIONS + KNOWN_MAJOR_VERSIONS).each do |version|
@@ -122,7 +122,7 @@ module Bundler
122
122
  end
123
123
 
124
124
  def expanded_platforms
125
- @expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.uniq
125
+ @expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.flatten.uniq
126
126
  end
127
127
 
128
128
  def should_include?
@@ -29,8 +29,11 @@ module Bundler
29
29
  Bundler.ui.error error.message
30
30
  Bundler.ui.trace error.orig_exception
31
31
  when BundlerError
32
- Bundler.ui.error error.message, :wrap => true
33
- Bundler.ui.trace error
32
+ if Bundler.ui.debug?
33
+ Bundler.ui.trace error
34
+ else
35
+ Bundler.ui.error error.message, :wrap => true
36
+ end
34
37
  when Thor::Error
35
38
  Bundler.ui.error error.message
36
39
  when LoadError
@@ -10,6 +10,7 @@ module Bundler
10
10
  [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
11
11
  [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
12
12
  [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
13
+ [Gem::Platform.new("x64-mingw-ucrt"), Gem::Platform.new("x64-mingw-ucrt")],
13
14
  [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")],
14
15
  ].freeze
15
16
 
@@ -192,11 +192,7 @@ module Bundler
192
192
  specs += base if base
193
193
  found = specs.select do |spec|
194
194
  next true if spec.source.is_a?(Source::Gemspec)
195
- if base # allow all platforms when searching from a lockfile
196
- dependency.matches_spec?(spec)
197
- else
198
- dependency.matches_spec?(spec) && Gem::Platform.match_spec?(spec)
199
- end
195
+ dependency.matches_spec?(spec)
200
196
  end
201
197
 
202
198
  found
@@ -12,6 +12,7 @@ module Bundler
12
12
  end
13
13
  File.open File.join(bundler_path, "setup.rb"), "w" do |file|
14
14
  file.puts "require 'rbconfig'"
15
+ file.puts define_path_helpers
15
16
  file.puts reverse_rubygems_kernel_mixin
16
17
  paths.each do |path|
17
18
  if Pathname.new(path).absolute?
@@ -29,14 +30,20 @@ module Bundler
29
30
  @specs.map do |spec|
30
31
  next if spec.name == "bundler"
31
32
  Array(spec.require_paths).map do |path|
32
- gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
33
+ gem_path(path, spec).
34
+ sub(version_dir, '#{RUBY_ENGINE}/#{Gem.ruby_api_version}').
35
+ sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}')
33
36
  # This is a static string intentionally. It's interpolated at a later time.
34
37
  end
35
38
  end.flatten.compact
36
39
  end
37
40
 
38
41
  def version_dir
39
- "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
42
+ "#{RUBY_ENGINE}/#{Gem.ruby_api_version}"
43
+ end
44
+
45
+ def extensions_dir
46
+ %r{extensions/(?<platform>[^/]+)/#{Regexp.escape(Gem.extension_api_version)}}
40
47
  end
41
48
 
42
49
  def bundler_path
@@ -55,6 +62,26 @@ module Bundler
55
62
  raise Gem::InvalidSpecificationException.new(error_message)
56
63
  end
57
64
 
65
+ def define_path_helpers
66
+ <<~'END'
67
+ unless defined?(Gem)
68
+ module Gem
69
+ def self.ruby_api_version
70
+ RbConfig::CONFIG["ruby_version"]
71
+ end
72
+
73
+ def self.extension_api_version
74
+ if 'no' == RbConfig::CONFIG['ENABLE_SHARED']
75
+ "#{ruby_api_version}-static"
76
+ else
77
+ ruby_api_version
78
+ end
79
+ end
80
+ end
81
+ end
82
+ END
83
+ end
84
+
58
85
  def reverse_rubygems_kernel_mixin
59
86
  <<~END
60
87
  kernel = (class << ::Kernel; self; end)
@@ -84,7 +84,7 @@ module Bundler
84
84
  else
85
85
  ruby_platform_materializes_to_ruby_platform? ? self : Dependency.new(name, version)
86
86
  end
87
- platform_object = Gem::Platform.new(platform)
87
+ platform_object = ruby_platform_materializes_to_ruby_platform? ? Gem::Platform.new(platform) : Gem::Platform.local
88
88
  candidates = source.specs.search(search_object)
89
89
  same_platform_candidates = candidates.select do |spec|
90
90
  MatchPlatform.platforms_match?(spec.platform, platform_object)
@@ -152,7 +152,7 @@ module Bundler
152
152
  # explicitly add a more specific platform.
153
153
  #
154
154
  def ruby_platform_materializes_to_ruby_platform?
155
- !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY) || Bundler.settings[:force_ruby_platform]
155
+ !Bundler.most_specific_locked_platform?(generic_local_platform) || Bundler.settings[:force_ruby_platform]
156
156
  end
157
157
  end
158
158
  end
@@ -41,7 +41,7 @@ Specify version requirements(s) for the added gem\.
41
41
  Specify the group(s) for the added gem\. Multiple groups should be separated by commas\.
42
42
  .
43
43
  .TP
44
- \fB\-\-source\fR, , \fB\-s\fR
44
+ \fB\-\-source\fR, \fB\-s\fR
45
45
  Specify the source for the added gem\.
46
46
  .
47
47
  .TP
@@ -27,7 +27,7 @@ bundle add rails --group "development, test"
27
27
  * `--group`, `-g`:
28
28
  Specify the group(s) for the added gem. Multiple groups should be separated by commas.
29
29
 
30
- * `--source`, , `-s`:
30
+ * `--source`, `-s`:
31
31
  Specify the source for the added gem.
32
32
 
33
33
  * `--require`, `-r`:
@@ -15,7 +15,6 @@ module Bundler
15
15
  return true if Gem::Platform::RUBY == gemspec_platform
16
16
  return true if local_platform == gemspec_platform
17
17
  gemspec_platform = Gem::Platform.new(gemspec_platform)
18
- return true if GemHelpers.generic(gemspec_platform) === local_platform
19
18
  return true if gemspec_platform === local_platform
20
19
 
21
20
  false
@@ -284,7 +284,7 @@ module Bundler
284
284
  if specs_matching_requirement.any?
285
285
  specs = specs_matching_requirement
286
286
  matching_part = requirement_label
287
- requirement_label = "#{requirement_label} #{requirement.__platform}"
287
+ requirement_label = "#{requirement_label}' with platform '#{requirement.__platform}"
288
288
  end
289
289
 
290
290
  message = String.new("Could not find gem '#{requirement_label}'#{extra_message} in #{source}#{cache_message}.\n")
@@ -216,11 +216,12 @@ module Gem
216
216
  require "rubygems/platform"
217
217
 
218
218
  class Platform
219
- JAVA = Gem::Platform.new("java") unless defined?(JAVA)
220
- MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN)
221
- MSWIN64 = Gem::Platform.new("mswin64") unless defined?(MSWIN64)
222
- MINGW = Gem::Platform.new("x86-mingw32") unless defined?(MINGW)
223
- X64_MINGW = Gem::Platform.new("x64-mingw32") unless defined?(X64_MINGW)
219
+ JAVA = Gem::Platform.new("java")
220
+ MSWIN = Gem::Platform.new("mswin32")
221
+ MSWIN64 = Gem::Platform.new("mswin64")
222
+ MINGW = Gem::Platform.new("x86-mingw32")
223
+ X64_MINGW = [Gem::Platform.new("x64-mingw32"),
224
+ Gem::Platform.new("x64-mingw-ucrt")].freeze
224
225
  end
225
226
 
226
227
  Platform.singleton_class.module_eval do
@@ -160,6 +160,8 @@ module Bundler
160
160
  raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
161
161
  end
162
162
 
163
+ return if Bundler.settings[:no_install]
164
+
163
165
  if requires_sudo?
164
166
  install_path = Bundler.tmp(spec.full_name)
165
167
  bin_path = install_path.join("bin")
@@ -12,17 +12,19 @@ module Bundler
12
12
  end
13
13
 
14
14
  def for(dependencies, check = false, match_current_platform = false)
15
- handled = []
15
+ # dep.name => [list, of, deps]
16
+ handled = Hash.new {|h, k| h[k] = [] }
16
17
  deps = dependencies.dup
17
18
  specs = []
18
19
 
19
20
  loop do
20
21
  break unless dep = deps.shift
21
- next if handled.any? {|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
22
+ next if handled[dep.name].any? {|d| match_current_platform || d.__platform == dep.__platform } || dep.name == "bundler"
22
23
 
23
- handled << dep
24
+ # use a hash here to ensure constant lookup time in the `any?` call above
25
+ handled[dep.name] << dep
24
26
 
25
- specs_for_dep = spec_for_dependency(dep, match_current_platform)
27
+ specs_for_dep = specs_for_dependency(dep, match_current_platform)
26
28
  if specs_for_dep.any?
27
29
  specs.concat(specs_for_dep)
28
30
 
@@ -171,12 +173,13 @@ module Bundler
171
173
  @specs.sort_by(&:name).each {|s| yield s }
172
174
  end
173
175
 
174
- def spec_for_dependency(dep, match_current_platform)
175
- specs_for_platforms = lookup[dep.name]
176
+ def specs_for_dependency(dep, match_current_platform)
177
+ specs_for_name = lookup[dep.name]
176
178
  if match_current_platform
177
- GemHelpers.select_best_platform_match(specs_for_platforms.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
179
+ GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
178
180
  else
179
- GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
181
+ specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, dep.__platform)
182
+ specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
180
183
  end
181
184
  end
182
185
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.16".freeze
4
+ VERSION = "2.3.17".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -8,8 +8,9 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
8
8
 
9
9
  def arguments # :nodoc:
10
10
  args = <<-EOF
11
- gemdir display the path where gems are installed
12
- gempath display path used to search for gems
11
+ home display the path where gems are installed. Aliases: gemhome, gemdir, GEM_HOME
12
+ path display path used to search for gems. Aliases: gempath, GEM_PATH
13
+ user_gemhome display the path where gems are installed when `--user-install` is given. Aliases: user_gemdir
13
14
  version display the gem format version
14
15
  remotesources display the remote gem servers
15
16
  platform display the supported gem platforms
@@ -80,6 +81,8 @@ lib/rubygems/defaults/operating_system.rb
80
81
  Gem.dir
81
82
  when /^gempath/, /^path/, /^GEM_PATH/ then
82
83
  Gem.path.join(File::PATH_SEPARATOR)
84
+ when /^user_gemdir/, /^user_gemhome/ then
85
+ Gem.user_dir
83
86
  when /^remotesources/ then
84
87
  Gem.sources.to_a.join("\n")
85
88
  when /^platform/ then
@@ -17,7 +17,7 @@ class Gem::Ext::Builder
17
17
  $1.downcase
18
18
  end
19
19
 
20
- def self.make(dest_path, results, make_dir = Dir.pwd)
20
+ def self.make(dest_path, results, make_dir = Dir.pwd, sitedir = nil)
21
21
  unless File.exist? File.join(make_dir, 'Makefile')
22
22
  raise Gem::InstallError, 'Makefile not found'
23
23
  end
@@ -33,11 +33,18 @@ class Gem::Ext::Builder
33
33
  # The installation of the bundled gems is failed when DESTDIR is empty in mswin platform.
34
34
  destdir = (/\bnmake/i !~ make_program_name || ENV['DESTDIR'] && ENV['DESTDIR'] != "") ? 'DESTDIR=%s' % ENV['DESTDIR'] : ''
35
35
 
36
+ env = [destdir]
37
+
38
+ if sitedir
39
+ env << 'sitearchdir=%s' % sitedir
40
+ env << 'sitelibdir=%s' % sitedir
41
+ end
42
+
36
43
  ['clean', '', 'install'].each do |target|
37
44
  # Pass DESTDIR via command line to override what's in MAKEFLAGS
38
45
  cmd = [
39
46
  *make_program,
40
- destdir,
47
+ *env,
41
48
  target,
42
49
  ].reject(&:empty?)
43
50
  begin
@@ -268,29 +268,22 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
268
268
  tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
269
269
 
270
270
  # Some versions of `mktmpdir` return absolute paths, which will break make
271
- # if the paths contain spaces. However, on Ruby 1.9.x on Windows, relative
272
- # paths cause all C extension builds to fail.
271
+ # if the paths contain spaces.
273
272
  #
274
- # As such, we convert to a relative path unless we are using Ruby 1.9.x on
275
- # Windows. This means that when using Ruby 1.9.x on Windows, paths with
276
- # spaces do not work.
277
- #
278
- # Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
273
+ # As such, we convert to a relative path.
279
274
  tmp_dest_relative = get_relative_path(tmp_dest.clone, extension_dir)
280
275
 
281
- if tmp_dest_relative
282
- full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
276
+ full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
283
277
 
284
- # TODO: remove in RubyGems 3
285
- if Gem.install_extension_in_lib && lib_dir
286
- FileUtils.mkdir_p lib_dir
287
- FileUtils.cp_r ext_path, lib_dir, remove_destination: true
288
- end
278
+ # TODO: remove in RubyGems 4
279
+ if Gem.install_extension_in_lib && lib_dir
280
+ FileUtils.mkdir_p lib_dir
281
+ FileUtils.cp_r ext_path, lib_dir, remove_destination: true
282
+ end
289
283
 
290
- FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
291
- destent = ent.class.new(dest_path, ent.rel)
292
- destent.exist? || FileUtils.mv(ent.path, destent.path)
293
- end
284
+ FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
285
+ destent = ent.class.new(dest_path, ent.rel)
286
+ destent.exist? || FileUtils.mv(ent.path, destent.path)
294
287
  end
295
288
  ensure
296
289
  FileUtils.rm_rf tmp_dest if tmp_dest
@@ -13,75 +13,50 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
13
13
  tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
14
14
 
15
15
  # Some versions of `mktmpdir` return absolute paths, which will break make
16
- # if the paths contain spaces. However, on Ruby 1.9.x on Windows, relative
17
- # paths cause all C extension builds to fail.
16
+ # if the paths contain spaces.
18
17
  #
19
- # As such, we convert to a relative path unless we are using Ruby 1.9.x on
20
- # Windows. This means that when using Ruby 1.9.x on Windows, paths with
21
- # spaces do not work.
22
- #
23
- # Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
18
+ # As such, we convert to a relative path.
24
19
  tmp_dest_relative = get_relative_path(tmp_dest.clone, extension_dir)
25
20
 
26
- Tempfile.open %w[siteconf .rb], extension_dir do |siteconf|
27
- siteconf.puts "require 'rbconfig'"
28
- siteconf.puts "dest_path = #{tmp_dest_relative.dump}"
29
- %w[sitearchdir sitelibdir].each do |dir|
30
- siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
31
- siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
32
- end
33
-
34
- siteconf.close
21
+ destdir = ENV["DESTDIR"]
35
22
 
36
- destdir = ENV["DESTDIR"]
23
+ begin
24
+ require "shellwords"
25
+ cmd = Gem.ruby.shellsplit << "-I" << File.expand_path('../..', __dir__) << File.basename(extension)
26
+ cmd.push(*args)
37
27
 
38
- begin
39
- # workaround for https://github.com/oracle/truffleruby/issues/2115
40
- siteconf_path = RUBY_ENGINE == "truffleruby" ? siteconf.path.dup : siteconf.path
41
- require "shellwords"
42
- cmd = Gem.ruby.shellsplit << "-I" << File.expand_path('../..', __dir__) <<
43
- "-r" << get_relative_path(siteconf_path, extension_dir) << File.basename(extension)
44
- cmd.push(*args)
45
-
46
- begin
47
- run(cmd, results, class_name, extension_dir) do |s, r|
48
- mkmf_log = File.join(extension_dir, 'mkmf.log')
49
- if File.exist? mkmf_log
50
- unless s.success?
51
- r << "To see why this extension failed to compile, please check" \
52
- " the mkmf.log which can be found here:\n"
53
- r << " " + File.join(dest_path, 'mkmf.log') + "\n"
54
- end
55
- FileUtils.mv mkmf_log, dest_path
56
- end
28
+ run(cmd, results, class_name, extension_dir) do |s, r|
29
+ mkmf_log = File.join(extension_dir, 'mkmf.log')
30
+ if File.exist? mkmf_log
31
+ unless s.success?
32
+ r << "To see why this extension failed to compile, please check" \
33
+ " the mkmf.log which can be found here:\n"
34
+ r << " " + File.join(dest_path, 'mkmf.log') + "\n"
57
35
  end
58
- siteconf.unlink
36
+ FileUtils.mv mkmf_log, dest_path
59
37
  end
38
+ end
60
39
 
61
- ENV["DESTDIR"] = nil
40
+ ENV["DESTDIR"] = nil
62
41
 
63
- make dest_path, results, extension_dir
42
+ make dest_path, results, extension_dir, tmp_dest_relative
64
43
 
65
- if tmp_dest_relative
66
- full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
44
+ full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
67
45
 
68
- # TODO remove in RubyGems 3
69
- if Gem.install_extension_in_lib and lib_dir
70
- FileUtils.mkdir_p lib_dir
71
- entries = Dir.entries(full_tmp_dest) - %w[. ..]
72
- entries = entries.map {|entry| File.join full_tmp_dest, entry }
73
- FileUtils.cp_r entries, lib_dir, :remove_destination => true
74
- end
46
+ # TODO remove in RubyGems 4
47
+ if Gem.install_extension_in_lib and lib_dir
48
+ FileUtils.mkdir_p lib_dir
49
+ entries = Dir.entries(full_tmp_dest) - %w[. ..]
50
+ entries = entries.map {|entry| File.join full_tmp_dest, entry }
51
+ FileUtils.cp_r entries, lib_dir, :remove_destination => true
52
+ end
75
53
 
76
- FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
77
- destent = ent.class.new(dest_path, ent.rel)
78
- destent.exist? or FileUtils.mv(ent.path, destent.path)
79
- end
80
- end
81
- ensure
82
- ENV["DESTDIR"] = destdir
83
- siteconf.close!
54
+ FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
55
+ destent = ent.class.new(dest_path, ent.rel)
56
+ destent.exist? or FileUtils.mv(ent.path, destent.path)
84
57
  end
58
+ ensure
59
+ ENV["DESTDIR"] = destdir
85
60
  end
86
61
 
87
62
  results
@@ -401,6 +401,8 @@ class Gem::Indexer
401
401
 
402
402
  File.utime newest_mtime, newest_mtime, dst_name
403
403
  end
404
+ ensure
405
+ FileUtils.rm_rf @directory
404
406
  end
405
407
 
406
408
  ##
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.3.16".freeze
11
+ VERSION = "3.3.17".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -1323,8 +1323,9 @@ begin
1323
1323
  rescue LoadError
1324
1324
  # Ignored
1325
1325
  rescue StandardError => e
1326
+ path = e.backtrace_locations.reverse.find {|l| l.path.end_with?("rubygems/defaults/operating_system.rb") }.path
1326
1327
  msg = "#{e.message}\n" \
1327
- "Loading the rubygems/defaults/operating_system.rb file caused an error. " \
1328
+ "Loading the #{path} file caused an error. " \
1328
1329
  "This file is owned by your OS, not by rubygems upstream. " \
1329
1330
  "Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
1330
1331
  "the problem and ask for help."
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.3.16"
5
+ s.version = "3.3.17"
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
 
@@ -119,6 +119,12 @@ class Gem::TestCase < Test::Unit::TestCase
119
119
  assert File.directory?(path), msg
120
120
  end
121
121
 
122
+ def refute_directory_exists(path, msg = nil)
123
+ msg = build_message(msg, "Expected path '#{path}' not to be a directory")
124
+ assert_path_not_exist path
125
+ refute File.directory?(path), msg
126
+ end
127
+
122
128
  # https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L188
123
129
  def _synchronize
124
130
  yield