ruby-changes:72251
From: nagachika <ko1@a...>
Date: Mon, 20 Jun 2022 18:49:57 +0900 (JST)
Subject: [ruby-changes:72251] 88cdd1a746 (ruby_3_1): Revert "merge revision(s) 5c1b76a3a55afeb07116bbd3492303c6b6cd890d: [Backport #18373]"
https://git.ruby-lang.org/ruby.git/commit/?id=88cdd1a746 From 88cdd1a7460705bed5af6763378b47a12351aecf Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Mon, 20 Jun 2022 18:48:20 +0900 Subject: Revert "merge revision(s) 5c1b76a3a55afeb07116bbd3492303c6b6cd890d: [Backport #18373]" This reverts commit d56b2e8820efd40840443ce3a5d16cff32a090c7. --- tool/rbinstall.rb | 56 +++++++++++++++++++++++++++++++++++++++---------------- version.h | 4 ++-- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index e4cb17c8ed..0b1195e360 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -848,9 +848,6 @@ module RbInstall https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L848 def write_cache_file end - def build_extensions - end - def shebang(bin_file_name) path = File.join(gem_dir, spec.bindir, bin_file_name) first_line = File.open(path, "rb") {|file| file.gets} @@ -933,12 +930,13 @@ install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L930 install_default_gem('ext', srcdir, bindir) end -def load_gemspec(file, base = nil) +def load_gemspec(file, expanded = false) file = File.realpath(file) code = File.read(file, encoding: "utf-8:-") code.gsub!(/(?:`git[^\`]*`|%x\[git[^\]]*\])\.split\([^\)]*\)/m) do files = [] - if base + 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)) @@ -951,7 +949,7 @@ def load_gemspec(file, base = nil) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L949 unless Gem::Specification === spec raise TypeError, "[#{file}] isn't a Gem::Specification (#{spec.class} instead)." end - spec.loaded_from = base ? File.join(base, File.basename(file)) : file + spec.loaded_from = file spec.files.reject! {|n| n.end_with?(".gemspec") or n.start_with?(".git")} spec @@ -1006,6 +1004,20 @@ def install_default_gem(dir, srcdir, bindir) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L1004 end install?(:ext, :comm, :gem, :'bundled-gems') do + if CONFIG['CROSS_COMPILING'] == 'yes' + # The following hacky steps set "$ruby = BASERUBY" in tool/fake.rb + $hdrdir = '' + $extmk = nil + $ruby = nil # ... + ruby_path = $ruby + " -I#{Dir.pwd}" # $baseruby + " -I#{Dir.pwd}" + else + # ruby_path = File.expand_path(with_destdir(File.join(bindir, ruby_install_name))) + ENV['RUBYLIB'] = nil + ENV['RUBYOPT'] = nil + ruby_path = File.expand_path(with_destdir(File.join(bindir, ruby_install_name))) + " --disable=gems -I#{with_destdir(archlibdir)}" + end + Gem.instance_variable_set(:@ruby, ruby_path) if Gem.ruby != ruby_path + gem_dir = Gem.default_dir install_dir = with_destdir(gem_dir) prepare "bundled gems", gem_dir @@ -1025,28 +1037,40 @@ install?(:ext, :comm, :gem, :'bundled-gems') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L1037 :wrappers => true, :format_executable => true, } - - extensions_dir = Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir - specifications_dir = File.join(gem_dir, "specifications") - build_dir = Gem::StubSpecification.gemspec_stub("", ".bundle", ".bundle").extensions_dir + gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}" + extensions_dir = with_destdir(Gem::StubSpecification.gemspec_stub("", gem_dir, gem_dir).extensions_dir) File.foreach("#{srcdir}/gems/bundled_gems") do |name| next if /^\s*(?:#|$)/ =~ name next unless /^(\S+)\s+(\S+).*/ =~ name gem_name = "#$1-#$2" - path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec" - next unless File.exist?(path) - spec = load_gemspec(path, "#{srcdir}/.bundle/gems/#{gem_name}") + 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 + if !spec.extensions.empty? && CONFIG["EXTSTATIC"] == "static" + puts "skip installation of #{spec.name} #{spec.version}; bundled gem with an extension library is not supported on --with-static-linked-ext" + next + end spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" + if File.directory?(ext = "#{gem_ext_dir}/#{spec.full_name}") + spec.extensions[0] ||= "-" + end package = RbInstall::DirPackage.new spec ins = RbInstall::UnpackedInstaller.new(package, options) puts "#{INDENT}#{spec.name} #{spec.version}" ins.install - install_recursive("#{build_dir}/#{gem_name}", "#{extensions_dir}/#{gem_name}") do |src, dest| - # puts "#{INDENT} #{dest[extensions_dir.size+gem_name.size+2..-1]}" - install src, dest, :mode => (File.executable?(src) ? $prog_mode : $data_mode) + unless $dryrun + File.chmod($data_mode, File.join(install_dir, "specifications", "#{spec.full_name}.gemspec")) + end + unless spec.extensions.empty? + install_recursive(ext, spec.extension_dir) end installed_gems[spec.full_name] = true end diff --git a/version.h b/version.h index 0cfe3f6c38..e25d52630c 100644 --- a/version.h +++ b/version.h @@ -11,11 +11,11 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L11 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 3 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 36 +#define RUBY_PATCHLEVEL 37 #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_DAY 20 #include "ruby/version.h" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/