Skip to content

Commit

Permalink
Merge RubyGems-3.4.11 and Bundler-2.4.11
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt authored and nagachika committed Aug 29, 2023
1 parent 5d568e1 commit dd91a17
Show file tree
Hide file tree
Showing 41 changed files with 18,559 additions and 225 deletions.
4 changes: 2 additions & 2 deletions lib/bundler.rb
Expand Up @@ -89,7 +89,7 @@ module Bundler

class << self
def configure
@configured ||= configure_gem_home_and_path
@configure ||= configure_gem_home_and_path
end

def ui
Expand Down Expand Up @@ -581,7 +581,7 @@ def reset_paths!
@bin_path = nil
@bundler_major_version = nil
@bundle_path = nil
@configured = nil
@configure = nil
@configured_bundle_path = nil
@definition = nil
@load = nil
Expand Down
10 changes: 9 additions & 1 deletion lib/bundler/definition.rb
Expand Up @@ -668,9 +668,17 @@ def converge_locals
def check_missing_lockfile_specs
all_locked_specs = @locked_specs.map(&:name) << "bundler"

@locked_specs.any? do |s|
missing = @locked_specs.select do |s|
s.dependencies.any? {|dep| !all_locked_specs.include?(dep.name) }
end

if missing.any?
@locked_specs.delete(missing)

true
else
false
end
end

def converge_paths
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/gem_version_promoter.rb
Expand Up @@ -93,7 +93,7 @@ def sort_dep_specs(specs, package)
locked_version = package.locked_version

result = specs.sort do |a, b|
unless locked_version && (package.prerelease_specified? || pre?)
unless package.prerelease_specified? || pre?
a_pre = a.prerelease?
b_pre = b.prerelease?

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/lazy_specification.rb
Expand Up @@ -122,7 +122,7 @@ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bund
end

def to_s
@__to_s ||= if platform == Gem::Platform::RUBY
@to_s ||= if platform == Gem::Platform::RUBY
"#{name} (#{version})"
else
"#{name} (#{version}-#{platform})"
Expand Down
4 changes: 1 addition & 3 deletions lib/bundler/resolver/base.rb
Expand Up @@ -35,9 +35,7 @@ def [](name)
end

def delete(specs)
specs.each do |spec|
@base.delete(spec)
end
@base.delete(specs)
end

def get_package(name)
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/ruby_version.rb
Expand Up @@ -107,7 +107,7 @@ def self.system
ruby_engine_version = RUBY_ENGINE == "ruby" ? ruby_version : RUBY_ENGINE_VERSION.dup
patchlevel = RUBY_PATCHLEVEL.to_s

@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
@system ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
end

private
Expand Down
8 changes: 5 additions & 3 deletions lib/bundler/rubygems_ext.rb
Expand Up @@ -66,7 +66,9 @@ def load_paths

alias_method :rg_extension_dir, :extension_dir
def extension_dir
@bundler_extension_dir ||= if source.respond_to?(:extension_dir_name)
# following instance variable is already used in original method
# and that is the reason to prefix it with bundler_ and add rubocop exception
@bundler_extension_dir ||= if source.respond_to?(:extension_dir_name) # rubocop:disable Naming/MemoizedInstanceVariableName
unique_extension_dir = [source.extension_dir_name, File.basename(full_gem_path)].uniq.join("-")
File.expand_path(File.join(extensions_dir, unique_extension_dir))
else
Expand Down Expand Up @@ -203,9 +205,9 @@ def ==(other)
protected

def _requirements_sorted?
return @_are_requirements_sorted if defined?(@_are_requirements_sorted)
return @_requirements_sorted if defined?(@_requirements_sorted)
strings = as_list
@_are_requirements_sorted = strings == strings.sort
@_requirements_sorted = strings == strings.sort
end

def _with_sorted_requirements
Expand Down
13 changes: 5 additions & 8 deletions lib/bundler/source/rubygems.rb
Expand Up @@ -7,8 +7,6 @@ class Source
class Rubygems < Source
autoload :Remote, File.expand_path("rubygems/remote", __dir__)

# Use the API when installing less than X gems
API_REQUEST_LIMIT = 500
# Ask for X gems per API request
API_REQUEST_SIZE = 50

Expand Down Expand Up @@ -401,12 +399,11 @@ def remote_specs
# gather lists from non-api sites
fetch_names(index_fetchers, nil, idx, false)

