rubygems-update 3.3.19 → 3.3.20
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 +4 -4
- data/CHANGELOG.md +20 -0
- data/bin/update_rubygems +1 -1
- data/bundler/CHANGELOG.md +26 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/install.rb +5 -2
- data/bundler/lib/bundler/cli/outdated.rb +12 -3
- data/bundler/lib/bundler/cli/platform.rb +1 -1
- data/bundler/lib/bundler/cli.rb +5 -3
- data/bundler/lib/bundler/definition.rb +61 -11
- data/bundler/lib/bundler/fetcher.rb +6 -6
- data/bundler/lib/bundler/gem_helpers.rb +7 -1
- data/bundler/lib/bundler/installer/standalone.rb +1 -1
- data/bundler/lib/bundler/installer.rb +8 -1
- data/bundler/lib/bundler/lazy_specification.rb +21 -21
- data/bundler/lib/bundler/man/bundle-cache.1 +6 -0
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/bundler/lib/bundler/man/bundle-config.1 +2 -2
- data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
- data/bundler/lib/bundler/man/bundle-install.1 +4 -0
- data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
- data/bundler/lib/bundler/man/bundle-platform.1 +15 -5
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/bundler/lib/bundler/man/bundle.1 +3 -6
- data/bundler/lib/bundler/man/bundle.1.ronn +3 -4
- data/bundler/lib/bundler/resolver.rb +2 -1
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +5 -5
- data/bundler/lib/bundler/rubygems_ext.rb +13 -0
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -0
- data/bundler/lib/bundler/spec_set.rb +15 -28
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems/available_set.rb +3 -3
- data/lib/rubygems/basic_specification.rb +2 -2
- data/lib/rubygems/command.rb +6 -6
- data/lib/rubygems/commands/cert_command.rb +1 -1
- data/lib/rubygems/commands/cleanup_command.rb +1 -1
- data/lib/rubygems/commands/contents_command.rb +1 -1
- data/lib/rubygems/commands/dependency_command.rb +4 -4
- data/lib/rubygems/commands/fetch_command.rb +2 -2
- data/lib/rubygems/commands/generate_index_command.rb +2 -2
- data/lib/rubygems/commands/install_command.rb +7 -7
- data/lib/rubygems/commands/pristine_command.rb +5 -5
- data/lib/rubygems/commands/setup_command.rb +4 -4
- data/lib/rubygems/commands/sources_command.rb +3 -3
- data/lib/rubygems/commands/specification_command.rb +2 -2
- data/lib/rubygems/commands/uninstall_command.rb +4 -4
- data/lib/rubygems/commands/update_command.rb +5 -5
- data/lib/rubygems/commands/which_command.rb +1 -1
- data/lib/rubygems/config_file.rb +7 -7
- data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/dependency.rb +5 -5
- data/lib/rubygems/dependency_installer.rb +5 -5
- data/lib/rubygems/dependency_list.rb +4 -4
- data/lib/rubygems/doctor.rb +4 -4
- data/lib/rubygems/exceptions.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +2 -2
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/indexer.rb +3 -3
- data/lib/rubygems/installer.rb +5 -13
- data/lib/rubygems/name_tuple.rb +3 -3
- data/lib/rubygems/package/tar_header.rb +17 -17
- data/lib/rubygems/package/tar_writer.rb +1 -1
- data/lib/rubygems/package.rb +19 -8
- data/lib/rubygems/platform.rb +15 -15
- data/lib/rubygems/query_utils.rb +6 -6
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request/connection_pools.rb +2 -2
- data/lib/rubygems/request/http_pool.rb +1 -1
- data/lib/rubygems/request.rb +1 -1
- data/lib/rubygems/request_set/gem_dependency_api.rb +3 -3
- data/lib/rubygems/request_set/lockfile/parser.rb +12 -12
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +2 -2
- data/lib/rubygems/request_set.rb +3 -3
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/api_specification.rb +4 -4
- data/lib/rubygems/resolver/best_set.rb +3 -3
- data/lib/rubygems/resolver/conflict.rb +3 -3
- data/lib/rubygems/resolver/git_specification.rb +3 -3
- data/lib/rubygems/resolver/index_specification.rb +3 -2
- data/lib/rubygems/resolver/installed_specification.rb +2 -2
- data/lib/rubygems/resolver/installer_set.rb +7 -12
- data/lib/rubygems/resolver/lock_set.rb +1 -1
- data/lib/rubygems/resolver/lock_specification.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +3 -3
- data/lib/rubygems/resolver.rb +4 -4
- data/lib/rubygems/security/policy.rb +6 -6
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/security.rb +1 -1
- data/lib/rubygems/source/git.rb +4 -4
- data/lib/rubygems/source.rb +1 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +26 -24
- data/lib/rubygems/specification_policy.rb +4 -4
- data/lib/rubygems/uninstaller.rb +4 -4
- data/lib/rubygems/user_interaction.rb +2 -2
- data/lib/rubygems/version.rb +12 -4
- data/lib/rubygems.rb +8 -8
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -1
- data/test/rubygems/helper.rb +5 -5
- data/test/rubygems/test_gem_config_file.rb +17 -5
- data/test/rubygems/test_gem_dependency_installer.rb +2 -2
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +1 -1
- data/test/rubygems/test_gem_installer.rb +6 -3
- data/test/rubygems/test_gem_package.rb +22 -0
- data/test/rubygems/test_gem_package_tar_reader.rb +1 -1
- data/test/rubygems/test_gem_requirement.rb +9 -3
- data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +44 -0
- data/test/rubygems/test_gem_specification.rb +11 -2
- data/test/rubygems/test_gem_version.rb +9 -2
- data/test/rubygems/test_require.rb +1 -1
- data/test/rubygems/utilities.rb +4 -4
- metadata +3 -3
|
@@ -96,7 +96,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|
|
96
96
|
|
|
97
97
|
def defaults_str # :nodoc:
|
|
98
98
|
"--version '#{Gem::Requirement.default}' --no-force " +
|
|
99
|
-
|
|
99
|
+
"--user-install"
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
def description # :nodoc:
|
|
@@ -114,8 +114,8 @@ that is a dependency of an existing gem. You can use the
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def check_version # :nodoc:
|
|
117
|
-
if options[:version] != Gem::Requirement.default
|
|
118
|
-
|
|
117
|
+
if options[:version] != Gem::Requirement.default &&
|
|
118
|
+
get_all_gem_names.size > 1
|
|
119
119
|
alert_error "Can't use --version with multiple gems. You can specify multiple gems with" \
|
|
120
120
|
" version requirements using `gem uninstall 'my_gem:1.0.0' 'my_other_gem:~>2.0.0'`"
|
|
121
121
|
terminate_interaction 1
|
|
@@ -125,7 +125,7 @@ that is a dependency of an existing gem. You can use the
|
|
|
125
125
|
def execute
|
|
126
126
|
check_version
|
|
127
127
|
|
|
128
|
-
if options[:all]
|
|
128
|
+
if options[:all] && !options[:args].empty?
|
|
129
129
|
uninstall_specific
|
|
130
130
|
elsif options[:all]
|
|
131
131
|
uninstall_all
|
|
@@ -56,7 +56,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
|
56
56
|
|
|
57
57
|
def defaults_str # :nodoc:
|
|
58
58
|
"--no-force --install-dir #{Gem.dir}\n" +
|
|
59
|
-
|
|
59
|
+
install_update_defaults_str
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def description # :nodoc:
|
|
@@ -155,7 +155,7 @@ command to remove old versions.
|
|
|
155
155
|
Gem::Specification.dirs = Gem.user_dir if options[:user_install]
|
|
156
156
|
|
|
157
157
|
Gem::Specification.each do |spec|
|
|
158
|
-
if hig[spec.name].nil?
|
|
158
|
+
if hig[spec.name].nil? || hig[spec.name].version < spec.version
|
|
159
159
|
hig[spec.name] = spec
|
|
160
160
|
end
|
|
161
161
|
end
|
|
@@ -292,8 +292,8 @@ command to remove old versions.
|
|
|
292
292
|
args << "--no-document" unless options[:document].include?("rdoc") || options[:document].include?("ri")
|
|
293
293
|
args << "--no-format-executable" if options[:no_format_executable]
|
|
294
294
|
args << "--previous-version" << Gem::VERSION if
|
|
295
|
-
options[:system] == true
|
|
296
|
-
|
|
295
|
+
options[:system] == true ||
|
|
296
|
+
Gem::Version.new(options[:system]) >= Gem::Version.new(2)
|
|
297
297
|
args
|
|
298
298
|
end
|
|
299
299
|
|
|
@@ -301,7 +301,7 @@ command to remove old versions.
|
|
|
301
301
|
result = []
|
|
302
302
|
|
|
303
303
|
highest_installed_gems.each do |l_name, l_spec|
|
|
304
|
-
next if
|
|
304
|
+
next if !gem_names.empty? &&
|
|
305
305
|
gem_names.none? {|name| name == l_spec.name }
|
|
306
306
|
|
|
307
307
|
highest_remote_tup = highest_remote_name_tuple l_spec
|
|
@@ -71,7 +71,7 @@ requiring to see why it does not behave as you expect.
|
|
|
71
71
|
dirs.each do |dir|
|
|
72
72
|
Gem.suffixes.each do |ext|
|
|
73
73
|
full_path = File.join dir, "#{package_name}#{ext}"
|
|
74
|
-
if File.exist?
|
|
74
|
+
if File.exist?(full_path) && !File.directory?(full_path)
|
|
75
75
|
result << full_path
|
|
76
76
|
return result unless options[:show_all]
|
|
77
77
|
end
|
data/lib/rubygems/config_file.rb
CHANGED
|
@@ -39,7 +39,7 @@ require "rbconfig"
|
|
|
39
39
|
class Gem::ConfigFile
|
|
40
40
|
include Gem::UserInteraction
|
|
41
41
|
|
|
42
|
-
DEFAULT_BACKTRACE =
|
|
42
|
+
DEFAULT_BACKTRACE = true
|
|
43
43
|
DEFAULT_BULK_THRESHOLD = 1000
|
|
44
44
|
DEFAULT_VERBOSITY = true
|
|
45
45
|
DEFAULT_UPDATE_SOURCES = true
|
|
@@ -368,7 +368,7 @@ if you believe they were disclosed to a third party.
|
|
|
368
368
|
|
|
369
369
|
# True if the backtrace option has been specified, or debug is on.
|
|
370
370
|
def backtrace
|
|
371
|
-
@backtrace
|
|
371
|
+
@backtrace || $DEBUG
|
|
372
372
|
end
|
|
373
373
|
|
|
374
374
|
# The name of the configuration file.
|
|
@@ -477,11 +477,11 @@ if you believe they were disclosed to a third party.
|
|
|
477
477
|
end
|
|
478
478
|
|
|
479
479
|
def ==(other) # :nodoc:
|
|
480
|
-
self.class === other
|
|
481
|
-
@backtrace == other.backtrace
|
|
482
|
-
@bulk_threshold == other.bulk_threshold
|
|
483
|
-
@verbose == other.verbose
|
|
484
|
-
@update_sources == other.update_sources
|
|
480
|
+
self.class === other &&
|
|
481
|
+
@backtrace == other.backtrace &&
|
|
482
|
+
@bulk_threshold == other.bulk_threshold &&
|
|
483
|
+
@verbose == other.verbose &&
|
|
484
|
+
@update_sources == other.update_sources &&
|
|
485
485
|
@hash == other.hash
|
|
486
486
|
end
|
|
487
487
|
|
|
@@ -39,7 +39,7 @@ if RUBY_VERSION >= "2.5" && !Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES
|
|
|
39
39
|
start += 1
|
|
40
40
|
|
|
41
41
|
if path = loc.path
|
|
42
|
-
unless path.start_with?(rubygems_path)
|
|
42
|
+
unless path.start_with?(rubygems_path) || path.start_with?("<internal:")
|
|
43
43
|
# Non-rubygems frames
|
|
44
44
|
uplevel -= 1
|
|
45
45
|
end
|
data/lib/rubygems/defaults.rb
CHANGED
|
@@ -161,7 +161,7 @@ module Gem
|
|
|
161
161
|
path = []
|
|
162
162
|
path << user_dir if user_home && File.exist?(user_home)
|
|
163
163
|
path << default_dir
|
|
164
|
-
path << vendor_dir if vendor_dir
|
|
164
|
+
path << vendor_dir if vendor_dir && File.directory?(vendor_dir)
|
|
165
165
|
path
|
|
166
166
|
end
|
|
167
167
|
|
data/lib/rubygems/dependency.rb
CHANGED
|
@@ -115,7 +115,7 @@ class Gem::Dependency
|
|
|
115
115
|
# What does this dependency require?
|
|
116
116
|
|
|
117
117
|
def requirement
|
|
118
|
-
return @requirement if defined?(@requirement)
|
|
118
|
+
return @requirement if defined?(@requirement) && @requirement
|
|
119
119
|
|
|
120
120
|
# @version_requirements and @version_requirement are legacy ivar
|
|
121
121
|
# names, and supported here because older gems need to keep
|
|
@@ -230,10 +230,10 @@ class Gem::Dependency
|
|
|
230
230
|
|
|
231
231
|
version = Gem::Version.new version
|
|
232
232
|
|
|
233
|
-
return true if requirement.none?
|
|
234
|
-
return false if version.prerelease?
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
return true if requirement.none? && !version.prerelease?
|
|
234
|
+
return false if version.prerelease? &&
|
|
235
|
+
!allow_prerelease &&
|
|
236
|
+
!prerelease?
|
|
237
237
|
|
|
238
238
|
requirement.satisfied_by? version
|
|
239
239
|
end
|
|
@@ -109,7 +109,7 @@ class Gem::DependencyInstaller
|
|
|
109
109
|
# gems should be considered.
|
|
110
110
|
|
|
111
111
|
def consider_local?
|
|
112
|
-
@domain == :both
|
|
112
|
+
@domain == :both || @domain == :local
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
##
|
|
@@ -117,7 +117,7 @@ class Gem::DependencyInstaller
|
|
|
117
117
|
# gems should be considered.
|
|
118
118
|
|
|
119
119
|
def consider_remote?
|
|
120
|
-
@domain == :both
|
|
120
|
+
@domain == :both || @domain == :remote
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
##
|
|
@@ -197,7 +197,7 @@ class Gem::DependencyInstaller
|
|
|
197
197
|
|
|
198
198
|
def in_background(what) # :nodoc:
|
|
199
199
|
fork_happened = false
|
|
200
|
-
if @build_docs_in_background
|
|
200
|
+
if @build_docs_in_background && Process.respond_to?(:fork)
|
|
201
201
|
begin
|
|
202
202
|
Process.fork do
|
|
203
203
|
yield
|
|
@@ -268,7 +268,7 @@ class Gem::DependencyInstaller
|
|
|
268
268
|
end
|
|
269
269
|
|
|
270
270
|
def install_development_deps # :nodoc:
|
|
271
|
-
if @development
|
|
271
|
+
if @development && @dev_shallow
|
|
272
272
|
:shallow
|
|
273
273
|
elsif @development
|
|
274
274
|
:all
|
|
@@ -289,7 +289,7 @@ class Gem::DependencyInstaller
|
|
|
289
289
|
installer_set.force = @force
|
|
290
290
|
|
|
291
291
|
if consider_local?
|
|
292
|
-
if dep_or_name =~ /\.gem$/
|
|
292
|
+
if dep_or_name =~ /\.gem$/ && File.file?(dep_or_name)
|
|
293
293
|
src = Gem::Source::SpecificFile.new dep_or_name
|
|
294
294
|
installer_set.add_local dep_or_name, src.spec, src
|
|
295
295
|
version = src.spec.version if version == Gem::Requirement.default
|
|
@@ -119,11 +119,11 @@ class Gem::DependencyList
|
|
|
119
119
|
each do |spec|
|
|
120
120
|
spec.runtime_dependencies.each do |dep|
|
|
121
121
|
inst = Gem::Specification.any? do |installed_spec|
|
|
122
|
-
dep.name == installed_spec.name
|
|
123
|
-
dep.requirement.satisfied_by?
|
|
122
|
+
dep.name == installed_spec.name &&
|
|
123
|
+
dep.requirement.satisfied_by?(installed_spec.version)
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
unless inst
|
|
126
|
+
unless inst || @specs.find {|s| s.satisfies_requirement? dep }
|
|
127
127
|
unsatisfied[spec.name] << dep
|
|
128
128
|
return unsatisfied if quick
|
|
129
129
|
end
|
|
@@ -175,7 +175,7 @@ class Gem::DependencyList
|
|
|
175
175
|
def remove_specs_unsatisfied_by(dependencies)
|
|
176
176
|
specs.reject! do |spec|
|
|
177
177
|
dep = dependencies[spec.name]
|
|
178
|
-
dep
|
|
178
|
+
dep && !dep.requirement.satisfied_by?(spec.version)
|
|
179
179
|
end
|
|
180
180
|
end
|
|
181
181
|
|
data/lib/rubygems/doctor.rb
CHANGED
|
@@ -30,7 +30,7 @@ class Gem::Doctor
|
|
|
30
30
|
|
|
31
31
|
missing =
|
|
32
32
|
Gem::REPOSITORY_SUBDIRECTORIES.sort -
|
|
33
|
-
|
|
33
|
+
REPOSITORY_EXTENSION_MAP.map {|(k,_)| k }.sort
|
|
34
34
|
|
|
35
35
|
raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ', '}" unless
|
|
36
36
|
missing.empty?
|
|
@@ -59,7 +59,7 @@ class Gem::Doctor
|
|
|
59
59
|
# Are we doctoring a gem repository?
|
|
60
60
|
|
|
61
61
|
def gem_repository?
|
|
62
|
-
|
|
62
|
+
!installed_specs.empty?
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
##
|
|
@@ -111,8 +111,8 @@ class Gem::Doctor
|
|
|
111
111
|
basename = File.basename(child, extension)
|
|
112
112
|
next if installed_specs.include? basename
|
|
113
113
|
next if /^rubygems-\d/ =~ basename
|
|
114
|
-
next if "specifications" == sub_directory
|
|
115
|
-
next if "plugins" == sub_directory
|
|
114
|
+
next if "specifications" == sub_directory && "default" == basename
|
|
115
|
+
next if "plugins" == sub_directory && Gem.plugin_suffix_regexp =~ (basename)
|
|
116
116
|
|
|
117
117
|
type = File.directory?(child) ? "directory" : "file"
|
|
118
118
|
|
data/lib/rubygems/exceptions.rb
CHANGED
|
@@ -254,7 +254,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError
|
|
|
254
254
|
# Gem::Resolver::DependencyRequest +dep+
|
|
255
255
|
|
|
256
256
|
def initialize(dep, platform_mismatch=nil)
|
|
257
|
-
if platform_mismatch
|
|
257
|
+
if platform_mismatch && !platform_mismatch.empty?
|
|
258
258
|
plats = platform_mismatch.map {|x| x.platform.to_s }.sort.uniq
|
|
259
259
|
super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
|
|
260
260
|
else
|
|
@@ -44,7 +44,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
|
44
44
|
full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
|
|
45
45
|
|
|
46
46
|
# TODO remove in RubyGems 4
|
|
47
|
-
if Gem.install_extension_in_lib
|
|
47
|
+
if Gem.install_extension_in_lib && lib_dir
|
|
48
48
|
FileUtils.mkdir_p lib_dir
|
|
49
49
|
entries = Dir.entries(full_tmp_dest) - %w[. ..]
|
|
50
50
|
entries = entries.map {|entry| File.join full_tmp_dest, entry }
|
|
@@ -53,7 +53,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
|
53
53
|
|
|
54
54
|
FileUtils::Entry_.new(full_tmp_dest).traverse do |ent|
|
|
55
55
|
destent = ent.class.new(dest_path, ent.rel)
|
|
56
|
-
destent.exist?
|
|
56
|
+
destent.exist? || FileUtils.mv(ent.path, destent.path)
|
|
57
57
|
end
|
|
58
58
|
ensure
|
|
59
59
|
ENV["DESTDIR"] = destdir
|
|
@@ -71,7 +71,7 @@ module Gem::GemcutterUtilities
|
|
|
71
71
|
begin
|
|
72
72
|
env_rubygems_host = ENV["RUBYGEMS_HOST"]
|
|
73
73
|
env_rubygems_host = nil if
|
|
74
|
-
env_rubygems_host
|
|
74
|
+
env_rubygems_host && env_rubygems_host.empty?
|
|
75
75
|
|
|
76
76
|
env_rubygems_host || configured_host
|
|
77
77
|
end
|
data/lib/rubygems/indexer.rb
CHANGED
|
@@ -149,7 +149,7 @@ class Gem::Indexer
|
|
|
149
149
|
next
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
platform = Gem::Platform::RUBY if platform.nil?
|
|
152
|
+
platform = Gem::Platform::RUBY if platform.nil? || platform.empty?
|
|
153
153
|
[spec.name, spec.version, platform]
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -296,7 +296,7 @@ class Gem::Indexer
|
|
|
296
296
|
files = @files
|
|
297
297
|
files.delete @quick_marshal_dir if files.include? @quick_dir
|
|
298
298
|
|
|
299
|
-
if files.include?
|
|
299
|
+
if files.include?(@quick_marshal_dir) && !files.include?(@quick_dir)
|
|
300
300
|
files.delete @quick_marshal_dir
|
|
301
301
|
|
|
302
302
|
dst_name = File.join(@dest_directory, @quick_marshal_dir_base)
|
|
@@ -414,7 +414,7 @@ class Gem::Indexer
|
|
|
414
414
|
|
|
415
415
|
index.each do |spec|
|
|
416
416
|
platform = spec.original_platform
|
|
417
|
-
platform = Gem::Platform::RUBY if platform.nil?
|
|
417
|
+
platform = Gem::Platform::RUBY if platform.nil? || platform.empty?
|
|
418
418
|
specs_index << [spec.name, spec.version, platform]
|
|
419
419
|
end
|
|
420
420
|
|
data/lib/rubygems/installer.rb
CHANGED
|
@@ -251,7 +251,7 @@ class Gem::Installer
|
|
|
251
251
|
return if spec.name == existing
|
|
252
252
|
|
|
253
253
|
# somebody has written to RubyGems' directory, overwrite, too bad
|
|
254
|
-
return if Gem.default_bindir != @bin_dir
|
|
254
|
+
return if Gem.default_bindir != @bin_dir && !ruby_executable
|
|
255
255
|
|
|
256
256
|
question = "#{spec.name}'s executable \"#{filename}\" conflicts with ".dup
|
|
257
257
|
|
|
@@ -418,10 +418,10 @@ class Gem::Installer
|
|
|
418
418
|
# True if the gems in the system satisfy +dependency+.
|
|
419
419
|
|
|
420
420
|
def installation_satisfies_dependency?(dependency)
|
|
421
|
-
return true if @options[:development]
|
|
421
|
+
return true if @options[:development] && dependency.type == :development
|
|
422
422
|
return true if installed_specs.detect {|s| dependency.matches_spec? s }
|
|
423
423
|
return false if @only_install_dir
|
|
424
|
-
|
|
424
|
+
!dependency.matching_specs.empty?
|
|
425
425
|
end
|
|
426
426
|
|
|
427
427
|
##
|
|
@@ -483,22 +483,14 @@ class Gem::Installer
|
|
|
483
483
|
end
|
|
484
484
|
|
|
485
485
|
def generate_bin # :nodoc:
|
|
486
|
-
return if spec.executables.nil?
|
|
486
|
+
return if spec.executables.nil? || spec.executables.empty?
|
|
487
487
|
|
|
488
488
|
ensure_writable_dir @bin_dir
|
|
489
489
|
|
|
490
490
|
spec.executables.each do |filename|
|
|
491
491
|
filename.tap(&Gem::UNTAINT)
|
|
492
492
|
bin_path = File.join gem_dir, spec.bindir, filename
|
|
493
|
-
|
|
494
|
-
unless File.exist? bin_path
|
|
495
|
-
if File.symlink? bin_path
|
|
496
|
-
alert_warning "`#{bin_path}` is dangling symlink pointing to `#{File.readlink bin_path}`"
|
|
497
|
-
else
|
|
498
|
-
alert_warning "`#{bin_path}` does not exist, maybe `gem pristine #{spec.name}` will fix it?"
|
|
499
|
-
end
|
|
500
|
-
next
|
|
501
|
-
end
|
|
493
|
+
next unless File.exist? bin_path
|
|
502
494
|
|
|
503
495
|
mode = File.stat(bin_path).mode
|
|
504
496
|
dir_mode = options[:prog_mode] || (mode | 0111)
|
data/lib/rubygems/name_tuple.rb
CHANGED
|
@@ -10,7 +10,7 @@ class Gem::NameTuple
|
|
|
10
10
|
@version = version
|
|
11
11
|
|
|
12
12
|
unless platform.kind_of? Gem::Platform
|
|
13
|
-
platform = "ruby" if !platform
|
|
13
|
+
platform = "ruby" if !platform || platform.empty?
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
@platform = platform
|
|
@@ -102,8 +102,8 @@ class Gem::NameTuple
|
|
|
102
102
|
def ==(other)
|
|
103
103
|
case other
|
|
104
104
|
when self.class
|
|
105
|
-
@name == other.name
|
|
106
|
-
@version == other.version
|
|
105
|
+
@name == other.name &&
|
|
106
|
+
@version == other.version &&
|
|
107
107
|
@platform == other.platform
|
|
108
108
|
when Array
|
|
109
109
|
to_a == other
|
|
@@ -173,23 +173,23 @@ class Gem::Package::TarHeader
|
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
def ==(other) # :nodoc:
|
|
176
|
-
self.class === other
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
176
|
+
self.class === other &&
|
|
177
|
+
@checksum == other.checksum &&
|
|
178
|
+
@devmajor == other.devmajor &&
|
|
179
|
+
@devminor == other.devminor &&
|
|
180
|
+
@gid == other.gid &&
|
|
181
|
+
@gname == other.gname &&
|
|
182
|
+
@linkname == other.linkname &&
|
|
183
|
+
@magic == other.magic &&
|
|
184
|
+
@mode == other.mode &&
|
|
185
|
+
@mtime == other.mtime &&
|
|
186
|
+
@name == other.name &&
|
|
187
|
+
@prefix == other.prefix &&
|
|
188
|
+
@size == other.size &&
|
|
189
|
+
@typeflag == other.typeflag &&
|
|
190
|
+
@uid == other.uid &&
|
|
191
|
+
@uname == other.uname &&
|
|
192
|
+
@version == other.version
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
def to_s # :nodoc:
|
|
@@ -314,7 +314,7 @@ class Gem::Package::TarWriter
|
|
|
314
314
|
prefix = parts.join("/")
|
|
315
315
|
end
|
|
316
316
|
|
|
317
|
-
if name.bytesize > 100
|
|
317
|
+
if name.bytesize > 100 || prefix.empty?
|
|
318
318
|
raise Gem::Package::TooLongFileName.new("File \"#{prefix}/#{name}\" has a too long name (should be 100 or less)")
|
|
319
319
|
end
|
|
320
320
|
|
data/lib/rubygems/package.rb
CHANGED
|
@@ -68,14 +68,14 @@ class Gem::Package
|
|
|
68
68
|
class PathError < Error
|
|
69
69
|
def initialize(destination, destination_dir)
|
|
70
70
|
super "installing into parent path %s of %s is not allowed" %
|
|
71
|
-
|
|
71
|
+
[destination, destination_dir]
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
class SymlinkError < Error
|
|
76
76
|
def initialize(name, destination, destination_dir)
|
|
77
77
|
super "installing symlink '%s' pointing to parent path %s of %s is not allowed" %
|
|
78
|
-
|
|
78
|
+
[name, destination, destination_dir]
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -409,18 +409,23 @@ EOM
|
|
|
409
409
|
|
|
410
410
|
def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
|
|
411
411
|
directories = []
|
|
412
|
+
symlinks = []
|
|
413
|
+
|
|
412
414
|
open_tar_gz io do |tar|
|
|
413
415
|
tar.each do |entry|
|
|
414
|
-
|
|
416
|
+
full_name = entry.full_name
|
|
417
|
+
next unless File.fnmatch pattern, full_name, File::FNM_DOTMATCH
|
|
415
418
|
|
|
416
|
-
destination = install_location
|
|
419
|
+
destination = install_location full_name, destination_dir
|
|
417
420
|
|
|
418
421
|
if entry.symlink?
|
|
419
422
|
link_target = entry.header.linkname
|
|
420
423
|
real_destination = link_target.start_with?("/") ? link_target : File.expand_path(link_target, File.dirname(destination))
|
|
421
424
|
|
|
422
|
-
raise Gem::Package::SymlinkError.new(
|
|
425
|
+
raise Gem::Package::SymlinkError.new(full_name, real_destination, destination_dir) unless
|
|
423
426
|
normalize_path(real_destination).start_with? normalize_path(destination_dir + "/")
|
|
427
|
+
|
|
428
|
+
symlinks << [full_name, link_target, destination, real_destination]
|
|
424
429
|
end
|
|
425
430
|
|
|
426
431
|
FileUtils.rm_rf destination
|
|
@@ -444,12 +449,18 @@ EOM
|
|
|
444
449
|
FileUtils.chmod file_mode(entry.header.mode), destination
|
|
445
450
|
end if entry.file?
|
|
446
451
|
|
|
447
|
-
File.symlink(entry.header.linkname, destination) if entry.symlink?
|
|
448
|
-
|
|
449
452
|
verbose destination
|
|
450
453
|
end
|
|
451
454
|
end
|
|
452
455
|
|
|
456
|
+
symlinks.each do |name, target, destination, real_destination|
|
|
457
|
+
if File.exist?(real_destination)
|
|
458
|
+
File.symlink(target, destination)
|
|
459
|
+
else
|
|
460
|
+
alert_warning "#{@spec.full_name} ships with a dangling symlink named #{name} pointing to missing #{target} file. Ignoring"
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
|
|
453
464
|
if dir_mode
|
|
454
465
|
File.chmod(dir_mode, *directories)
|
|
455
466
|
end
|
|
@@ -676,7 +687,7 @@ EOM
|
|
|
676
687
|
"package content (data.tar.gz) is missing", @gem
|
|
677
688
|
end
|
|
678
689
|
|
|
679
|
-
if duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first)
|
|
690
|
+
if (duplicates = @files.group_by {|f| f }.select {|k,v| v.size > 1 }.map(&:first)) && duplicates.any?
|
|
680
691
|
raise Gem::Security::Exception, "duplicate files in the package: (#{duplicates.map(&:inspect).join(', ')})"
|
|
681
692
|
end
|
|
682
693
|
end
|
data/lib/rubygems/platform.rb
CHANGED
|
@@ -23,9 +23,9 @@ class Gem::Platform
|
|
|
23
23
|
|
|
24
24
|
def self.match_platforms?(platform, platforms)
|
|
25
25
|
platforms.any? do |local_platform|
|
|
26
|
-
platform.nil?
|
|
27
|
-
local_platform == platform
|
|
28
|
-
(local_platform != Gem::Platform::RUBY
|
|
26
|
+
platform.nil? ||
|
|
27
|
+
local_platform == platform ||
|
|
28
|
+
(local_platform != Gem::Platform::RUBY && local_platform =~ platform)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
private_class_method :match_platforms?
|
|
@@ -70,7 +70,7 @@ class Gem::Platform
|
|
|
70
70
|
when String then
|
|
71
71
|
arch = arch.split "-"
|
|
72
72
|
|
|
73
|
-
if arch.length > 2
|
|
73
|
+
if arch.length > 2 && arch.last !~ (/\d/) # reassemble x86-linux-gnu
|
|
74
74
|
extra = arch.pop
|
|
75
75
|
arch.last << "-#{extra}"
|
|
76
76
|
end
|
|
@@ -82,7 +82,7 @@ class Gem::Platform
|
|
|
82
82
|
else cpu
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
if arch.length == 2
|
|
85
|
+
if arch.length == 2 && arch.last =~ /^\d+(\.\d+)?$/ # for command-line
|
|
86
86
|
@os, @version = arch
|
|
87
87
|
return
|
|
88
88
|
end
|
|
@@ -107,7 +107,7 @@ class Gem::Platform
|
|
|
107
107
|
when /mingw-?(\w+)?/ then [ "mingw", $1 ]
|
|
108
108
|
when /(mswin\d+)(\_(\d+))?/ then
|
|
109
109
|
os, version = $1, $3
|
|
110
|
-
@cpu = "x86" if @cpu.nil?
|
|
110
|
+
@cpu = "x86" if @cpu.nil? && os =~ /32$/
|
|
111
111
|
[os, version]
|
|
112
112
|
when /netbsdelf/ then [ "netbsdelf", nil ]
|
|
113
113
|
when /openbsd(\d+\.\d+)?/ then [ "openbsd", $1 ]
|
|
@@ -139,7 +139,7 @@ class Gem::Platform
|
|
|
139
139
|
# the same CPU, OS and version.
|
|
140
140
|
|
|
141
141
|
def ==(other)
|
|
142
|
-
self.class === other
|
|
142
|
+
self.class === other && to_a == other.to_a
|
|
143
143
|
end
|
|
144
144
|
|
|
145
145
|
alias :eql? :==
|
|
@@ -160,18 +160,18 @@ class Gem::Platform
|
|
|
160
160
|
return nil unless Gem::Platform === other
|
|
161
161
|
|
|
162
162
|
# universal-mingw32 matches x64-mingw-ucrt
|
|
163
|
-
return true if (@cpu == "universal"
|
|
164
|
-
@os.start_with?("mingw")
|
|
163
|
+
return true if (@cpu == "universal" || other.cpu == "universal") &&
|
|
164
|
+
@os.start_with?("mingw") && other.os.start_with?("mingw")
|
|
165
165
|
|
|
166
166
|
# cpu
|
|
167
|
-
([nil,"universal"].include?(@cpu)
|
|
168
|
-
(@cpu == "arm"
|
|
167
|
+
([nil,"universal"].include?(@cpu) || [nil, "universal"].include?(other.cpu) || @cpu == other.cpu ||
|
|
168
|
+
(@cpu == "arm" && other.cpu.start_with?("arm"))) &&
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
# os
|
|
171
|
+
@os == other.os &&
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
# version
|
|
174
|
+
(@version.nil? || other.version.nil? || @version == other.version)
|
|
175
175
|
end
|
|
176
176
|
|
|
177
177
|
##
|
data/lib/rubygems/query_utils.rb
CHANGED
|
@@ -112,7 +112,7 @@ module Gem::QueryUtils
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def display_header(type)
|
|
115
|
-
if (ui.outs.tty?
|
|
115
|
+
if (ui.outs.tty? && Gem.configuration.verbose) || both?
|
|
116
116
|
say
|
|
117
117
|
say "*** #{type} GEMS ***"
|
|
118
118
|
say
|
|
@@ -132,7 +132,7 @@ module Gem::QueryUtils
|
|
|
132
132
|
name_matches = name ? s.name =~ name : true
|
|
133
133
|
version_matches = show_prereleases? || !s.version.prerelease?
|
|
134
134
|
|
|
135
|
-
name_matches
|
|
135
|
+
name_matches && version_matches
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
spec_tuples = specs.map do |spec|
|
|
@@ -176,7 +176,7 @@ module Gem::QueryUtils
|
|
|
176
176
|
# Check if gem +name+ version +version+ is installed.
|
|
177
177
|
|
|
178
178
|
def installed?(name, req = Gem::Requirement.default)
|
|
179
|
-
Gem::Specification.any? {|s| s.name =~ name
|
|
179
|
+
Gem::Specification.any? {|s| s.name =~ name && req =~ s.version }
|
|
180
180
|
end
|
|
181
181
|
|
|
182
182
|
def output_query_results(spec_tuples)
|
|
@@ -242,7 +242,7 @@ module Gem::QueryUtils
|
|
|
242
242
|
return unless options[:versions]
|
|
243
243
|
|
|
244
244
|
list =
|
|
245
|
-
if platforms.empty?
|
|
245
|
+
if platforms.empty? || options[:details]
|
|
246
246
|
name_tuples.map {|n| n.version }.uniq
|
|
247
247
|
else
|
|
248
248
|
platforms.sort.reverse.map do |version, pls|
|
|
@@ -289,13 +289,13 @@ module Gem::QueryUtils
|
|
|
289
289
|
end
|
|
290
290
|
|
|
291
291
|
def spec_homepage(entry, spec)
|
|
292
|
-
return if spec.homepage.nil?
|
|
292
|
+
return if spec.homepage.nil? || spec.homepage.empty?
|
|
293
293
|
|
|
294
294
|
entry << "\n" << format_text("Homepage: #{spec.homepage}", 68, 4)
|
|
295
295
|
end
|
|
296
296
|
|
|
297
297
|
def spec_license(entry, spec)
|
|
298
|
-
return if spec.license.nil?
|
|
298
|
+
return if spec.license.nil? || spec.license.empty?
|
|
299
299
|
|
|
300
300
|
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
|
|
301
301
|
licenses << spec.licenses.join(", ")
|