Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9a487f292cab
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1758394572ab
Choose a head ref
  • 3 commits
  • 73 files changed
  • 1 contributor

Commits on Feb 23, 2018

  1. Update to RubyGems 2.7.6.

    headius committed Feb 23, 2018

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    nomadium Miguel Landaeta
    Copy the full SHA
    778e9d8 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    nomadium Miguel Landaeta
    Copy the full SHA
    61ba92e View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1758394 View commit details
Showing with 1,316 additions and 653 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 bin/jgem
  3. +6 −2 core/src/main/java/org/jruby/Ruby.java
  4. +1 −1 core/src/main/java/org/jruby/ext/stringio/StringIO.java
  5. +83 −42 lib/ruby/stdlib/rubygems.rb
  6. +8 −4 lib/ruby/stdlib/rubygems/basic_specification.rb
  7. +112 −0 lib/ruby/stdlib/rubygems/bundler_version_finder.rb
  8. +10 −2 lib/ruby/stdlib/rubygems/command.rb
  9. +3 −1 lib/ruby/stdlib/rubygems/command_manager.rb
  10. +31 −6 lib/ruby/stdlib/rubygems/commands/cert_command.rb
  11. +10 −3 lib/ruby/stdlib/rubygems/commands/cleanup_command.rb
  12. +1 −1 lib/ruby/stdlib/rubygems/commands/generate_index_command.rb
  13. +1 −1 lib/ruby/stdlib/rubygems/commands/help_command.rb
  14. +4 −2 lib/ruby/stdlib/rubygems/commands/owner_command.rb
  15. +11 −8 lib/ruby/stdlib/rubygems/commands/pristine_command.rb
  16. +2 −1 lib/ruby/stdlib/rubygems/commands/push_command.rb
  17. +13 −14 lib/ruby/stdlib/rubygems/commands/query_command.rb
  18. +174 −69 lib/ruby/stdlib/rubygems/commands/setup_command.rb
  19. +33 −0 lib/ruby/stdlib/rubygems/commands/signin_command.rb
  20. +33 −0 lib/ruby/stdlib/rubygems/commands/signout_command.rb
  21. +4 −3 lib/ruby/stdlib/rubygems/commands/uninstall_command.rb
  22. +18 −6 lib/ruby/stdlib/rubygems/commands/unpack_command.rb
  23. +1 −1 lib/ruby/stdlib/rubygems/commands/update_command.rb
  24. +1 −1 lib/ruby/stdlib/rubygems/commands/which_command.rb
  25. +4 −11 lib/ruby/stdlib/rubygems/commands/yank_command.rb
  26. +14 −25 lib/ruby/stdlib/rubygems/config_file.rb
  27. +10 −9 lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb
  28. +2 −0 lib/ruby/stdlib/rubygems/dependency.rb
  29. +4 −0 lib/ruby/stdlib/rubygems/dependency_installer.rb
  30. +3 −0 lib/ruby/stdlib/rubygems/errors.rb
  31. +6 −0 lib/ruby/stdlib/rubygems/exceptions.rb
  32. +2 −2 lib/ruby/stdlib/rubygems/ext/builder.rb
  33. +2 −4 lib/ruby/stdlib/rubygems/ext/ext_conf_builder.rb
  34. +1 −1 lib/ruby/stdlib/rubygems/ext/rake_builder.rb
  35. +5 −1 lib/ruby/stdlib/rubygems/gem_runner.rb
  36. +5 −4 lib/ruby/stdlib/rubygems/indexer.rb
  37. +5 −28 lib/ruby/stdlib/rubygems/install_update_options.rb
  38. +21 −11 lib/ruby/stdlib/rubygems/installer.rb
  39. +6 −3 lib/ruby/stdlib/rubygems/installer_test_case.rb
  40. +35 −6 lib/ruby/stdlib/rubygems/package.rb
  41. +2 −2 lib/ruby/stdlib/rubygems/package/file_source.rb
  42. +2 −2 lib/ruby/stdlib/rubygems/package/old.rb
  43. +14 −9 lib/ruby/stdlib/rubygems/package/tar_header.rb
  44. +2 −0 lib/ruby/stdlib/rubygems/package/tar_writer.rb
  45. +1 −1 lib/ruby/stdlib/rubygems/request.rb
  46. +20 −3 lib/ruby/stdlib/rubygems/request_set.rb
  47. +3 −3 lib/ruby/stdlib/rubygems/request_set/gem_dependency_api.rb
  48. +1 −1 lib/ruby/stdlib/rubygems/request_set/lockfile.rb
  49. +5 −1 lib/ruby/stdlib/rubygems/requirement.rb
  50. +24 −3 lib/ruby/stdlib/rubygems/resolver.rb
  51. +4 −6 lib/ruby/stdlib/rubygems/resolver/installer_set.rb
  52. +4 −1 lib/ruby/stdlib/rubygems/safe_yaml.rb
  53. +11 −4 lib/ruby/stdlib/rubygems/security.rb
  54. +1 −1 lib/ruby/stdlib/rubygems/security/trust_dir.rb
  55. +43 −0 lib/ruby/stdlib/rubygems/security_option.rb
  56. +17 −13 lib/ruby/stdlib/rubygems/server.rb
  57. +8 −5 lib/ruby/stdlib/rubygems/source.rb
  58. +2 −1 lib/ruby/stdlib/rubygems/source/git.rb
  59. +38 −35 lib/ruby/stdlib/rubygems/source/local.rb
  60. +4 −1 lib/ruby/stdlib/rubygems/source/lock.rb
  61. +3 −1 lib/ruby/stdlib/rubygems/source_local.rb
  62. +3 −2 lib/ruby/stdlib/rubygems/source_specific_file.rb
  63. +7 −3 lib/ruby/stdlib/rubygems/spec_fetcher.rb
  64. +296 −235 lib/ruby/stdlib/rubygems/specification.rb
  65. +4 −3 lib/ruby/stdlib/rubygems/stub_specification.rb
  66. +25 −6 lib/ruby/stdlib/rubygems/test_case.rb
  67. +1 −1 lib/ruby/stdlib/rubygems/test_utilities.rb
  68. +15 −13 lib/ruby/stdlib/rubygems/user_interaction.rb
  69. +6 −16 lib/ruby/stdlib/rubygems/util.rb
  70. +37 −0 lib/ruby/stdlib/rubygems/util/licenses.rb
  71. +3 −3 lib/ruby/stdlib/rubygems/validator.rb
  72. +17 −3 lib/ruby/stdlib/rubygems/version.rb
  73. +6 −1 lib/ruby/stdlib/rubygems/version_option.rb
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ lib/ruby/cext/
lib/ruby/gems
lib/ruby/stdlib/*.jar
lib/ruby/stdlib/ant*
lib/ruby/stdlib/bundler*
lib/ruby/stdlib/did_you_mean*
lib/ruby/stdlib/gauntlet_rdoc.rb
lib/ruby/stdlib/ipaddr*
2 changes: 1 addition & 1 deletion bin/jgem
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ require 'rubygems/exceptions'
required_version = Gem::Requirement.new ">= 1.8.7"

unless required_version.satisfied_by? Gem.ruby_version then
abort "Expected Ruby Version #{required_version}, is #{Gem.ruby_version}"
abort "Expected Ruby version #{required_version}, is #{Gem.ruby_version}"
end

args = ARGV.clone
8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1392,7 +1392,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz

private void initCore() {
if (profile.allowClass("Data")) {
defineClass("Data", objectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
dataClass = defineClass("Data", objectClass, ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
getObject().deprecateConstant(this, "Data");
}

@@ -4793,6 +4793,10 @@ public FilenoUtil getFilenoUtil() {
return filenoUtil;
}

public RubyClass getData() {
return dataClass;
}

@Deprecated
private static final RecursiveFunctionEx<RecursiveFunction> LEGACY_RECURSE = new RecursiveFunctionEx<RecursiveFunction>() {
@Override
@@ -4992,7 +4996,7 @@ private MRIRecursionGuard oldRecursionGuard() {
syntaxError, standardError, loadError, notImplementedError, securityError, noMemoryError,
regexpError, eofError, threadError, concurrencyError, systemStackError, zeroDivisionError, floatDomainError, mathDomainError,
encodingError, encodingCompatibilityError, converterNotFoundError, undefinedConversionError,
invalidByteSequenceError, fiberError, randomClass, keyError, locationClass, interruptedRegexpError;
invalidByteSequenceError, fiberError, randomClass, keyError, locationClass, interruptedRegexpError, dataClass;

/**
* All the core modules we keep direct references to, for quick access and
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/stringio/StringIO.java
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ public IRubyObject allocate(Ruby runtime, RubyClass klass) {

public static RubyClass createStringIOClass(final Ruby runtime) {
RubyClass stringIOClass = runtime.defineClass(
"StringIO", runtime.getClass("Data"), STRINGIO_ALLOCATOR);
"StringIO", runtime.getData(), STRINGIO_ALLOCATOR);

stringIOClass.defineAnnotatedMethods(StringIO.class);
stringIOClass.includeModule(runtime.getEnumerable());
125 changes: 83 additions & 42 deletions lib/ruby/stdlib/rubygems.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
require 'thread'

module Gem
VERSION = "2.6.14"
VERSION = "2.7.6"
end

# Must be first since it unloads the prelude from 1.9.2
@@ -39,23 +39,22 @@ module Gem
# Further RubyGems documentation can be found at:
#
# * {RubyGems Guides}[http://guides.rubygems.org]
# * {RubyGems API}[http://rubygems.rubyforge.org/rdoc] (also available from
# * {RubyGems API}[http://www.rubydoc.info/github/rubygems/rubygems] (also available from
# <tt>gem server</tt>)
#
# == RubyGems Plugins
#
# As of RubyGems 1.3.2, RubyGems will load plugins installed in gems or
# $LOAD_PATH. Plugins must be named 'rubygems_plugin' (.rb, .so, etc) and
# placed at the root of your gem's #require_path. Plugins are discovered via
# Gem::find_files then loaded. Take care when implementing a plugin as your
# plugin file may be loaded multiple times if multiple versions of your gem
# are installed.
# Gem::find_files and then loaded.
#
# For an example plugin, see the graph gem which adds a `gem graph` command.
# For an example plugin, see the {Graph gem}[https://github.com/seattlerb/graph]
# which adds a `gem graph` command.
#
# == RubyGems Defaults, Packaging
#
# RubyGems defaults are stored in rubygems/defaults.rb. If you're packaging
# RubyGems defaults are stored in lib/rubygems/defaults.rb. If you're packaging
# RubyGems or implementing Ruby you can change RubyGems' defaults.
#
# For RubyGems packagers, provide lib/rubygems/defaults/operating_system.rb
@@ -65,7 +64,7 @@ module Gem
# override any defaults from lib/rubygems/defaults.rb.
#
# If you need RubyGems to perform extra work on install or uninstall, your
# defaults override file can set pre and post install and uninstall hooks.
# defaults override file can set pre/post install and uninstall hooks.
# See Gem::pre_install, Gem::pre_uninstall, Gem::post_install,
# Gem::post_uninstall.
#
@@ -106,6 +105,8 @@ module Gem
#
# (If your name is missing, PLEASE let us know!)
#
# == License
#
# See {LICENSE.txt}[rdoc-ref:lib/rubygems/LICENSE.txt] for permissions.
#
# Thanks!
@@ -130,6 +131,7 @@ module Gem

GEM_DEP_FILES = %w[
gem.deps.rb
gems.rb
Gemfile
Isolate
]
@@ -159,7 +161,7 @@ module Gem
# these are defined in Ruby 1.8.7, hence the need for this convoluted setup.

READ_BINARY_ERRORS = begin
read_binary_errors = [Errno::EACCES]
read_binary_errors = [Errno::EACCES, Errno::EROFS, Errno::ENOSYS]
read_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
read_binary_errors
end.freeze
@@ -169,11 +171,13 @@ module Gem
# these are defined in Ruby 1.8.7.

WRITE_BINARY_ERRORS = begin
write_binary_errors = []
write_binary_errors = [Errno::ENOSYS]
write_binary_errors << Errno::ENOTSUP if Errno.const_defined?(:ENOTSUP)
write_binary_errors
end.freeze

USE_BUNDLER_FOR_GEMDEPS = !ENV['DONT_USE_BUNDLER_FOR_GEMDEPS'] # :nodoc:

@@win_platform = nil

@configuration = nil
@@ -266,17 +270,22 @@ def self.find_spec_for_exe name, exec_name, requirements

return loaded if loaded && dep.matches_spec?(loaded)

specs = dep.matching_specs(true)

raise Gem::GemNotFoundException,
"can't find gem #{dep}" if specs.empty?
find_specs = proc { dep.matching_specs(true) }
if dep.to_s == "bundler (>= 0.a)"
specs = Gem::BundlerVersionFinder.without_filtering(&find_specs)
else
specs = find_specs.call
end

specs = specs.find_all { |spec|
spec.executables.include? exec_name
} if exec_name

unless spec = specs.first
msg = "can't find gem #{name} (#{requirements}) with executable #{exec_name}"
msg = "can't find gem #{dep} with executable #{exec_name}"
if name == "bundler" && bundler_message = Gem::BundlerVersionFinder.missing_version_message
msg = bundler_message
end
raise Gem::GemNotFoundException, msg
end

@@ -297,7 +306,10 @@ def self.find_spec_for_exe name, exec_name, requirements

def self.activate_bin_path name, exec_name, requirement # :nodoc:
spec = find_spec_for_exe name, exec_name, [requirement]
Gem::LOADED_SPECS_MUTEX.synchronize { spec.activate }
Gem::LOADED_SPECS_MUTEX.synchronize do
spec.activate
finish_resolve
end
spec.bin_file exec_name
end

@@ -356,12 +368,16 @@ def self.configuration=(config)
# package is not available as a gem, return nil.

def self.datadir(gem_name)
# TODO: deprecate
spec = @loaded_specs[gem_name]
return nil if spec.nil?
spec.datadir
end

class << self
extend Gem::Deprecate
deprecate :datadir, "spec.datadir", 2016, 10
end

##
# A Zlib::Deflate.deflate wrapper

@@ -594,23 +610,20 @@ def self.find_home
# Zlib::GzipReader wrapper that unzips +data+.

def self.gunzip(data)
require 'rubygems/util'
Gem::Util.gunzip data
end

##
# Zlib::GzipWriter wrapper that zips +data+.

def self.gzip(data)
require 'rubygems/util'
Gem::Util.gzip data
end

##
# A Zlib::Inflate#inflate wrapper

def self.inflate(data)
require 'rubygems/util'
Gem::Util.inflate data
end

@@ -716,9 +729,20 @@ def self.load_yaml

##
# The file name and line number of the caller of the caller of this method.
#
# +depth+ is how many layers up the call stack it should go.
#
# e.g.,
#
# def a; Gem.location_of_caller; end
# a #=> ["x.rb", 2] # (it'll vary depending on file name and line number)
#
# def b; c; end
# def c; Gem.location_of_caller(2); end
# b #=> ["x.rb", 6] # (it'll vary depending on file name and line number)

def self.location_of_caller
caller[1] =~ /(.*?):(\d+).*?$/i
def self.location_of_caller(depth = 1)
caller[depth] =~ /(.*?):(\d+).*?$/i
file = $1
lineno = $2.to_i

@@ -847,19 +871,19 @@ def self.refresh
# Safely read a file in binary mode on all platforms.

def self.read_binary(path)
open path, 'rb+' do |f|
File.open path, 'rb+' do |f|
f.flock(File::LOCK_EX)
f.read
end
rescue *READ_BINARY_ERRORS
open path, 'rb' do |f|
File.open path, 'rb' do |f|
f.read
end
rescue Errno::ENOLCK # NFS
if Thread.main != Thread.current
raise
else
open path, 'rb' do |f|
File.open path, 'rb' do |f|
f.read
end
end
@@ -1149,8 +1173,6 @@ def self.use_gemdeps path = nil
path = path.dup

if path == "-" then
require 'rubygems/util'

Gem::Util.traverse_parents Dir.pwd do |directory|
dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }

@@ -1169,18 +1191,36 @@ def self.use_gemdeps path = nil
raise ArgumentError, "Unable to find gem dependencies file at #{path}"
end

rs = Gem::RequestSet.new
@gemdeps = rs.load_gemdeps path
if USE_BUNDLER_FOR_GEMDEPS

ENV["BUNDLE_GEMFILE"] ||= File.expand_path(path)
require 'rubygems/user_interaction'
Gem::DefaultUserInteraction.use_ui(ui) do
require "bundler"
@gemdeps = Bundler.setup
Bundler.ui = nil
@gemdeps.requested_specs.map(&:to_spec).sort_by(&:name)
end

else

rs = Gem::RequestSet.new
@gemdeps = rs.load_gemdeps path

rs.resolve_current.map do |s|
s.full_spec.tap(&:activate)
end

rs.resolve_current.map do |s|
sp = s.full_spec
sp.activate
sp
end
rescue Gem::LoadError, Gem::UnsatisfiableDependencyError => e
warn e.message
warn "You may need to `gem install -g` to install missing gems"
warn ""
rescue => e
case e
when Gem::LoadError, Gem::UnsatisfiableDependencyError, (defined?(Bundler::GemNotFound) ? Bundler::GemNotFound : Gem::LoadError)
warn e.message
warn "You may need to `gem install -g` to install missing gems"
warn ""
else
raise
end
end

class << self
@@ -1226,25 +1266,24 @@ def register_default_spec(spec)
prefix_pattern = /^(#{prefix_group})/
end

suffix_pattern = /#{Regexp.union(Gem.suffixes)}\z/

spec.files.each do |file|
if new_format
file = file.sub(prefix_pattern, "")
next unless $~
end

@path_to_default_spec_map[file] = spec
@path_to_default_spec_map[file.sub(suffix_pattern, "")] = spec
end
end

##
# Find a Gem::Specification of default gem from +path+

def find_unresolved_default_spec(path)
Gem.suffixes.each do |suffix|
spec = @path_to_default_spec_map["#{path}#{suffix}"]
return spec if spec
end
nil
@path_to_default_spec_map[path]
end

##
@@ -1315,6 +1354,7 @@ def clear_default_specs

MARSHAL_SPEC_DIR = "quick/Marshal.#{Gem.marshal_version}/"

autoload :BundlerVersionFinder, 'rubygems/bundler_version_finder'
autoload :ConfigFile, 'rubygems/config_file'
autoload :Dependency, 'rubygems/dependency'
autoload :DependencyList, 'rubygems/dependency_list'
@@ -1330,6 +1370,7 @@ def clear_default_specs
autoload :SourceList, 'rubygems/source_list'
autoload :SpecFetcher, 'rubygems/spec_fetcher'
autoload :Specification, 'rubygems/specification'
autoload :Util, 'rubygems/util'
autoload :Version, 'rubygems/version'

require "rubygems/specification"
12 changes: 8 additions & 4 deletions lib/ruby/stdlib/rubygems/basic_specification.rb
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ def contains_requirable_file? file
elsif missing_extensions? then
@ignored = true

warn "Ignoring #{full_name} because its extensions are not built. " +
warn "Ignoring #{full_name} because its extensions are not built. " +
"Try: gem pristine #{name} --version #{version}"
return false
end
@@ -275,10 +275,14 @@ def matches_for_glob glob # TODO: rename?
# for this spec.

def lib_dirs_glob
dirs = if self.require_paths.size > 1 then
"{#{self.require_paths.join(',')}}"
dirs = if self.raw_require_paths
if self.raw_require_paths.size > 1 then
"{#{self.raw_require_paths.join(',')}}"
else
self.raw_require_paths.first
end
else
self.require_paths.first
"lib" # default value for require_paths for bundler/inline
end

"#{self.full_gem_path}/#{dirs}".dup.untaint
Loading