Skip to content

Commit

Permalink
Merge RubyGems-3.3.27 and Bundler-2.3.27
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Nov 10, 2023
1 parent 42325aa commit 77dce52
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 130 deletions.
5 changes: 5 additions & 0 deletions lib/bundler/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def local_search(query)
when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query)
when String then specs_by_name(query)
when Gem::Dependency then search_by_dependency(query)
when Array then search_by_name_and_version(*query)
else
raise "You can't search for a #{query.inspect}."
end
Expand Down Expand Up @@ -173,6 +174,10 @@ def search_by_dependency(dependency)
end
end

def search_by_name_and_version(name, version)
specs_by_name(name).select {|spec| spec.version == version }
end

EMPTY_SEARCH = [].freeze

def search_by_spec(spec)
Expand Down
66 changes: 33 additions & 33 deletions lib/bundler/lazy_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def initialize(name, version, platform, source = nil)
@dependencies = []
@platform = platform || Gem::Platform::RUBY
@source = source
@specification = nil
end

def full_name
Expand Down Expand Up @@ -76,37 +75,46 @@ def to_lock
def materialize_for_installation
source.local!

candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
matching_specs = source.specs.search(use_exact_resolved_specifications? ? self : [name, version])
return self if matching_specs.empty?

GemHelpers.select_best_platform_match(source.specs.search(Dependency.new(name, version)), target_platform)
candidates = if use_exact_resolved_specifications?
matching_specs
else
source.specs.search(self)
end
target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform

return self if candidates.empty?
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)

__materialize__(candidates)
end
specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
return specification unless specification.nil?

def __materialize__(candidates)
@specification = begin
search = candidates.reverse.find do |spec|
spec.is_a?(StubSpecification) ||
(spec.matches_current_ruby? &&
spec.matches_current_rubygems?)
end
if search.nil? && Bundler.frozen_bundle?
search = candidates.last
else
search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
if target_platform != platform
installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
end
search

installable_candidates
end

__materialize__(candidates)
end

def respond_to?(*args)
super || @specification ? @specification.respond_to?(*args) : nil
# If in frozen mode, we fallback to a non-installable candidate because by
# doing this we avoid re-resolving and potentially end up changing the
# lock file, which is not allowed. In that case, we will give a proper error
# about the mismatch higher up the stack, right before trying to install the
# bad gem.
def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
search = candidates.reverse.find do |spec|
spec.is_a?(StubSpecification) ||
(spec.matches_current_ruby? &&
spec.matches_current_rubygems?)
end
if search.nil? && fallback_to_non_installable
search = candidates.last
else
search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
end
search
end

def to_s
Expand All @@ -128,16 +136,8 @@ def git_version

private

def to_ary
nil
end

def method_missing(method, *args, &blk)
raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification

return super unless respond_to?(method)

@specification.send(method, *args, &blk)
def use_exact_resolved_specifications?
@use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
end

#
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ def initialize_regexp(pattern)
ret = {}

