rubygems-update 3.3.15 → 3.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Manifest.txt +5 -2
- data/bundler/CHANGELOG.md +6 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/cache.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +0 -2
- data/bundler/lib/bundler/cli.rb +2 -6
- data/bundler/lib/bundler/definition.rb +16 -20
- data/bundler/lib/bundler/dependency.rb +2 -0
- data/bundler/lib/bundler/dsl.rb +1 -3
- data/bundler/lib/bundler/errors.rb +2 -0
- data/bundler/lib/bundler/fetcher/base.rb +6 -8
- data/bundler/lib/bundler/fetcher.rb +4 -0
- data/bundler/lib/bundler/plugin/api/source.rb +3 -3
- data/bundler/lib/bundler/resolver.rb +10 -12
- data/bundler/lib/bundler/rubygems_gem_installer.rb +8 -0
- data/bundler/lib/bundler/rubygems_integration.rb +3 -21
- data/bundler/lib/bundler/source/git.rb +5 -7
- data/bundler/lib/bundler/source/rubygems.rb +77 -76
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +1 -1
- data/lib/rubygems/commands/sources_command.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +1 -1
- data/lib/rubygems/errors.rb +1 -1
- data/lib/rubygems/ext/builder.rb +3 -3
- data/lib/rubygems/ext/cargo_builder/link_flag_converter.rb +23 -0
- data/lib/rubygems/ext/cargo_builder.rb +87 -64
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/source/git.rb +2 -2
- data/lib/rubygems/source.rb +2 -9
- data/lib/rubygems/source_list.rb +1 -5
- data/lib/rubygems/specification.rb +28 -4
- data/lib/rubygems/specification_policy.rb +1 -1
- data/lib/rubygems/uri.rb +41 -26
- data/lib/rubygems/util.rb +1 -1
- data/lib/rubygems.rb +1 -2
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/data/excon-0.7.7.gemspec.rz +0 -0
- data/test/rubygems/data/{null-type.gemspec.rz → pry-0.4.7.gemspec.rz} +0 -0
- data/test/rubygems/helper.rb +2 -2
- data/test/rubygems/test_gem.rb +1 -1
- data/test/rubygems/test_gem_commands_sources_command.rb +50 -0
- data/test/rubygems/test_gem_config_file.rb +3 -3
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +86 -74
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -2
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +86 -74
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -2
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +2 -2
- data/test/rubygems/test_gem_ext_cargo_builder.rb +50 -19
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +33 -0
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +75 -0
- data/test/rubygems/test_gem_gemcutter_utilities.rb +1 -1
- data/test/rubygems/test_gem_package.rb +1 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -15
- data/test/rubygems/test_gem_resolver.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +14 -6
- data/test/rubygems/test_require.rb +10 -10
- data/test/rubygems/test_rubygems.rb +3 -3
- metadata +8 -5
- data/lib/rubygems/psych_additions.rb +0 -10
@@ -62,7 +62,7 @@ class Gem::Commands::SourcesCommand < Gem::Command
|
|
62
62
|
say "#{source_uri} is not a URI"
|
63
63
|
terminate_interaction 1
|
64
64
|
rescue Gem::RemoteFetcher::FetchError => e
|
65
|
-
say "Error fetching #{
|
65
|
+
say "Error fetching #{Gem::Uri.redact(source.uri)}:\n\t#{e.message}"
|
66
66
|
terminate_interaction 1
|
67
67
|
end
|
68
68
|
end
|
@@ -18,7 +18,7 @@ module Kernel
|
|
18
18
|
end
|
19
19
|
|
20
20
|
file = Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES ? "<internal:#{__FILE__}>" : __FILE__
|
21
|
-
module_eval <<'RUBY', file, __LINE__ + 1
|
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.
|
data/lib/rubygems/errors.rb
CHANGED
@@ -168,7 +168,7 @@ module Gem
|
|
168
168
|
# An English description of the error.
|
169
169
|
|
170
170
|
def wordy
|
171
|
-
"Unable to download data from #{Gem::Uri.
|
171
|
+
"Unable to download data from #{Gem::Uri.redact(@source.uri)} - #{@error.message}"
|
172
172
|
end
|
173
173
|
|
174
174
|
##
|
data/lib/rubygems/ext/builder.rb
CHANGED
@@ -48,7 +48,7 @@ class Gem::Ext::Builder
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.run(command, results, command_name = nil, dir = Dir.pwd)
|
51
|
+
def self.run(command, results, command_name = nil, dir = Dir.pwd, env = {})
|
52
52
|
verbose = Gem.configuration.really_verbose
|
53
53
|
|
54
54
|
begin
|
@@ -63,9 +63,9 @@ class Gem::Ext::Builder
|
|
63
63
|
|
64
64
|
require "open3"
|
65
65
|
# Set $SOURCE_DATE_EPOCH for the subprocess.
|
66
|
-
|
66
|
+
build_env = { 'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string }.merge(env)
|
67
67
|
output, status = begin
|
68
|
-
Open3.capture2e(
|
68
|
+
Open3.capture2e(build_env, *command, :chdir => dir)
|
69
69
|
rescue => error
|
70
70
|
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
|
71
71
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
4
|
+
# Converts Ruby link flags into something cargo understands
|
5
|
+
class LinkFlagConverter
|
6
|
+
def self.convert(arg)
|
7
|
+
case arg.chomp
|
8
|
+
when /^-L\s*(.+)$/
|
9
|
+
["-L", "native=#{$1}"]
|
10
|
+
when /^--library=(\w+\S+)$/, /^-l\s*(\w+\S+)$/
|
11
|
+
["-l", $1]
|
12
|
+
when /^-l\s*:lib(\S+).a$/
|
13
|
+
["-l", "static=#{$1}"]
|
14
|
+
when /^-l\s*:lib(\S+).(so|dylib|dll)$/
|
15
|
+
["-l", "dylib=#{$1}"]
|
16
|
+
when /^-F\s*(.*)$/
|
17
|
+
["-l", "framework=#{$1}"]
|
18
|
+
else
|
19
|
+
["-C", "link_arg=#{arg}"]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -4,48 +4,67 @@
|
|
4
4
|
# over the `cargo rustc` command which takes care of building Rust code in a way
|
5
5
|
# that Ruby can use.
|
6
6
|
class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
7
|
-
|
7
|
+
attr_accessor :spec, :runner, :profile
|
8
8
|
|
9
9
|
def initialize(spec)
|
10
|
+
require_relative "../command"
|
11
|
+
require_relative "cargo_builder/link_flag_converter"
|
12
|
+
|
10
13
|
@spec = spec
|
14
|
+
@runner = self.class.method(:run)
|
15
|
+
@profile = :release
|
11
16
|
end
|
12
17
|
|
13
18
|
def build(_extension, dest_path, results, args = [], lib_dir = nil, cargo_dir = Dir.pwd)
|
14
|
-
require "rubygems/command"
|
15
19
|
require "fileutils"
|
16
20
|
require "shellwords"
|
17
21
|
|
18
22
|
build_crate(dest_path, results, args, cargo_dir)
|
19
|
-
|
20
|
-
|
23
|
+
validate_cargo_build!(dest_path)
|
24
|
+
rename_cdylib_for_ruby_compatibility(dest_path)
|
25
|
+
finalize_directory(dest_path, lib_dir, cargo_dir)
|
21
26
|
results
|
22
27
|
end
|
23
28
|
|
24
|
-
private
|
25
|
-
|
26
29
|
def build_crate(dest_path, results, args, cargo_dir)
|
27
|
-
|
30
|
+
env = build_env
|
31
|
+
cmd = cargo_command(cargo_dir, dest_path, args)
|
32
|
+
runner.call cmd, results, 'cargo', cargo_dir, env
|
28
33
|
|
29
|
-
|
34
|
+
results
|
35
|
+
end
|
30
36
|
|
31
|
-
|
37
|
+
def build_env
|
38
|
+
build_env = rb_config_env
|
39
|
+
build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?('RUBY_STATIC')
|
40
|
+
build_env
|
41
|
+
end
|
32
42
|
|
43
|
+
def cargo_command(cargo_dir, dest_path, args = [])
|
44
|
+
manifest = File.join(cargo_dir, "Cargo.toml")
|
33
45
|
cargo = ENV.fetch("CARGO", "cargo")
|
34
46
|
|
35
47
|
cmd = []
|
36
48
|
cmd += [cargo, "rustc"]
|
49
|
+
cmd += ["--target", ENV['CARGO_BUILD_TARGET']] if ENV['CARGO_BUILD_TARGET']
|
37
50
|
cmd += ["--target-dir", dest_path]
|
38
51
|
cmd += ["--manifest-path", manifest]
|
39
|
-
cmd += ["--lib"
|
40
|
-
cmd += ["--"]
|
41
|
-
cmd += [
|
52
|
+
cmd += ["--lib"]
|
53
|
+
cmd += ["--profile", profile.to_s]
|
54
|
+
cmd += ["--locked"] if profile == :release
|
42
55
|
cmd += Gem::Command.build_args
|
43
56
|
cmd += args
|
57
|
+
cmd += ["--"]
|
58
|
+
cmd += [*cargo_rustc_args(dest_path)]
|
59
|
+
cmd
|
60
|
+
end
|
44
61
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
62
|
+
private
|
63
|
+
|
64
|
+
def rb_config_env
|
65
|
+
result = {}
|
66
|
+
RbConfig::CONFIG.each {|k, v| result["RBCONFIG_#{k}"] = v }
|
67
|
+
result
|
49
68
|
end
|
50
69
|
|
51
70
|
def cargo_rustc_args(dest_dir)
|
@@ -92,7 +111,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
92
111
|
def libruby_args(dest_dir)
|
93
112
|
libs = makefile_config(ruby_static? ? "LIBRUBYARG_STATIC" : "LIBRUBYARG_SHARED")
|
94
113
|
raw_libs = Shellwords.split(libs)
|
95
|
-
raw_libs.flat_map {|l| ldflag_to_link_modifier(l
|
114
|
+
raw_libs.flat_map {|l| ldflag_to_link_modifier(l) }
|
96
115
|
end
|
97
116
|
|
98
117
|
def ruby_static?
|
@@ -103,22 +122,33 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
103
122
|
|
104
123
|
# Ruby expects the dylib to follow a file name convention for loading
|
105
124
|
def rename_cdylib_for_ruby_compatibility(dest_path)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
FileUtils.cp(dylib_path, new_name)
|
110
|
-
new_name
|
125
|
+
new_path = final_extension_path(dest_path)
|
126
|
+
FileUtils.cp(cargo_dylib_path(dest_path), new_path)
|
127
|
+
new_path
|
111
128
|
end
|
112
129
|
|
113
130
|
def validate_cargo_build!(dir)
|
114
|
-
|
115
|
-
dylib_path = File.join(dir, "release", "#{prefix}#{cargo_crate_name}.#{so_ext}")
|
131
|
+
dylib_path = cargo_dylib_path(dir)
|
116
132
|
|
117
133
|
raise DylibNotFoundError, dir unless File.exist?(dylib_path)
|
118
134
|
|
119
135
|
dylib_path
|
120
136
|
end
|
121
137
|
|
138
|
+
def final_extension_path(dest_path)
|
139
|
+
dylib_path = cargo_dylib_path(dest_path)
|
140
|
+
dlext_name = "#{spec.name}.#{makefile_config("DLEXT")}"
|
141
|
+
dylib_path.gsub(File.basename(dylib_path), dlext_name)
|
142
|
+
end
|
143
|
+
|
144
|
+
def cargo_dylib_path(dest_path)
|
145
|
+
prefix = so_ext == "dll" ? "" : "lib"
|
146
|
+
path_parts = [dest_path]
|
147
|
+
path_parts << ENV['CARGO_BUILD_TARGET'] if ENV['CARGO_BUILD_TARGET']
|
148
|
+
path_parts += [profile_target_directory, "#{prefix}#{cargo_crate_name}.#{so_ext}"]
|
149
|
+
File.join(*path_parts)
|
150
|
+
end
|
151
|
+
|
122
152
|
def cargo_crate_name
|
123
153
|
spec.metadata.fetch('cargo_crate_name', spec.name).tr('-', '_')
|
124
154
|
end
|
@@ -127,42 +157,19 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
127
157
|
split_flags("DLDFLAGS")
|
128
158
|
.map {|arg| maybe_resolve_ldflag_variable(arg, dest_dir) }
|
129
159
|
.compact
|
130
|
-
.flat_map {|arg| ldflag_to_link_modifier(arg
|
160
|
+
.flat_map {|arg| ldflag_to_link_modifier(arg) }
|
131
161
|
end
|
132
162
|
|
133
163
|
def rustc_lib_flags(dest_dir)
|
134
|
-
split_flags("LIBS").flat_map {|arg| ldflag_to_link_modifier(arg
|
164
|
+
split_flags("LIBS").flat_map {|arg| ldflag_to_link_modifier(arg) }
|
135
165
|
end
|
136
166
|
|
137
167
|
def split_flags(var)
|
138
168
|
Shellwords.split(RbConfig::CONFIG.fetch(var, ""))
|
139
169
|
end
|
140
170
|
|
141
|
-
def ldflag_to_link_modifier(arg
|
142
|
-
|
143
|
-
val = arg[2..-1]
|
144
|
-
|
145
|
-
case flag
|
146
|
-
when "-L" then ["-L", "native=#{val}"]
|
147
|
-
when "-l" then ["-l", val.to_s]
|
148
|
-
when "-F" then ["-l", "framework=#{val}"]
|
149
|
-
else ["-C", "link_arg=#{arg}"]
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def link_flag(link_name)
|
154
|
-
# These are provided by the CRT with MSVC
|
155
|
-
# @see https://github.com/rust-lang/pkg-config-rs/blob/49a4ac189aafa365167c72e8e503565a7c2697c2/src/lib.rs#L622
|
156
|
-
return [] if msvc_target? && ["m", "c", "pthread"].include?(link_name)
|
157
|
-
|
158
|
-
if link_name.include?("ruby")
|
159
|
-
# Specify the lib kind and give it the name "ruby" for linking
|
160
|
-
kind = ruby_static? ? "static" : "dylib"
|
161
|
-
|
162
|
-
["-l", "#{kind}=ruby:#{link_name}"]
|
163
|
-
else
|
164
|
-
["-l", link_name]
|
165
|
-
end
|
171
|
+
def ldflag_to_link_modifier(arg)
|
172
|
+
LinkFlagConverter.convert(arg)
|
166
173
|
end
|
167
174
|
|
168
175
|
def msvc_target?
|
@@ -182,20 +189,24 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
182
189
|
!!Gem::WIN_PATTERNS.find {|r| target_platform =~ r }
|
183
190
|
end
|
184
191
|
|
185
|
-
#
|
192
|
+
# Interpolate substition vars in the arg (i.e. $(DEFFILE))
|
186
193
|
def maybe_resolve_ldflag_variable(input_arg, dest_dir)
|
187
|
-
|
188
|
-
case var_name
|
189
|
-
# On windows, it is assumed that mkmf has setup an exports file for the
|
190
|
-
# extension, so we have to to create one ourselves.
|
191
|
-
when "DEFFILE"
|
192
|
-
write_deffile(dest_dir)
|
193
|
-
else
|
194
|
-
RbConfig::CONFIG[var_name]
|
195
|
-
end
|
196
|
-
end.strip
|
194
|
+
var_matches = input_arg.match(/\$\((\w+)\)/)
|
197
195
|
|
198
|
-
|
196
|
+
return input_arg unless var_matches
|
197
|
+
|
198
|
+
var_name = var_matches[1]
|
199
|
+
|
200
|
+
return input_arg if var_name.nil? || var_name.chomp.empty?
|
201
|
+
|
202
|
+
case var_name
|
203
|
+
# On windows, it is assumed that mkmf has setup an exports file for the
|
204
|
+
# extension, so we have to to create one ourselves.
|
205
|
+
when "DEFFILE"
|
206
|
+
write_deffile(dest_dir)
|
207
|
+
else
|
208
|
+
RbConfig::CONFIG[var_name]
|
209
|
+
end
|
199
210
|
end
|
200
211
|
|
201
212
|
def write_deffile(dest_dir)
|
@@ -241,14 +252,18 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
241
252
|
|
242
253
|
# Good balance between binary size and debugability
|
243
254
|
def debug_flags
|
255
|
+
return [] if profile == :dev
|
256
|
+
|
244
257
|
["-C", "debuginfo=1"]
|
245
258
|
end
|
246
259
|
|
247
260
|
# Copied from ExtConfBuilder
|
248
|
-
def finalize_directory(
|
261
|
+
def finalize_directory(dest_path, lib_dir, extension_dir)
|
249
262
|
require "fileutils"
|
250
263
|
require "tempfile"
|
251
264
|
|
265
|
+
ext_path = final_extension_path(dest_path)
|
266
|
+
|
252
267
|
begin
|
253
268
|
tmp_dest = Dir.mktmpdir(".gem.", extension_dir)
|
254
269
|
|
@@ -287,6 +302,14 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder
|
|
287
302
|
path
|
288
303
|
end
|
289
304
|
|
305
|
+
def profile_target_directory
|
306
|
+
case profile
|
307
|
+
when :release then 'release'
|
308
|
+
when :dev then 'debug'
|
309
|
+
else raise "unknown target directory for profile: #{profile}"
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
290
313
|
# Error raised when no cdylib artifact was created
|
291
314
|
class DylibNotFoundError < StandardError
|
292
315
|
def initialize(dir)
|
@@ -135,7 +135,7 @@ module Gem::GemcutterUtilities
|
|
135
135
|
sign_in_host, scope: scope) do |request|
|
136
136
|
request.basic_auth email, password
|
137
137
|
request["OTP"] = otp if otp
|
138
|
-
request.body = URI.encode_www_form({:api_key => api_key }.merge(update_scope_params))
|
138
|
+
request.body = URI.encode_www_form({ :api_key => api_key }.merge(update_scope_params))
|
139
139
|
end
|
140
140
|
|
141
141
|
with_response response do |resp|
|
data/lib/rubygems/request.rb
CHANGED
@@ -193,7 +193,7 @@ class Gem::Request
|
|
193
193
|
begin
|
194
194
|
@requests[connection.object_id] += 1
|
195
195
|
|
196
|
-
verbose "#{request.method} #{Gem::Uri.
|
196
|
+
verbose "#{request.method} #{Gem::Uri.redact(@uri)}"
|
197
197
|
|
198
198
|
file_name = File.basename(@uri.path)
|
199
199
|
# perform download progress reporter only for gems
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -49,8 +49,8 @@ class Gem::Source::Git < Gem::Source
|
|
49
49
|
# will be checked out when the gem is installed.
|
50
50
|
|
51
51
|
def initialize(name, repository, reference, submodules = false)
|
52
|
-
|
53
|
-
|
52
|
+
require_relative "../uri"
|
53
|
+
@uri = Gem::Uri.parse(repository)
|
54
54
|
@name = name
|
55
55
|
@repository = repository
|
56
56
|
@reference = reference
|
data/lib/rubygems/source.rb
CHANGED
@@ -26,15 +26,8 @@ class Gem::Source
|
|
26
26
|
# Creates a new Source which will use the index located at +uri+.
|
27
27
|
|
28
28
|
def initialize(uri)
|
29
|
-
|
30
|
-
|
31
|
-
uri = URI.parse(uri.to_s)
|
32
|
-
end
|
33
|
-
rescue URI::InvalidURIError
|
34
|
-
raise if Gem::Source == self.class
|
35
|
-
end
|
36
|
-
|
37
|
-
@uri = uri
|
29
|
+
require_relative "uri"
|
30
|
+
@uri = Gem::Uri.parse!(uri)
|
38
31
|
@update_cache = nil
|
39
32
|
end
|
40
33
|
|
data/lib/rubygems/source_list.rb
CHANGED
@@ -48,15 +48,11 @@ class Gem::SourceList
|
|
48
48
|
# String.
|
49
49
|
|
50
50
|
def <<(obj)
|
51
|
-
require "uri"
|
52
|
-
|
53
51
|
src = case obj
|
54
|
-
when URI
|
55
|
-
Gem::Source.new(obj)
|
56
52
|
when Gem::Source
|
57
53
|
obj
|
58
54
|
else
|
59
|
-
Gem::Source.new(
|
55
|
+
Gem::Source.new(obj)
|
60
56
|
end
|
61
57
|
|
62
58
|
@sources << src unless @sources.include?(src)
|
@@ -157,7 +157,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
157
157
|
}.freeze
|
158
158
|
|
159
159
|
# rubocop:disable Style/MutableConstant
|
160
|
-
INITIALIZE_CODE_FOR_DEFAULTS = {
|
160
|
+
INITIALIZE_CODE_FOR_DEFAULTS = {} # :nodoc:
|
161
161
|
# rubocop:enable Style/MutableConstant
|
162
162
|
|
163
163
|
@@default_value.each do |k,v|
|
@@ -1082,6 +1082,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1082
1082
|
|
1083
1083
|
spec.specification_version ||= NONEXISTENT_SPECIFICATION_VERSION
|
1084
1084
|
spec.reset_nil_attributes_to_default
|
1085
|
+
spec.flatten_require_paths
|
1085
1086
|
|
1086
1087
|
spec
|
1087
1088
|
end
|
@@ -1273,10 +1274,26 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1273
1274
|
array = begin
|
1274
1275
|
Marshal.load str
|
1275
1276
|
rescue ArgumentError => e
|
1276
|
-
|
1277
|
+
#
|
1278
|
+
# Some very old marshaled specs included references to `YAML::PrivateType`
|
1279
|
+
# and `YAML::Syck::DefaultKey` constants due to bugs in the old emitter
|
1280
|
+
# that generated them. Workaround the issue by defining the necessary
|
1281
|
+
# constants and retrying.
|
1282
|
+
#
|
1283
|
+
message = e.message
|
1284
|
+
raise unless message.include?("YAML::")
|
1285
|
+
|
1286
|
+
Object.const_set "YAML", Psych unless Object.const_defined?(:YAML)
|
1287
|
+
|
1288
|
+
if message.include?("YAML::Syck::")
|
1289
|
+
YAML.const_set "Syck", YAML unless YAML.const_defined?(:Syck)
|
1290
|
+
|
1291
|
+
YAML::Syck.const_set "DefaultKey", Class.new if message.include?("YAML::Syck::DefaultKey")
|
1292
|
+
elsif message.include?("YAML::PrivateType")
|
1293
|
+
YAML.const_set "PrivateType", Class.new
|
1294
|
+
end
|
1277
1295
|
|
1278
|
-
|
1279
|
-
Marshal.load str
|
1296
|
+
retry
|
1280
1297
|
end
|
1281
1298
|
|
1282
1299
|
spec = Gem::Specification.new
|
@@ -2676,6 +2693,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2676
2693
|
@installed_by_version ||= nil
|
2677
2694
|
end
|
2678
2695
|
|
2696
|
+
def flatten_require_paths # :nodoc:
|
2697
|
+
return unless raw_require_paths.first.is_a?(Array)
|
2698
|
+
|
2699
|
+
warn "#{name} #{version} includes a gemspec with `require_paths` set to an array of arrays. Newer versions of this gem might've already fixed this"
|
2700
|
+
raw_require_paths.flatten!
|
2701
|
+
end
|
2702
|
+
|
2679
2703
|
def raw_require_paths # :nodoc:
|
2680
2704
|
@require_paths
|
2681
2705
|
end
|
@@ -154,7 +154,7 @@ class Gem::SpecificationPolicy
|
|
154
154
|
|
155
155
|
def validate_duplicate_dependencies # :nodoc:
|
156
156
|
# NOTE: see REFACTOR note in Gem::Dependency about types - this might be brittle
|
157
|
-
seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {}}) }
|
157
|
+
seen = Gem::Dependency::TYPES.inject({}) {|types, type| types.merge({ type => {} }) }
|
158
158
|
|
159
159
|
error_messages = []
|
160
160
|
@specification.dependencies.each do |dep|
|
data/lib/rubygems/uri.rb
CHANGED
@@ -5,6 +5,44 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
class Gem::Uri
|
8
|
+
##
|
9
|
+
# Parses and redacts uri
|
10
|
+
|
11
|
+
def self.redact(uri)
|
12
|
+
new(uri).redacted
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# Parses uri, raising if it's invalid
|
17
|
+
|
18
|
+
def self.parse!(uri)
|
19
|
+
require "uri"
|
20
|
+
|
21
|
+
raise URI::InvalidURIError unless uri
|
22
|
+
|
23
|
+
return uri unless uri.is_a?(String)
|
24
|
+
|
25
|
+
# Always escape URI's to deal with potential spaces and such
|
26
|
+
# It should also be considered that source_uri may already be
|
27
|
+
# a valid URI with escaped characters. e.g. "{DESede}" is encoded
|
28
|
+
# as "%7BDESede%7D". If this is escaped again the percentage
|
29
|
+
# symbols will be escaped.
|
30
|
+
begin
|
31
|
+
URI.parse(uri)
|
32
|
+
rescue URI::InvalidURIError
|
33
|
+
URI.parse(URI::DEFAULT_PARSER.escape(uri))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Parses uri, returning the original uri if it's invalid
|
39
|
+
|
40
|
+
def self.parse(uri)
|
41
|
+
parse!(uri)
|
42
|
+
rescue URI::InvalidURIError
|
43
|
+
uri
|
44
|
+
end
|
45
|
+
|
8
46
|
def initialize(source_uri)
|
9
47
|
@parsed_uri = parse(source_uri)
|
10
48
|
end
|
@@ -26,7 +64,7 @@ class Gem::Uri
|
|
26
64
|
end
|
27
65
|
|
28
66
|
def redact_credentials_from(text)
|
29
|
-
return text unless valid_uri? && password?
|
67
|
+
return text unless valid_uri? && password? && text.include?(to_s)
|
30
68
|
|
31
69
|
text.sub(password, 'REDACTED')
|
32
70
|
end
|
@@ -50,35 +88,12 @@ class Gem::Uri
|
|
50
88
|
|
51
89
|
private
|
52
90
|
|
53
|
-
##
|
54
|
-
# Parses the #uri, raising if it's invalid
|
55
|
-
|
56
91
|
def parse!(uri)
|
57
|
-
|
58
|
-
|
59
|
-
raise URI::InvalidURIError unless uri
|
60
|
-
|
61
|
-
# Always escape URI's to deal with potential spaces and such
|
62
|
-
# It should also be considered that source_uri may already be
|
63
|
-
# a valid URI with escaped characters. e.g. "{DESede}" is encoded
|
64
|
-
# as "%7BDESede%7D". If this is escaped again the percentage
|
65
|
-
# symbols will be escaped.
|
66
|
-
begin
|
67
|
-
URI.parse(uri)
|
68
|
-
rescue URI::InvalidURIError
|
69
|
-
URI.parse(URI::DEFAULT_PARSER.escape(uri))
|
70
|
-
end
|
92
|
+
self.class.parse!(uri)
|
71
93
|
end
|
72
94
|
|
73
|
-
##
|
74
|
-
# Parses the #uri, returning the original uri if it's invalid
|
75
|
-
|
76
95
|
def parse(uri)
|
77
|
-
|
78
|
-
|
79
|
-
parse!(uri)
|
80
|
-
rescue URI::InvalidURIError
|
81
|
-
uri
|
96
|
+
self.class.parse(uri)
|
82
97
|
end
|
83
98
|
|
84
99
|
def with_redacted_user
|
data/lib/rubygems/util.rb
CHANGED
@@ -60,7 +60,7 @@ module Gem::Util
|
|
60
60
|
# Invokes system, but silences all output.
|
61
61
|
|
62
62
|
def self.silent_system(*command)
|
63
|
-
opt = {:out => IO::NULL, :err => [:child, :out]}
|
63
|
+
opt = { :out => IO::NULL, :err => [:child, :out] }
|
64
64
|
if Hash === command.last
|
65
65
|
opt.update(command.last)
|
66
66
|
cmds = command[0...-1]
|
data/lib/rubygems.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
require 'rbconfig'
|
9
9
|
|
10
10
|
module Gem
|
11
|
-
VERSION = "3.3.
|
11
|
+
VERSION = "3.3.16".freeze
|
12
12
|
end
|
13
13
|
|
14
14
|
# Must be first since it unloads the prelude from 1.9.2
|
@@ -607,7 +607,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
|
|
607
607
|
return if @yaml_loaded
|
608
608
|
|
609
609
|
require 'psych'
|
610
|
-
require_relative 'rubygems/psych_additions'
|
611
610
|
require_relative 'rubygems/psych_tree'
|
612
611
|
|
613
612
|
require_relative 'rubygems/safe_yaml'
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.3.
|
5
|
+
s.version = "3.3.16"
|
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
|
|
Binary file
|
File without changes
|
data/test/rubygems/helper.rb
CHANGED
@@ -618,7 +618,7 @@ class Gem::TestCase < Test::Unit::TestCase
|
|
618
618
|
gem = File.join(@tempdir, File.basename(gem)).tap(&Gem::UNTAINT)
|
619
619
|
end
|
620
620
|
|
621
|
-
Gem::Installer.at(gem, options.merge({:wrappers => true})).install
|
621
|
+
Gem::Installer.at(gem, options.merge({ :wrappers => true })).install
|
622
622
|
end
|
623
623
|
|
624
624
|
##
|
@@ -1191,7 +1191,7 @@ Also, a list:
|
|
1191
1191
|
# Is this test being run on a ruby/ruby repository?
|
1192
1192
|
#
|
1193
1193
|
|
1194
|
-
def
|
1194
|
+
def ruby_repo?
|
1195
1195
|
!ENV["GEM_COMMAND"].nil?
|
1196
1196
|
end
|
1197
1197
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -1430,7 +1430,7 @@ class TestGem < Gem::TestCase
|
|
1430
1430
|
a = util_spec "a", "1"
|
1431
1431
|
b = util_spec "b", "1", "c" => nil
|
1432
1432
|
c = util_spec "c", "2"
|
1433
|
-
d = util_spec "d", "1", {'e' => '= 1'}, "lib/d#{$$}.rb"
|
1433
|
+
d = util_spec "d", "1", { 'e' => '= 1' }, "lib/d#{$$}.rb"
|
1434
1434
|
e = util_spec "e", "1"
|
1435
1435
|
|
1436
1436
|
install_specs a, c, b, e, d
|