# because ensuring we have all the gems we need involves downloading
# the gemspecs of those gems, if the non-api sites contain more than
# about 500 gems, we treat all sites as non-api for speed.
allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT
Bundler.ui.debug "Need to query more than #{API_REQUEST_LIMIT} gems." \
" Downloading full index instead..." unless allow_api
# legacy multi-remote sources need special logic to figure out
# dependency names and that logic can be very costly if one remote
# uses the dependency API but others don't. So use full indexes
# consistently in that particular case.
allow_api = !multiple_remotes?

fetch_names(api_fetchers, allow_api && dependency_names, idx, false)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/spec_set.rb
Expand Up @@ -63,8 +63,8 @@ def []=(key, value)
@sorted = nil
end

def delete(spec)
@specs.delete(spec)
def delete(specs)
specs.each {|spec| @specs.delete(spec) }
@lookup = nil
@sorted = nil
end
Expand Down
5 changes: 5 additions & 0 deletions lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt
Expand Up @@ -2,4 +2,9 @@

require "mkmf"

# Makes all symbols private by default to avoid unintended conflict
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
# selectively, or entirely remove this flag.
append_cflags("-fvisibility=hidden")

create_makefile(<%= config[:makefile_path].inspect %>)
2 changes: 1 addition & 1 deletion lib/bundler/templates/newgem/ext/newgem/newgem.c.tt
Expand Up @@ -2,7 +2,7 @@

VALUE rb_m<%= config[:constant_array].join %>;

void
RUBY_FUNC_EXPORTED void
Init_<%= config[:underscored_name] %>(void)
{
rb_m<%= config[:constant_array].join %> = rb_define_module(<%= config[:constant_name].inspect %>);
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false

module Bundler
VERSION = "2.4.10".freeze
VERSION = "2.4.11".freeze

def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems.rb
Expand Up @@ -8,7 +8,7 @@
require "rbconfig"

module Gem
VERSION = "3.4.10"
VERSION = "3.4.11"
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/command_manager.rb
Expand Up @@ -83,7 +83,7 @@ class Gem::CommandManager
# Return the authoritative instance of the command manager.

def self.instance
@command_manager ||= new
@instance ||= new
end

##
Expand All @@ -98,7 +98,7 @@ def instance
# Reset the authoritative instance of the command manager.

def self.reset
@command_manager = nil
@instance = nil
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/installer.rb
Expand Up @@ -388,7 +388,7 @@ def run_post_install_hooks # :nodoc:
# we'll be installing into.

def installed_specs
@specs ||= begin
@installed_specs ||= begin
specs = []

Gem::Util.glob_files_in_dir("*.gemspec", File.join(gem_home, "specifications")).each do |path|
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/request_set.rb
Expand Up @@ -107,7 +107,7 @@ def initialize(*deps)
@requests = []
@sets = []
@soft_missing = false
@sorted = nil
@sorted_requests = nil
@specs = nil
@vendor_set = nil
@source_set = nil
Expand Down Expand Up @@ -424,7 +424,7 @@ def resolve_current
end

def sorted_requests
@sorted ||= strongly_connected_components.flatten
@sorted_requests ||= strongly_connected_components.flatten
end

def specs
Expand Down
4 changes: 3 additions & 1 deletion lib/rubygems/specification.rb
Expand Up @@ -2233,7 +2233,7 @@ def original_platform # :nodoc:
# The platform this gem runs on. See Gem::Platform for details.

def platform
@new_platform ||= Gem::Platform::RUBY
@new_platform ||= Gem::Platform::RUBY # rubocop:disable Naming/MemoizedInstanceVariableName
end

def pretty_print(q) # :nodoc:
Expand Down Expand Up @@ -2712,6 +2712,8 @@ def reset_nil_attributes_to_default
end

@installed_by_version ||= nil

nil
end

def flatten_require_paths # :nodoc:
Expand Down
3 changes: 2 additions & 1 deletion lib/rubygems/stub_specification.rb
Expand Up @@ -183,14 +183,15 @@ def full_name
##
# The full Gem::Specification for this gem, loaded from evalling its gemspec

def to_spec
def spec
@spec ||= if @data
loaded = Gem.loaded_specs[name]
loaded if loaded && loaded.version == version
end

@spec ||= Gem::Specification.load(loaded_from)
end
alias_method :to_spec, :spec

##
# Is this StubSpecification valid? i.e. have we found a stub line, OR does
Expand Down

0 comments on commit dd91a17

Please sign in to comment.