1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Make dependency-free gemspec files

The default gems have not been installed yet in the build directory,
bundled gems depending on them can not work.  As those dependencies
should be usable there even without rubygems, make temporary gemspec
files without the dependencies, and use them in the build directory.
This commit is contained in:
Nobuyoshi Nakada 2022-07-13 18:58:32 +09:00
parent e1a4e44f14
commit a2c66f52f4
Notes: git 2022-07-14 09:00:40 +09:00
2 changed files with 15 additions and 0 deletions

View file

@ -565,6 +565,17 @@ clean-so::
end
}
if @gemname
gemdir = File.join($top_srcdir, ext_prefix, @gemname)
if File.exist?(spec_file = File.join(gemdir, ".bundled.#{@gemname}.gemspec")) or
File.exist?(spec_file = File.join(gemdir, "#{@gemname}.gemspec"))
dest = "#{File.dirname(ext_prefix)}/specifications"
FileUtils.mkdir_p(dest)
File.copy_stream(spec_file, "#{dest}/#{@gemname}.gemspec")
puts "copied #{@gemname}.gemspec"
end
end
dir = Dir.pwd
FileUtils::makedirs(ext_prefix)
Dir::chdir(ext_prefix)

View file

@ -18,5 +18,9 @@ def Gem.unpack(file, dir = nil, spec_dir = nil)
end
FileUtils.mkdir_p(spec_dir)
File.binwrite(File.join(spec_dir, "#{spec.name}-#{spec.version}.gemspec"), spec.to_ruby)
unless spec.extensions.empty? or spec.dependencies.empty?
spec.dependencies.clear
end
File.binwrite(File.join(spec_dir, ".bundled.#{spec.name}-#{spec.version}.gemspec"), spec.to_ruby)
puts "Unpacked #{file}"
end