mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Merge RubyGems-3.2.20 and Bundler-2.2.20
This commit is contained in:
parent
f63d3bbb6e
commit
1e98ec27f6
25 changed files with 192 additions and 22 deletions
|
@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
||||||
# include the gemspec itself because warbler breaks w/o it
|
# include the gemspec itself because warbler breaks w/o it
|
||||||
s.files += %w[bundler.gemspec]
|
s.files += %w[bundler.gemspec]
|
||||||
|
|
||||||
s.extra_rdoc_files = %w[CHANGELOG.md LICENSE.md README.md]
|
s.files += %w[CHANGELOG.md LICENSE.md README.md]
|
||||||
s.bindir = "exe"
|
s.bindir = "exe"
|
||||||
s.executables = %w[bundle bundler]
|
s.executables = %w[bundle bundler]
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
|
|
|
@ -11,9 +11,11 @@ module Bundler
|
||||||
def run
|
def run
|
||||||
Bundler.settings.set_command_option_if_given :path, options[:path]
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
||||||
|
|
||||||
|
definition = Bundler.definition
|
||||||
|
definition.validate_runtime!
|
||||||
|
|
||||||
begin
|
begin
|
||||||
definition = Bundler.definition
|
definition.resolve_only_locally!
|
||||||
definition.validate_runtime!
|
|
||||||
not_installed = definition.missing_specs
|
not_installed = definition.missing_specs
|
||||||
rescue GemNotFound, VersionConflict
|
rescue GemNotFound, VersionConflict
|
||||||
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies."
|
||||||
|
|
|
@ -147,6 +147,8 @@ module Bundler
|
||||||
|
|
||||||
def retrieve_active_spec(definition, current_spec)
|
def retrieve_active_spec(definition, current_spec)
|
||||||
active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
active_spec = definition.resolve.find_by_name_and_platform(current_spec.name, current_spec.platform)
|
||||||
|
return unless active_spec
|
||||||
|
|
||||||
return active_spec if strict
|
return active_spec if strict
|
||||||
|
|
||||||
active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
active_specs = active_spec.source.specs.search(current_spec.name).select {|spec| spec.match_platform(current_spec.platform) }.sort_by(&:version)
|
||||||
|
|
|
@ -160,6 +160,12 @@ module Bundler
|
||||||
@disable_multisource
|
@disable_multisource
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def resolve_only_locally!
|
||||||
|
@remote = false
|
||||||
|
sources.local_only!
|
||||||
|
resolve
|
||||||
|
end
|
||||||
|
|
||||||
def resolve_with_cache!
|
def resolve_with_cache!
|
||||||
sources.cached!
|
sources.cached!
|
||||||
resolve
|
resolve
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative "base"
|
require_relative "base"
|
||||||
require "rubygems/remote_fetcher"
|
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
class Fetcher
|
class Fetcher
|
||||||
|
|
|
@ -49,8 +49,6 @@ module Bundler
|
||||||
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
|
"Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)."
|
||||||
else request_issue_report_for(error)
|
else request_issue_report_for(error)
|
||||||
end
|
end
|
||||||
rescue StandardError
|
|
||||||
raise error
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def exit_status(error)
|
def exit_status(error)
|
||||||
|
@ -111,7 +109,7 @@ module Bundler
|
||||||
First, try this link to see if there are any existing issue reports for this error:
|
First, try this link to see if there are any existing issue reports for this error:
|
||||||
#{issues_url(e)}
|
#{issues_url(e)}
|
||||||
|
|
||||||
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
|
If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
|
||||||
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
|
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
|
|
@ -526,13 +526,14 @@ module Bundler
|
||||||
Bundler::Retry.new("download gem from #{uri}").attempts do
|
Bundler::Retry.new("download gem from #{uri}").attempts do
|
||||||
fetcher.download(spec, uri, path)
|
fetcher.download(spec, uri, path)
|
||||||
end
|
end
|
||||||
|
rescue Gem::RemoteFetcher::FetchError => e
|
||||||
|
raise Bundler::HTTPError, "Could not download gem from #{uri} due to underlying error <#{e.message}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def gem_remote_fetcher
|
def gem_remote_fetcher
|
||||||
require "resolv"
|
require "rubygems/remote_fetcher"
|
||||||
proxy = configuration[:http_proxy]
|
proxy = configuration[:http_proxy]
|
||||||
dns = Resolv::DNS.new
|
Gem::RemoteFetcher.new(proxy)
|
||||||
Gem::RemoteFetcher.new(proxy, dns)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def gem_from_path(path, policy = nil)
|
def gem_from_path(path, policy = nil)
|
||||||
|
|
|
@ -36,6 +36,8 @@ module Bundler
|
||||||
|
|
||||||
def local!; end
|
def local!; end
|
||||||
|
|
||||||
|
def local_only!; end
|
||||||
|
|
||||||
def cached!; end
|
def cached!; end
|
||||||
|
|
||||||
def remote!; end
|
def remote!; end
|
||||||
|
|
|
@ -26,6 +26,12 @@ module Bundler
|
||||||
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def local_only!
|
||||||
|
@specs = nil
|
||||||
|
@allow_local = true
|
||||||
|
@allow_remote = false
|
||||||
|
end
|
||||||
|
|
||||||
def local!
|
def local!
|
||||||
return if @allow_local
|
return if @allow_local
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,10 @@ module Bundler
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def local_only!
|
||||||
|
all_sources.each(&:local_only!)
|
||||||
|
end
|
||||||
|
|
||||||
def cached!
|
def cached!
|
||||||
all_sources.each(&:cached!)
|
all_sources.each(&:cached!)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: false
|
# frozen_string_literal: false
|
||||||
|
|
||||||
module Bundler
|
module Bundler
|
||||||
VERSION = "2.2.19".freeze
|
VERSION = "2.2.20".freeze
|
||||||
|
|
||||||
def self.bundler_major_version
|
def self.bundler_major_version
|
||||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
require 'rbconfig'
|
require 'rbconfig'
|
||||||
|
|
||||||
module Gem
|
module Gem
|
||||||
VERSION = "3.2.19".freeze
|
VERSION = "3.2.20".freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
# Must be first since it unloads the prelude from 1.9.2
|
# Must be first since it unloads the prelude from 1.9.2
|
||||||
|
|
|
@ -728,6 +728,10 @@ class Gem::Installer
|
||||||
raise Gem::InstallError, "#{spec} has an invalid extensions"
|
raise Gem::InstallError, "#{spec} has an invalid extensions"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if spec.platform.to_s =~ /\R/
|
||||||
|
raise Gem::InstallError, "#{spec.platform} is an invalid platform"
|
||||||
|
end
|
||||||
|
|
||||||
unless spec.specification_version.to_s =~ /\A\d+\z/
|
unless spec.specification_version.to_s =~ /\A\d+\z/
|
||||||
raise Gem::InstallError, "#{spec} has an invalid specification_version"
|
raise Gem::InstallError, "#{spec} has an invalid specification_version"
|
||||||
end
|
end
|
||||||
|
|
|
@ -124,25 +124,26 @@ class Gem::SpecificationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
metadata.each do |key, value|
|
metadata.each do |key, value|
|
||||||
|
entry = "metadata['#{key}']"
|
||||||
if !key.kind_of?(String)
|
if !key.kind_of?(String)
|
||||||
error "metadata keys must be a String"
|
error "metadata keys must be a String"
|
||||||
end
|
end
|
||||||
|
|
||||||
if key.size > 128
|
if key.size > 128
|
||||||
error "metadata key too large (#{key.size} > 128)"
|
error "metadata key is too large (#{key.size} > 128)"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !value.kind_of?(String)
|
if !value.kind_of?(String)
|
||||||
error "metadata values must be a String"
|
error "#{entry} value must be a String"
|
||||||
end
|
end
|
||||||
|
|
||||||
if value.size > 1024
|
if value.size > 1024
|
||||||
error "metadata value too large (#{value.size} > 1024)"
|
error "#{entry} value is too large (#{value.size} > 1024)"
|
||||||
end
|
end
|
||||||
|
|
||||||
if METADATA_LINK_KEYS.include? key
|
if METADATA_LINK_KEYS.include? key
|
||||||
if value !~ VALID_URI_PATTERN
|
if value !~ VALID_URI_PATTERN
|
||||||
error "metadata['#{key}'] has invalid link: #{value.inspect}"
|
error "#{entry} has invalid link: #{value.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -553,6 +553,10 @@ class Gem::TestCase < Test::Unit::TestCase
|
||||||
Gem.pre_uninstall_hooks.clear
|
Gem.pre_uninstall_hooks.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def without_any_upwards_gemfiles
|
||||||
|
ENV["BUNDLE_GEMFILE"] = File.join(@tempdir, "Gemfile")
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# A git_gem is used with a gem dependencies file. The gem created here
|
# A git_gem is used with a gem dependencies file. The gem created here
|
||||||
# has no files, just a gem specification for the given +name+ and +version+.
|
# has no files, just a gem specification for the given +name+ and +version+.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rubygems/remote_fetcher"
|
||||||
|
|
||||||
RSpec.describe Bundler::Fetcher::Index do
|
RSpec.describe Bundler::Fetcher::Index do
|
||||||
let(:downloader) { nil }
|
let(:downloader) { nil }
|
||||||
let(:remote) { nil }
|
let(:remote) { nil }
|
||||||
|
|
|
@ -288,6 +288,66 @@ RSpec.describe "bundle check" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "when using only scoped rubygems sources" do
|
||||||
|
before do
|
||||||
|
gemfile <<~G
|
||||||
|
source "#{file_uri_for(gem_repo1)}" do
|
||||||
|
gem "rack"
|
||||||
|
end
|
||||||
|
G
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns success when the Gemfile is satisfied" do
|
||||||
|
system_gems "rack-1.0.0", :path => default_bundle_path
|
||||||
|
bundle :check
|
||||||
|
expect(out).to include("The Gemfile's dependencies are satisfied")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "when using only scoped rubygems sources with indirect dependencies" do
|
||||||
|
before do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "depends_on_rack" do |s|
|
||||||
|
s.add_dependency "rack"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "rack"
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<~G
|
||||||
|
source "#{file_uri_for(gem_repo4)}" do
|
||||||
|
gem "depends_on_rack"
|
||||||
|
end
|
||||||
|
G
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns success when the Gemfile is satisfied and generates a correct lockfile" do
|
||||||
|
system_gems "depends_on_rack-1.0", "rack-1.0", :gem_repo => gem_repo4, :path => default_bundle_path
|
||||||
|
bundle :check
|
||||||
|
expect(out).to include("The Gemfile's dependencies are satisfied")
|
||||||
|
expect(lockfile).to eq <<~L
|
||||||
|
GEM
|
||||||
|
specs:
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: #{file_uri_for(gem_repo4)}/
|
||||||
|
specs:
|
||||||
|
depends_on_rack (1.0)
|
||||||
|
rack
|
||||||
|
rack (1.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
depends_on_rack!
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "BUNDLED WITH" do
|
describe "BUNDLED WITH" do
|
||||||
def lock_with(bundler_version = nil)
|
def lock_with(bundler_version = nil)
|
||||||
lock = <<-L
|
lock = <<-L
|
||||||
|
|
|
@ -1292,4 +1292,53 @@ RSpec.describe "bundle outdated" do
|
||||||
expect(out).to end_with(expected_output)
|
expect(out).to end_with(expected_output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when a gem is no longer a dependency after a full update" do
|
||||||
|
before do
|
||||||
|
build_repo4 do
|
||||||
|
build_gem "mini_portile2", "2.5.2" do |s|
|
||||||
|
s.add_dependency "net-ftp", "~> 0.1"
|
||||||
|
end
|
||||||
|
|
||||||
|
build_gem "mini_portile2", "2.5.3"
|
||||||
|
|
||||||
|
build_gem "net-ftp", "0.1.2"
|
||||||
|
end
|
||||||
|
|
||||||
|
gemfile <<~G
|
||||||
|
source "#{file_uri_for(gem_repo4)}"
|
||||||
|
|
||||||
|
gem "mini_portile2"
|
||||||
|
G
|
||||||
|
|
||||||
|
lockfile <<~L
|
||||||
|
GEM
|
||||||
|
remote: #{file_uri_for(gem_repo4)}/
|
||||||
|
specs:
|
||||||
|
mini_portile2 (2.5.2)
|
||||||
|
net-ftp (~> 0.1)
|
||||||
|
net-ftp (0.1.2)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
#{lockfile_platforms}
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
mini_portile2
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
#{Bundler::VERSION}
|
||||||
|
L
|
||||||
|
end
|
||||||
|
|
||||||
|
it "works" do
|
||||||
|
bundle "outdated", :raise_on_error => false
|
||||||
|
|
||||||
|
expected_output = <<~TABLE.strip
|
||||||
|
Gem Current Latest Requested Groups
|
||||||
|
mini_portile2 2.5.2 2.5.3 >= 0 default
|
||||||
|
TABLE
|
||||||
|
|
||||||
|
expect(out).to end_with(expected_output)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,6 +113,8 @@ RSpec.describe "global gem caching" do
|
||||||
expect(source2_global_cache("rack-0.9.1.gem")).to exist
|
expect(source2_global_cache("rack-0.9.1.gem")).to exist
|
||||||
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
|
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
|
||||||
expect(err).to include("Internal Server Error 500")
|
expect(err).to include("Internal Server Error 500")
|
||||||
|
expect(err).not_to include("please copy and paste the report template above into a new issue")
|
||||||
|
|
||||||
# rack 1.0.0 is not installed and rack 0.9.1 is not
|
# rack 1.0.0 is not installed and rack 0.9.1 is not
|
||||||
expect(the_bundle).not_to include_gems "rack 1.0.0"
|
expect(the_bundle).not_to include_gems "rack 1.0.0"
|
||||||
expect(the_bundle).not_to include_gems "rack 0.9.1"
|
expect(the_bundle).not_to include_gems "rack 0.9.1"
|
||||||
|
@ -126,6 +128,8 @@ RSpec.describe "global gem caching" do
|
||||||
expect(source2_global_cache("rack-0.9.1.gem")).to exist
|
expect(source2_global_cache("rack-0.9.1.gem")).to exist
|
||||||
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
|
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
|
||||||
expect(err).to include("Internal Server Error 500")
|
expect(err).to include("Internal Server Error 500")
|
||||||
|
expect(err).not_to include("please copy and paste the report template above into a new issue")
|
||||||
|
|
||||||
# rack 0.9.1 is not installed and rack 1.0.0 is not
|
# rack 0.9.1 is not installed and rack 1.0.0 is not
|
||||||
expect(the_bundle).not_to include_gems "rack 0.9.1"
|
expect(the_bundle).not_to include_gems "rack 0.9.1"
|
||||||
expect(the_bundle).not_to include_gems "rack 1.0.0"
|
expect(the_bundle).not_to include_gems "rack 1.0.0"
|
||||||
|
|
BIN
test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem
Normal file
BIN
test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem
Normal file
Binary file not shown.
|
@ -6,14 +6,12 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
||||||
super
|
super
|
||||||
|
|
||||||
@argv = ARGV.dup
|
@argv = ARGV.dup
|
||||||
@env = ENV.to_hash.clone
|
|
||||||
ENV.delete("BUNDLER_VERSION")
|
|
||||||
@dollar_0 = $0
|
@dollar_0 = $0
|
||||||
|
without_any_upwards_gemfiles
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
ARGV.replace @argv
|
ARGV.replace @argv
|
||||||
ENV.replace @env
|
|
||||||
$0 = @dollar_0
|
$0 = @dollar_0
|
||||||
|
|
||||||
super
|
super
|
||||||
|
|
|
@ -3,6 +3,12 @@ require 'rubygems/test_case'
|
||||||
require 'rubygems/dependency'
|
require 'rubygems/dependency'
|
||||||
|
|
||||||
class TestGemDependency < Gem::TestCase
|
class TestGemDependency < Gem::TestCase
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
|
||||||
|
without_any_upwards_gemfiles
|
||||||
|
end
|
||||||
|
|
||||||
def test_initialize
|
def test_initialize
|
||||||
d = dep "pkg", "> 1.0"
|
d = dep "pkg", "> 1.0"
|
||||||
|
|
||||||
|
|
|
@ -1776,6 +1776,26 @@ gem 'other', version
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_pre_install_checks_malicious_platform_before_eval
|
||||||
|
gem_with_ill_formated_platform = File.expand_path("packages/ill-formatted-platform-1.0.0.10.gem", __dir__)
|
||||||
|
|
||||||
|
installer = Gem::Installer.at(
|
||||||
|
gem_with_ill_formated_platform,
|
||||||
|
:install_dir => @gem_home,
|
||||||
|
:user_install => false,
|
||||||
|
:force => true
|
||||||
|
)
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
e = assert_raise Gem::InstallError do
|
||||||
|
installer.pre_install_checks
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal "x86-mswin32\n system('id > /tmp/nyangawa')# is an invalid platform", e.message
|
||||||
|
assert_empty @ui.output
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_shebang
|
def test_shebang
|
||||||
installer = setup_base_installer
|
installer = setup_base_installer
|
||||||
|
|
||||||
|
|
|
@ -3612,7 +3612,7 @@ Did you mean 'Ruby'?
|
||||||
@m2.validate
|
@m2.validate
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "metadata key too large (129 > 128)", e.message
|
assert_equal "metadata key is too large (129 > 128)", e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3629,7 +3629,7 @@ Did you mean 'Ruby'?
|
||||||
@m2.validate
|
@m2.validate
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "metadata values must be a String", e.message
|
assert_equal "metadata['fail'] value must be a String", e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3646,7 +3646,7 @@ Did you mean 'Ruby'?
|
||||||
@m2.validate
|
@m2.validate
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal "metadata value too large (1025 > 1024)", e.message
|
assert_equal "metadata['fail'] value is too large (1025 > 1024)", e.message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ class TestKernel < Gem::TestCase
|
||||||
@old_path = $:.dup
|
@old_path = $:.dup
|
||||||
|
|
||||||
util_make_gems
|
util_make_gems
|
||||||
|
|
||||||
|
without_any_upwards_gemfiles
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue