summaryrefslogtreecommitdiff
path: root/tool/rbinstall.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-23 17:59:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-25 20:40:36 +0900
commit55bf0ef1aa7c936b564b883196de1ace4be4cc7e (patch)
tree1155ca1dd1e1fbefae098f9ab272712070a9fa76 /tool/rbinstall.rb
parenta504535dd4044bc8b2daf73076e01028da5ad58a (diff)
Share extracted bundled gems with gems for bundler
Extract bundled gems under ".bundle/gems" and get rid of duplication which cause constant redefinition warnings at `test-all` after `extract-gems` and `test-bundler`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2922
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-xtool/rbinstall.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 341adbf765..a9b6b9b179 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -878,11 +878,14 @@ install?(:ext, :comm, :gem, :'bundled-gems') do
}
gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir
- dirs = Gem::Util.glob_files_in_dir "*/", "#{srcdir}/gems"
- Gem::Specification.each_gemspec(dirs) do |path|
+ File.foreach("#{srcdir}/gems/bundled_gems") do |name|
+ next unless /^(\S+)\s+(S+).*/ =~ name
+ gem_name = "#$1-#$2"
+ path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec"
+ next unless File.exist?(path)
spec = load_gemspec(path)
next unless spec.platform == Gem::Platform::RUBY
- next unless spec.full_name == path[srcdir.size..-1][/\A\/gems\/([^\/]+)/, 1]
+ next unless spec.full_name == gem_name
spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"
if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}")
spec.extensions[0] ||= "-"