[前][次][番号順一覧][スレッド一覧]

ruby-changes:46229

From: nobu <ko1@a...>
Date: Fri, 14 Apr 2017 09:45:53 +0900 (JST)
Subject: [ruby-changes:46229] nobu:r58345 (trunk): rbinstall.rb: no file list for default gems

nobu	2017-04-14 09:45:49 +0900 (Fri, 14 Apr 2017)

  New Revision: 58345

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58345

  Log:
    rbinstall.rb: no file list for default gems
    
    * tool/rbinstall.rb (default-gems): no file list is used now.
      all files should be installed as standard libraries.
      [ruby-core:80667] [Bug #13428]

  Modified files:
    trunk/tool/rbinstall.rb
Index: tool/rbinstall.rb
===================================================================
--- tool/rbinstall.rb	(revision 58344)
+++ tool/rbinstall.rb	(revision 58345)
@@ -608,69 +608,6 @@ install?(:local, :comm, :man) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L608
 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 = "*")
@@ -760,7 +697,12 @@ install?(:ext, :comm, :gem, :'default-ge https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L697
   install_default_gem('lib', srcdir)
 end
 install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do
-  install_default_gem('ext', srcdir)
+  install_default_gem('ext', srcdir) do |path|
+    # assume that gemspec and extconf.rb are placed in the same directory
+    IO.foreach(File.dirname(path[(srcdir.size+1)..-1]) + "/Makefile") do |l|
+      break true if /^TARGET\s*=/ =~ l
+    end
+  end
 end
 
 def load_gemspec(file)
@@ -787,12 +729,8 @@ def install_default_gem(dir, srcdir) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L729
   makedirs(default_spec_dir)
 
   gems = Dir.glob("#{srcdir}/#{dir}/**/*.gemspec").map {|src|
-    spec = load_gemspec(src)
-    file_collector = RbInstall::Specs::FileCollector.new(src)
-    files = file_collector.collect
-    next if files.empty?
-    spec.files = files
-    spec
+    next if block_given? and !yield(src)
+    load_gemspec(src)
   }
   gems.compact.sort_by(&:name).each do |gemspec|
     full_name = "#{gemspec.name}-#{gemspec.version}"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]