diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-11-22 20:32:19 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2022-11-22 21:50:22 +0900 |
commit | 14704023ec57546b1bed85d54f4f425986385ab4 (patch) | |
tree | dbf1b3479c60dcb6a4bf71eb464b85a2ab080e54 | |
parent | b102175b4dcfebe7455e3b27653fab0288f68326 (diff) |
Merge RubyGems-3.3.26 and Bundler-2.3.26
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/man/bundle-clean.1 | 2 | ||||
-rw-r--r-- | lib/bundler/man/bundle-clean.1.ronn | 2 | ||||
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 22 | ||||
-rw-r--r-- | lib/bundler/version.rb | 2 | ||||
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/ext/cargo_builder.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/platform_spec.rb | 75 | ||||
-rw-r--r-- | spec/bundler/support/hax.rb | 5 | ||||
-rw-r--r-- | spec/bundler/support/helpers.rb | 8 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock | 8 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml | 2 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock | 8 | ||||
-rw-r--r-- | test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml | 2 | ||||
-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 |
18 files changed, 133 insertions, 19 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 3ba4d0f8c4..c5edfadd37 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -620,7 +620,7 @@ module Bundler method_option "dry-run", :type => :boolean, :default => false, :banner => "Only print out changes, do not clean gems" method_option "force", :type => :boolean, :default => false, :banner => - "Forces clean even if --path is not set" + "Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application." def clean require_relative "cli/clean" Clean.new(options.dup).run diff --git a/lib/bundler/man/bundle-clean.1 b/lib/bundler/man/bundle-clean.1 index f89ae3a1b0..27e249cb64 100644 --- a/lib/bundler/man/bundle-clean.1 +++ b/lib/bundler/man/bundle-clean.1 @@ -20,5 +20,5 @@ Print the changes, but do not clean the unused gems\. . .TP \fB\-\-force\fR -Force a clean even if \fB\-\-path\fR is not set\. +Forces cleaning up unused gems even if Bundler is configured to use globally installed gems\. As a consequence, removes all system gems except for the ones in the current application\. diff --git a/lib/bundler/man/bundle-clean.1.ronn b/lib/bundler/man/bundle-clean.1.ronn index de23991782..dae27c21ee 100644 --- a/lib/bundler/man/bundle-clean.1.ronn +++ b/lib/bundler/man/bundle-clean.1.ronn @@ -15,4 +15,4 @@ useful when you have made many changes to your gem dependencies. * `--dry-run`: Print the changes, but do not clean the unused gems. * `--force`: - Force a clean even if `--path` is not set. + Forces cleaning up unused gems even if Bundler is configured to use globally installed gems. As a consequence, removes all system gems except for the ones in the current application. diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index d53d688009..12d6789065 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -308,6 +308,28 @@ module Gem end end + # On universal Rubies, resolve the "universal" arch to the real CPU arch, without changing the extension directory. + class Specification + if /^universal\.(?<arch>.*?)-/ =~ (CROSS_COMPILING || RUBY_PLATFORM) + local_platform = Platform.local + if local_platform.cpu == "universal" + ORIGINAL_LOCAL_PLATFORM = local_platform.to_s.freeze + + local_platform.cpu = if arch == "arm64e" # arm64e is only permitted for Apple system binaries + "arm64" + else + arch + end + + def extensions_dir + Gem.default_ext_dir_for(base_dir) || + File.join(base_dir, "extensions", ORIGINAL_LOCAL_PLATFORM, + Gem.extension_api_version) + end + end + end + end + require "rubygems/util" Util.singleton_class.module_eval do diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 953e62c610..4957902683 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module Bundler - VERSION = "2.3.25".freeze + VERSION = "2.3.26".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 8a70822890..bad8e80d0d 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require "rbconfig" module Gem - VERSION = "3.3.25".freeze + VERSION = "3.3.26".freeze end # Must be first since it unloads the prelude from 1.9.2 diff --git a/lib/rubygems/ext/cargo_builder.rb b/lib/rubygems/ext/cargo_builder.rb index e33b07a8a2..24c1d3ae6e 100644 --- a/lib/rubygems/ext/cargo_builder.rb +++ b/lib/rubygems/ext/cargo_builder.rb @@ -37,6 +37,7 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder def build_env build_env = rb_config_env build_env["RUBY_STATIC"] = "true" if ruby_static? && ENV.key?("RUBY_STATIC") + build_env["RUSTFLAGS"] = "#{ENV["RUSTFLAGS"]} --cfg=rb_sys_gem".strip build_env end @@ -92,6 +93,9 @@ class Gem::Ext::CargoBuilder < Gem::Ext::Builder # run on one that isn't the missing libraries will cause the extension # to fail on start. flags += ["-C", "link-arg=-static-libgcc"] + elsif darwin_target? + # Ventura does not always have this flag enabled + flags += ["-C", "link-arg=-Wl,-undefined,dynamic_lookup"] end flags diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index 1bae0bb371..69918cf9f9 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -75,6 +75,81 @@ RSpec.describe "bundle install across platforms" do expect(the_bundle).to include_gems "platform_specific 1.0 RUBY" end + context "on universal Rubies" do + before do + build_repo4 do + build_gem "darwin_single_arch" do |s| + s.platform = "ruby" + s.write "lib/darwin_single_arch.rb", "DARWIN_SINGLE_ARCH = '1.0 RUBY'" + end + build_gem "darwin_single_arch" do |s| + s.platform = "arm64-darwin" + s.write "lib/darwin_single_arch.rb", "DARWIN_SINGLE_ARCH = '1.0 arm64-darwin'" + end + build_gem "darwin_single_arch" do |s| + s.platform = "x86_64-darwin" + s.write "lib/darwin_single_arch.rb", "DARWIN_SINGLE_ARCH = '1.0 x86_64-darwin'" + end + end + end + + it "pulls in the correct architecture gem" do + lockfile <<-G + GEM + remote: #{file_uri_for(gem_repo4)} + specs: + darwin_single_arch (1.0) + darwin_single_arch (1.0-arm64-darwin) + darwin_single_arch (1.0-x86_64-darwin) + + PLATFORMS + ruby + + DEPENDENCIES + darwin_single_arch + G + + simulate_platform "universal-darwin-21" + simulate_ruby_platform "universal.x86_64-darwin21" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + + gem "darwin_single_arch" + G + + expect(the_bundle).to include_gems "darwin_single_arch 1.0 x86_64-darwin" + end + end + + it "pulls in the correct architecture gem on arm64e macOS Ruby" do + lockfile <<-G + GEM + remote: #{file_uri_for(gem_repo4)} + specs: + darwin_single_arch (1.0) + darwin_single_arch (1.0-arm64-darwin) + darwin_single_arch (1.0-x86_64-darwin) + + PLATFORMS + ruby + + DEPENDENCIES + darwin_single_arch + G + + simulate_platform "universal-darwin-21" + simulate_ruby_platform "universal.arm64e-darwin21" do + install_gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + + gem "darwin_single_arch" + G + + expect(the_bundle).to include_gems "darwin_single_arch 1.0 arm64-darwin" + end + end + end + it "works with gems that have different dependencies" do simulate_platform "java" install_gemfile <<-G diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb index da67e8c5d1..76e3b05ee1 100644 --- a/spec/bundler/support/hax.rb +++ b/spec/bundler/support/hax.rb @@ -1,5 +1,10 @@ # frozen_string_literal: true +if ENV["BUNDLER_SPEC_RUBY_PLATFORM"] + Object.send(:remove_const, :RUBY_PLATFORM) + RUBY_PLATFORM = ENV["BUNDLER_SPEC_RUBY_PLATFORM"] +end + module Gem def self.ruby=(ruby) @ruby = ruby diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index f4ee93ccc0..45eafec1bf 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -437,6 +437,14 @@ module Spec pristine_system_gems :bundler end + def simulate_ruby_platform(ruby_platform) + old = ENV["BUNDLER_SPEC_RUBY_PLATFORM"] + ENV["BUNDLER_SPEC_RUBY_PLATFORM"] = ruby_platform.to_s + yield + ensure + ENV["BUNDLER_SPEC_RUBY_PLATFORM"] = old + end + def simulate_platform(platform) old = ENV["BUNDLER_SPEC_PLATFORM"] ENV["BUNDLER_SPEC_PLATFORM"] = platform.to_s diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock index aa975b1cd0..08c97618fd 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock @@ -160,18 +160,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.35" +version = "0.9.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2bde30824a18f2e68cd1c8004cec16656764c6efc385bc1c7fb4c904b276a5" +checksum = "5ba942b6777ea18ded013b267023a9c98994557e6539e43740de9e75084cb124" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.35" +version = "0.9.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ff5d3ba92624df9c66bf0d1f0251d96284f08ac9773b7723d370e3f225c1d38" +checksum = "d35109e1a11ef8d1a988db242ab2ba2e80170f9f5a28f88ab30184a2cea8e09b" dependencies = [ "bindgen", "linkify", diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml index 6673f78464..8175b5ae2e 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -rb-sys = { version = "0.9.35", features = ["gem"] } +rb-sys = "0.9.37" diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock index e7e91de576..eb71f25570 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock @@ -153,18 +153,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.35" +version = "0.9.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2bde30824a18f2e68cd1c8004cec16656764c6efc385bc1c7fb4c904b276a5" +checksum = "5ba942b6777ea18ded013b267023a9c98994557e6539e43740de9e75084cb124" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.35" +version = "0.9.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ff5d3ba92624df9c66bf0d1f0251d96284f08ac9773b7723d370e3f225c1d38" +checksum = "d35109e1a11ef8d1a988db242ab2ba2e80170f9f5a28f88ab30184a2cea8e09b" dependencies = [ "bindgen", "linkify", diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml index 814afe10f7..766346757d 100644 --- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" crate-type = ["cdylib"] [dependencies] -rb-sys = { version = "0.9.35", features = ["gem"] } +rb-sys = "0.9.37" diff --git a/tool/bundler/dev_gems.rb.lock b/tool/bundler/dev_gems.rb.lock index 6f72e5da0e..c8a579f539 100644 --- a/tool/bundler/dev_gems.rb.lock +++ b/tool/bundler/dev_gems.rb.lock @@ -53,4 +53,4 @@ DEPENDENCIES webrick (~> 1.6) BUNDLED WITH - 2.3.25 + 2.3.26 diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock index c7b7650364..340401c037 100644 --- a/tool/bundler/rubocop_gems.rb.lock +++ b/tool/bundler/rubocop_gems.rb.lock @@ -65,4 +65,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.3.25 + 2.3.26 diff --git a/tool/bundler/standard_gems.rb.lock b/tool/bundler/standard_gems.rb.lock index 5188bfe7e7..6b2bd27544 100644 --- a/tool/bundler/standard_gems.rb.lock +++ b/tool/bundler/standard_gems.rb.lock @@ -71,4 +71,4 @@ DEPENDENCIES test-unit BUNDLED WITH - 2.3.25 + 2.3.26 diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock index e89903027f..1cf409b372 100644 --- a/tool/bundler/test_gems.rb.lock +++ b/tool/bundler/test_gems.rb.lock @@ -43,4 +43,4 @@ DEPENDENCIES webrick (= 1.7.0) BUNDLED WITH - 2.3.25 + 2.3.26 |