# for Bundler::URI::split
ret[:ABS_URI] = Regexp.new('\A\s*+' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
ret[:REL_URI] = Regexp.new('\A\s*+' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)
ret[:ABS_URI] = Regexp.new('\A\s*' + pattern[:X_ABS_URI] + '\s*\z', Regexp::EXTENDED)
ret[:REL_URI] = Regexp.new('\A\s*' + pattern[:X_REL_URI] + '\s*\z', Regexp::EXTENDED)

# for Bundler::URI::extract
ret[:URI_REF] = Regexp.new(pattern[:URI_REF])
Expand Down
6 changes: 3 additions & 3 deletions lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Bundler::URI
class RFC3986_Parser # :nodoc:
# Bundler::URI defined in RFC3986
# this regexp is modified not to host is not empty string
RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*+):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*+)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h++\.[!$&-.0-;=A-Z_a-z~]++))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])++))?(?::(?<port>\d*+))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*+))*+)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])++)(?:\/\g<segment>)*+)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*+)|(?<path-empty>))(?:\?(?<query>[^#]*+))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*+))?)\z/
RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*+)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h++\.[!$&-.0-;=A-Z_a-z~]++))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])++))?(?::(?<port>\d*+))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*+))*+)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])++)(?:\/\g<segment>)*+)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])++)(?:\/\g<segment>)*+)|(?<path-empty>))(?:\?(?<query>[^#]*+))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*+))?)\z/
RFC3986_URI = /\A(?<Bundler::URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
attr_reader :regexp

def initialize
Expand Down Expand Up @@ -95,7 +95,7 @@ def default_regexp # :nodoc:
QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*\z/,
OPAQUE: /\A(?:[^\/].*)?\z/,
PORT: /\A[\x09\x0a\x0c\x0d ]*+\d*[\x09\x0a\x0c\x0d ]*\z/,
PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/vendor/uri/lib/uri/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Bundler::URI
# :stopdoc:
VERSION_CODE = '001003'.freeze
VERSION_CODE = '001001'.freeze
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
# :startdoc:
end
2 changes: 1 addition & 1 deletion lib/bundler/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: false

module Bundler
VERSION = "2.3.26".freeze
VERSION = "2.3.27".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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require "rbconfig"

module Gem
VERSION = "3.3.26".freeze
VERSION = "3.3.27".freeze
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/commands/binstubs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
before { lockfile.gsub(system_bundler_version, "1.1.1") }

it "calls through to the latest bundler version" do
sys_exec "bin/bundle update --bundler", :env => { "DEBUG" => "1" }
sys_exec "bin/bundle update --bundler=#{Bundler::VERSION}", :env => { "DEBUG" => "1" }
using_bundler_line = /Using bundler ([\w\.]+)\n/.match(out)
expect(using_bundler_line).to_not be_nil
latest_version = using_bundler_line[1]
Expand Down
49 changes: 49 additions & 0 deletions spec/bundler/install/gemfile/specific_platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,55 @@
L
end

context "when running on a legacy lockfile locked only to RUBY" do
around do |example|
build_repo4 do
build_gem "nokogiri", "1.3.10"
build_gem "nokogiri", "1.3.10" do |s|
s.platform = "arm64-darwin"
s.required_ruby_version = "< #{Gem.ruby_version}"
end

build_gem "bundler", "2.1.4"
end

gemfile <<~G
source "#{file_uri_for(gem_repo4)}"
gem "nokogiri"
G

lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
nokogiri (1.3.10)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
RUBY VERSION
2.5.3p105
BUNDLED WITH
2.1.4
L

simulate_platform "arm64-darwin-22", &example
end

it "still installs the generic RUBY variant if necessary" do
bundle "update --bundler", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
end

it "still installs the generic RUBY variant if necessary, even in frozen mode" do
bundle "update --bundler", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s, "BUNDLE_FROZEN" => "true" }
end
end

it "doesn't discard previously installed platform specific gem and fall back to ruby on subsequent bundles" do
build_repo2 do
build_gem("libv8", "8.4.255.0")
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/support/artifice/compact_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def not_modified?(checksum)
end

def requested_range_for(response_body)
ranges = Rack::Utils.byte_ranges(env, response_body.bytesize)
ranges = Rack::Utils.get_byte_ranges(env, response_body.bytesize)

if ranges
status 206
Expand Down
1 change: 1 addition & 0 deletions test/rubygems/test_gem_ext_cargo_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def test_custom_name
def skip_unsupported_platforms!
pend "jruby not supported" if java_platform?
pend "truffleruby not supported (yet)" if RUBY_ENGINE == "truffleruby"
pend "mingw platform failed in 2023" if /mingw/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS")
pend "mswin not supported (yet)" if /mswin/ =~ RUBY_PLATFORM && ENV.key?("GITHUB_ACTIONS")
system(@rust_envs, "cargo", "-V", out: IO::NULL, err: [:child, :out])
pend "cargo not present" unless $?.success?
Expand Down
2 changes: 1 addition & 1 deletion tool/bundler/dev_gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
gem "parallel", "1.19.2" # 1.20+ is required > Ruby 2.3
gem "rspec-core", "~> 3.8"
gem "rspec-expectations", "~> 3.8"
gem "rspec-mocks", "~> 3.11.1"
gem "rspec-mocks", "~> 3.8"
gem "uri", "~> 0.10.1"

group :doc do
Expand Down
29 changes: 15 additions & 14 deletions tool/bundler/dev_gems.rb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@ GEM
specs:
diff-lcs (1.5.0)
hpricot (0.8.6)
hpricot (0.8.6-java)
mustache (1.1.1)
parallel (1.19.2)
parallel_tests (2.32.0)
parallel
power_assert (2.0.1)
rake (13.0.6)
rdiscount (2.2.0.2)
power_assert (2.0.3)
rake (13.1.0)
rdiscount (2.2.7.1)
rdoc (6.2.0)
ronn (0.7.3)
hpricot (>= 0.8.2)
mustache (>= 0.7.0)
rdiscount (>= 1.5.8)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
test-unit (3.5.3)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
test-unit (3.6.1)
power_assert
uri (0.10.1)
webrick (1.7.0)
uri (0.10.3)
webrick (1.8.1)

PLATFORMS
java
Expand All @@ -47,7 +48,7 @@ DEPENDENCIES
ronn (~> 0.7.3)
rspec-core (~> 3.8)
rspec-expectations (~> 3.8)
rspec-mocks (~> 3.11.1)
rspec-mocks (~> 3.8)
test-unit (~> 3.0)
uri (~> 0.10.1)
webrick (~> 1.6)
Expand Down
Loading

0 comments on commit 77dce52

Please sign in to comment.