ruby-changes:54794
From: nagachika <ko1@a...>
Date: Tue, 5 Feb 2019 21:15:53 +0900 (JST)
Subject: [ruby-changes:54794] nagachika:r67013 (ruby_2_5): merge revision(s) 66867: [Backport #15500]
nagachika 2019-02-05 21:15:47 +0900 (Tue, 05 Feb 2019) New Revision: 67013 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67013 Log: merge revision(s) 66867: [Backport #15500] Revert r58345 and r58371. These changes break the behavior of default gems. Bug #13428 says r58345 is reasonable because gemspec file is installed by `to_ruby_for_cache` method. But I revert `to_ruby_for_cache` in rbinstall.rb at r58403. There is no reason that we apply r58345 now. But I'm not sure about gemspec of default gems affects standalone gems. I'm going to investigate it on rubygems/rubygems. [Bug #15500][ruby-core:90867] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/tool/rbinstall.rb branches/ruby_2_5/version.h Index: ruby_2_5/tool/rbinstall.rb =================================================================== --- ruby_2_5/tool/rbinstall.rb (revision 67012) +++ ruby_2_5/tool/rbinstall.rb (revision 67013) @@ -614,6 +614,69 @@ install?(:local, :comm, :man) do https://github.com/ruby/ruby/blob/trunk/ruby_2_5/tool/rbinstall.rb#L614 end module RbInstall + module Specs + class FileCollector + def initialize(gemspec) + @gemspec = gemspec + @base_dir = File.dirname(gemspec) + end + + def collect + (ruby_libraries + built_libraries).sort + end + + private + def type + /\/(ext|lib)?\/.*?\z/ =~ @base_dir + $1 + end + + def ruby_libraries + case type + when "ext" + prefix = "#{$extout}/common/" + base = "#{prefix}#{relative_base}" + when "lib" + base = @base_dir + prefix = base.sub(/lib\/.*?\z/, "") + "lib/" + end + + if base + Dir.glob("#{base}{.rb,/**/*.rb}").collect do |ruby_source| + remove_prefix(prefix, ruby_source) + end + else + [remove_prefix(File.dirname(@gemspec) + '/', @gemspec.gsub(/gemspec/, 'rb'))] + end + end + + def built_libraries + case type + when "ext" + prefix = "#{$extout}/#{CONFIG['arch']}/" + base = "#{prefix}#{relative_base}" + dlext = CONFIG['DLEXT'] + Dir.glob("#{base}{.#{dlext},/**/*.#{dlext}}").collect do |built_library| + remove_prefix(prefix, built_library) + end + when "lib" + [] + else + [] + end + end + + def relative_base + /\/#{Regexp.escape(type)}\/(.*?)\z/ =~ @base_dir + $1 + end + + def remove_prefix(prefix, string) + string.sub(/\A#{Regexp.escape(prefix)}/, "") + end + end + end + class UnpackedInstaller < Gem::Installer module DirPackage def extract_files(destination_dir, pattern = "*") @@ -703,17 +766,7 @@ install?(:ext, :comm, :gem, :'default-ge https://github.com/ruby/ruby/blob/trunk/ruby_2_5/tool/rbinstall.rb#L766 install_default_gem('lib', srcdir) end install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do - install_default_gem('ext', srcdir) do |path| - # assume that gemspec and extconf.rb are placed in the same directory - success = false - begin - IO.foreach(File.dirname(path[(srcdir.size+1)..-1]) + "/Makefile") do |l| - break success = true if /^TARGET\s*=/ =~ l - end - rescue Errno::ENOENT - end - success - end + install_default_gem('ext', srcdir) end def load_gemspec(file) @@ -740,8 +793,12 @@ def install_default_gem(dir, srcdir) https://github.com/ruby/ruby/blob/trunk/ruby_2_5/tool/rbinstall.rb#L793 makedirs(default_spec_dir) gems = Dir.glob("#{srcdir}/#{dir}/**/*.gemspec").map {|src| - next if block_given? and !yield(src) - load_gemspec(src) + spec = load_gemspec(src) + file_collector = RbInstall::Specs::FileCollector.new(src) + files = file_collector.collect + next if files.empty? + spec.files = files + spec } gems.compact.sort_by(&:name).each do |gemspec| full_name = "#{gemspec.name}-#{gemspec.version}" Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 67012) +++ ruby_2_5/version.h (revision 67013) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.4" -#define RUBY_RELEASE_DATE "2019-01-23" -#define RUBY_PATCHLEVEL 138 +#define RUBY_RELEASE_DATE "2019-02-05" +#define RUBY_PATCHLEVEL 139 #define RUBY_RELEASE_YEAR 2019 -#define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_MONTH 2 +#define RUBY_RELEASE_DAY 5 #include "ruby/version.h" Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 67012) +++ ruby_2_5 (revision 67013) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r66867 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/