diff options
Diffstat (limited to 'lang/ruby30/files/patch-tool_rbinstall.rb')
-rw-r--r-- | lang/ruby30/files/patch-tool_rbinstall.rb | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/lang/ruby30/files/patch-tool_rbinstall.rb b/lang/ruby30/files/patch-tool_rbinstall.rb index 9e02a2c30733..18faf8e5f498 100644 --- a/lang/ruby30/files/patch-tool_rbinstall.rb +++ b/lang/ruby30/files/patch-tool_rbinstall.rb @@ -1,6 +1,6 @@ ---- tool/rbinstall.rb.orig 2020-10-02 17:47:07 UTC +--- tool/rbinstall.rb.orig 2020-12-08 09:02:31 UTC +++ tool/rbinstall.rb -@@ -864,147 +864,6 @@ end +@@ -864,164 +864,6 @@ end # :startdoc: @@ -11,16 +11,28 @@ - install_default_gem('ext', srcdir) -end - --def load_gemspec(file) +-def load_gemspec(file, expanded = false) - file = File.realpath(file) - code = File.read(file, encoding: "utf-8:-") -- code.gsub!(/`git.*?`/m, '""') -- code.gsub!(/%x\[git.*?\]/m, '""') +- code.gsub!(/(?:`git[^\`]*`|%x\[git[^\]]*\])\.split\([^\)]*\)/m) do +- files = [] +- if expanded +- base = File.dirname(file) +- Dir.glob("**/*", File::FNM_DOTMATCH, base: base) do |n| +- case File.basename(n); when ".", ".."; next; end +- next if File.directory?(File.join(base, n)) +- files << n.dump +- end +- end +- "[" + files.join(", ") + "]" +- end - spec = eval(code, binding, file) - unless Gem::Specification === spec - raise TypeError, "[#{file}] isn't a Gem::Specification (#{spec.class} instead)." - end - spec.loaded_from = file +- spec.files.reject! {|n| n.end_with?(".gemspec") or n.start_with?(".git")} +- - spec -end - @@ -93,9 +105,14 @@ - next if /^\s*(?:#|$)/ =~ 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) +- path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec" +- if File.exist?(path) +- spec = load_gemspec(path) +- else +- path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec" +- next unless File.exist?(path) +- spec = load_gemspec(path, true) +- end - next unless spec.platform == Gem::Platform::RUBY - next unless spec.full_name == gem_name - spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" |