ruby-changes:44175
From: rhe <ko1@a...>
Date: Mon, 26 Sep 2016 11:50:35 +0900 (JST)
Subject: [ruby-changes:44175] rhe:r56248 (trunk): rbinstall.rb: don't install gemspec for skipped libraries
rhe 2016-09-26 11:50:31 +0900 (Mon, 26 Sep 2016) New Revision: 56248 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56248 Log: rbinstall.rb: don't install gemspec for skipped libraries * tool/rbinstall.rb (gem): Don't install gemspec if no files will be installed for the gem. This happens when the extension library is not compiled. Modified files: trunk/ChangeLog trunk/tool/rbinstall.rb Index: tool/rbinstall.rb =================================================================== --- tool/rbinstall.rb (revision 56247) +++ tool/rbinstall.rb (revision 56248) @@ -648,21 +648,6 @@ module RbInstall https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L648 string.sub(/\A#{Regexp.escape(prefix)}/, "") end end - - class Reader < Struct.new(:src) - def gemspec - @gemspec ||= begin - spec = Gem::Specification.load(src) || raise("invalid spec in #{src}") - file_collector = FileCollector.new(File.dirname(src)) - spec.files = file_collector.collect - spec - end - end - - def spec_source - @gemspec.to_ruby - end - end end class UnpackedInstaller < Gem::Installer @@ -718,21 +703,21 @@ install?(:ext, :comm, :gem) do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L703 default_spec_dir = "#{spec_dir}/default" makedirs(default_spec_dir) - gems = {} - - Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").each do |src| - specgen = RbInstall::Specs::Reader.new(src) - gems[specgen.gemspec.name] ||= specgen - end - - gems.sort.each do |name, specgen| - gemspec = specgen.gemspec + gems = Dir.glob(srcdir+"/{lib,ext}/**/*.gemspec").map {|src| + spec = Gem::Specification.load(src) || raise("invalid spec in #{src}") + file_collector = RbInstall::Specs::FileCollector.new(File.dirname(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}" puts "#{" "*30}#{gemspec.name} #{gemspec.version}" gemspec_path = File.join(default_spec_dir, "#{full_name}.gemspec") open_for_install(gemspec_path, $data_mode) do - specgen.spec_source + gemspec.to_ruby end unless gemspec.executables.empty? then Index: ChangeLog =================================================================== --- ChangeLog (revision 56247) +++ ChangeLog (revision 56248) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Sep 26 11:50:03 2016 Kazuki Yamaguchi <k@r...> + + * tool/rbinstall.rb (gem): Don't install gemspec if no files will be + installed for the gem. This happens when the extension library is not + compiled. + Mon Sep 26 11:06:47 2016 Kazuki Yamaguchi <k@r...> * string.c (enc_strlen, rb_enc_strlen_cr): Avoid signed integer -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/