diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2023-09-07 11:43:28 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-09-21 18:28:54 +0000 |
commit | e9ed0b3068f54f32d5116ff9d73833d96229fde9 (patch) | |
tree | 3189be7899beb572cbe39d899c3fcfa87f0477af /spec | |
parent | 02fa2acbde50f282409346544844182e9a25cc6b (diff) | |
download | ruby-e9ed0b3068f54f32d5116ff9d73833d96229fde9.tar.gz |
[rubygems/rubygems] Stop bundler eagerly loading all specs with exts
We were setting the wrong `extension_dir` for git specs stubs
Additionally, the call to `self.extension_dir` was loading the
remote spec, which was avoidable since the stub had an extension dir
(and in fact its #gem_build_complete_path does exactly what we want
anyway)
Finally, now set the base_dir when loading the remote_spec from a
stub specification, since the git source sets the base dir for stubs
based on where the spec _will_ be installed to, and we want to preserve
that so the base_dir for the loaded spec & the stub are the same
https://github.com/rubygems/rubygems/commit/a94acb465b
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/runtime/setup_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index f02f81f697..5be9c49fef 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -728,6 +728,27 @@ end R run <<-R + File.open(File.join(Gem.dir, "specifications", "broken-ext.gemspec"), "w") do |f| + f.write <<-RUBY +# -*- encoding: utf-8 -*- +# stub: broken-ext 1.0.0 ruby lib +# stub: a.ext\\0b.ext + +Gem::Specification.new do |s| + s.name = "broken-ext" + s.version = "1.0.0" + raise "BROKEN GEMSPEC EXT" +end + RUBY + end + # Need to write the gem.build_complete file, + # otherwise the full spec is loaded to check the installed_by_version + extensions_dir = Gem.default_ext_dir_for(Gem.dir) || File.join(Gem.dir, "extensions", Gem::Platform.local.to_s, Gem.extension_api_version) + Bundler::FileUtils.mkdir_p(File.join(extensions_dir, "broken-ext-1.0.0")) + File.open(File.join(extensions_dir, "broken-ext-1.0.0", "gem.build_complete"), "w") {} + R + + run <<-R puts "WIN" R |