From dde3aa0083713c3dbd10c6df3f617613cc7dbf2e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 16 Feb 2024 15:39:36 +0900 Subject: [PATCH 1/3] Try to load original gemspec from `.bundle/gems/foo-x.y.z/foo.gemspec`. `.bundle/specification/foo-x.y.z.gemspec` may be changed our toolchain --- tool/rbinstall.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 97fe1eab45ded0..605c2c2cfa9855 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -1088,12 +1088,13 @@ def install_default_gem(dir, srcdir, bindir) next if /^\s*(?:#|$)/ =~ name next unless /^(\S+)\s+(\S+).*/ =~ name gem_name = "#$1-#$2" - # Try to find the gemspec file for C ext gems - # ex .bundle/gems/debug-1.7.1/debug-1.7.1.gemspec - # This gemspec keep the original dependencies - path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec" + # Try to find the gemspec file + path = "#{srcdir}/.bundle/gems/#{gem_name}/#{name}.gemspec" unless File.exist?(path) - path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec" + # Try to find the gemspec file for C ext gems + # ex .bundle/gems/debug-1.7.1/debug-1.7.1.gemspec + # This gemspec keep the original dependencies + path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec" unless File.exist?(path) skipped[gem_name] = "gemspec not found" next From 5b4e25a0abe626df406bef033f1f11bbe9813252 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 16 Feb 2024 16:33:25 +0900 Subject: [PATCH 2/3] Try to find gemspec from `.bundle/specifications --- tool/rbinstall.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 605c2c2cfa9855..db9c7b372ef180 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -1087,17 +1087,22 @@ def install_default_gem(dir, srcdir, bindir) File.foreach("#{srcdir}/gems/bundled_gems") do |name| next if /^\s*(?:#|$)/ =~ name next unless /^(\S+)\s+(\S+).*/ =~ name + gem = $1 gem_name = "#$1-#$2" - # Try to find the gemspec file - path = "#{srcdir}/.bundle/gems/#{gem_name}/#{name}.gemspec" + # Try to find the original gemspec file + path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem}.gemspec" unless File.exist?(path) # Try to find the gemspec file for C ext gems # ex .bundle/gems/debug-1.7.1/debug-1.7.1.gemspec # This gemspec keep the original dependencies path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec" unless File.exist?(path) - skipped[gem_name] = "gemspec not found" - next + # Try to find the gemspec file for gems that hasn't own gemspec + path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec" + unless File.exist?(path) + skipped[gem_name] = "gemspec not found" + next + end end end spec = load_gemspec(path, "#{srcdir}/.bundle/gems/#{gem_name}") From 33c12d7ce4c2df9690ad6dd7fd5e224c835da757 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 16 Feb 2024 17:57:38 +0900 Subject: [PATCH 3/3] Adjust indent --- tool/rbinstall.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index db9c7b372ef180..bb2e6a293c8d9d 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -1097,12 +1097,12 @@ def install_default_gem(dir, srcdir, bindir) # This gemspec keep the original dependencies path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec" unless File.exist?(path) - # Try to find the gemspec file for gems that hasn't own gemspec - path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec" - unless File.exist?(path) - skipped[gem_name] = "gemspec not found" - next - end + # Try to find the gemspec file for gems that hasn't own gemspec + path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec" + unless File.exist?(path) + skipped[gem_name] = "gemspec not found" + next + end end end spec = load_gemspec(path, "#{srcdir}/.bundle/gems/#{gem_name}")