diff options
author | David RodrÃguez <[email protected]> | 2022-12-24 20:42:50 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2022-12-25 05:55:36 +0900 |
commit | 8f05e4f54bdb3bcf05574bd5f12e56f7e010c8a2 (patch) | |
tree | f84580ebe619c61036604163ca17aa33a141fda2 | |
parent | 3cbe37bd357464c0ce665770998b691cad022a24 (diff) |
Update Bundler to 2.4.1 & and RubyGems to 3.4.1
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7020
-rw-r--r-- | lib/bundler/resolver.rb | 11 | ||||
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 31 | ||||
-rw-r--r-- | lib/bundler/version.rb | 2 | ||||
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rwxr-xr-x | libexec/bundle | 2 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/git_spec.rb | 1 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/platform_spec.rb | 20 | ||||
-rw-r--r-- | spec/bundler/lock/git_spec.rb | 36 | ||||
-rw-r--r-- | tool/bundler/dev_gems.rb.lock | 2 | ||||
-rw-r--r-- | tool/bundler/rubocop_gems.rb.lock | 2 | ||||
-rw-r--r-- | tool/bundler/standard_gems.rb.lock | 2 | ||||
-rw-r--r-- | tool/bundler/test_gems.rb.lock | 2 |
12 files changed, 91 insertions, 22 deletions
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index a2d4820d58..6037148294 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -311,7 +311,16 @@ module Bundler def prepare_dependencies(requirements, packages) to_dependency_hash(requirements, packages).map do |dep_package, dep_constraint| name = dep_package.name - next if dep_package.platforms.empty? + + # If a dependency is scoped to a platform different from the current + # one, we ignore it. However, it may reappear during resolution as a + # transitive dependency of another package, so we need to reset the + # package so the proper versions are considered if reintroduced later. + if dep_package.platforms.empty? + @packages.delete(name) + next + end + next [dep_package, dep_constraint] if name == "bundler" next [dep_package, dep_constraint] unless versions_for(dep_package, dep_constraint.range).empty? next unless dep_package.current_platform? diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 7133e260a0..2a7c8473f5 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -58,6 +58,7 @@ module Bundler @explicit_ref = branch || tag || ref @revision = revision @git = git + @commit_ref = nil end def revision @@ -116,7 +117,7 @@ module Bundler end end - git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination + git "fetch", "--force", "--quiet", *extra_fetch_args, :dir => destination if @commit_ref git "reset", "--hard", @revision, :dir => destination @@ -185,11 +186,16 @@ module Bundler end def refspec - return ref if pinned_to_full_sha? + commit = pinned_to_full_sha? ? ref : @revision - ref_to_fetch = @revision || fully_qualified_ref + if commit + @commit_ref = "refs/#{commit}-sha" + return "#{commit}:#{@commit_ref}" + end + + reference = fully_qualified_ref - ref_to_fetch ||= if ref.include?("~") + reference ||= if ref.include?("~") ref.split("~").first elsif ref.start_with?("refs/") ref @@ -197,7 +203,7 @@ module Bundler "refs/*" end - "#{ref_to_fetch}:#{ref_to_fetch}" + "#{reference}:#{reference}" end def fully_qualified_ref @@ -218,10 +224,6 @@ module Bundler ref =~ /\A\h{40}\z/ end - def legacy_locked_revision? - [email protected]? && @revision =~ /\A\h{7}\z/ - end - def git_null(*command, dir: nil) check_allowed(command) @@ -241,9 +243,9 @@ module Bundler out, err, status = capture(command, dir) - Bundler.ui.warn err unless err.empty? + raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, err) unless status.success? - raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, out) unless status.success? + Bundler.ui.warn err unless err.empty? out end @@ -344,9 +346,10 @@ module Bundler end def extra_clone_args - return [] if full_clone? + args = depth_args + return [] if args.empty? - args = ["--depth", depth.to_s, "--single-branch"] + args += ["--single-branch"] args.unshift("--no-tags") if supports_cloning_with_no_tags? args += ["--branch", branch || tag] if branch || tag @@ -361,7 +364,7 @@ module Bundler def extra_fetch_args extra_args = [path.to_s, *depth_args] - extra_args.push(revision) unless legacy_locked_revision? + extra_args.push(@commit_ref) extra_args end diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 29f78a03c4..70e317089c 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.4.0".freeze + VERSION = "2.4.1".freeze def self.bundler_major_version @bundler_major_version ||= VERSION.split(".").first.to_i diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 56e47ca351..f6c92d52ab 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require "rbconfig" module Gem - VERSION = "3.4.0".freeze + VERSION = "3.4.1".freeze end # Must be first since it unloads the prelude from 1.9.2 diff --git a/libexec/bundle b/libexec/bundle index 77b77d8ef8..eaf2246bc0 100755 --- a/libexec/bundle +++ b/libexec/bundle @@ -15,7 +15,7 @@ else require "bundler" end -if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("3.0.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"] +if Gem.rubygems_version < Gem::Version.new("3.2.3") && Gem.ruby_version < Gem::Version.new("2.7.a") && !ENV["BUNDLER_NO_OLD_RUBYGEMS_WARNING"] Bundler.ui.warn \ "Your RubyGems version (#{Gem::VERSION}) has a bug that prevents " \ "`required_ruby_version` from working for Bundler. Any scripts that use " \ diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb index 6a9532332c..3f386f65f4 100644 --- a/spec/bundler/install/gemfile/git_spec.rb +++ b/spec/bundler/install/gemfile/git_spec.rb @@ -193,6 +193,7 @@ RSpec.describe "bundle install with git sources" do gem "foo" end G + expect(err).to be_empty run <<-RUBY require 'foo' diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index 69918cf9f9..e9cf0cb636 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -572,6 +572,26 @@ RSpec.describe "bundle install with platform conditionals" do #{Bundler::VERSION} L end + + it "resolves fine when a dependency is unused on a platform different from the current one, but reintroduced transitively" do + bundle "config set --local force_ruby_platform true" + + build_repo4 do + build_gem "listen", "3.7.1" do |s| + s.add_dependency "ffi" + end + + build_gem "ffi", "1.15.5" + end + + install_gemfile <<~G + source "#{file_uri_for(gem_repo4)}" + + gem "listen" + gem "ffi", :platform => :windows + G + expect(err).to be_empty + end end RSpec.describe "when a gem has no architecture" do diff --git a/spec/bundler/lock/git_spec.rb b/spec/bundler/lock/git_spec.rb index dfcbb645b1..a633bd546e 100644 --- a/spec/bundler/lock/git_spec.rb +++ b/spec/bundler/lock/git_spec.rb @@ -90,6 +90,42 @@ RSpec.describe "bundle lock with git gems" do expect(err).to be_empty end + it "properly fetches a git source locked to an annotated tag" do + # Create an annotated tag + git("tag -a v1.0 -m 'Annotated v1.0'", lib_path("foo-1.0")) + annotated_tag = git("rev-parse v1.0", lib_path("foo-1.0")) + + gemfile <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'foo', :git => "#{lib_path("foo-1.0")}" + G + + lockfile <<-L + GIT + remote: #{lib_path("foo-1.0")} + revision: #{annotated_tag} + specs: + foo (1.0) + + GEM + remote: #{file_uri_for(gem_repo1)}/ + specs: + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + foo! + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "install" + + expect(err).to be_empty + end + it "provides correct #full_gem_path" do run <<-RUBY puts Bundler.rubygems.find_name('foo').first.full_gem_path diff --git a/tool/bundler/dev_gems.rb.lock b/tool/bundler/dev_gems.rb.lock index 07b6d302ca..0e266cdcb5 100644 --- a/tool/bundler/dev_gems.rb.lock +++ b/tool/bundler/dev_gems.rb.lock @@ -54,4 +54,4 @@ DEPENDENCIES webrick (~> 1.6) BUNDLED WITH - 2.4.0 + 2.4.1 diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock index e2831aebb3..00300554d0 100644 --- a/tool/bundler/rubocop_gems.rb.lock +++ b/tool/bundler/rubocop_gems.rb.lock @@ -70,4 +70,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.4.0 + 2.4.1 diff --git a/tool/bundler/standard_gems.rb.lock b/tool/bundler/standard_gems.rb.lock index a84bdd7619..aaeae355d9 100644 --- a/tool/bundler/standard_gems.rb.lock +++ b/tool/bundler/standard_gems.rb.lock @@ -78,4 +78,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.4.0 + 2.4.1 diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock index d961ab9f76..4918f113ae 100644 --- a/tool/bundler/test_gems.rb.lock +++ b/tool/bundler/test_gems.rb.lock @@ -42,4 +42,4 @@ DEPENDENCIES webrick (= 1.7.0) BUNDLED WITH - 2.4.0 + 2.4.1 |