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

ruby-changes:71660

From: Nobuyoshi <ko1@a...>
Date: Thu, 7 Apr 2022 09:47:27 +0900 (JST)
Subject: [ruby-changes:71660] bb0a22a8c0 (master): Obey spec file locations to rubygems

https://git.ruby-lang.org/ruby.git/commit/?id=bb0a22a8c0

From bb0a22a8c05994396aa316c242ff8816d8d0a259 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 6 Apr 2022 22:57:01 +0900
Subject: Obey spec file locations to rubygems

---
 common.mk          | 3 ++-
 defs/gmake.mk      | 2 +-
 tool/gem-unpack.rb | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/common.mk b/common.mk
index 7c552cba1e..b4adb2729c 100644
--- a/common.mk
+++ b/common.mk
@@ -1360,10 +1360,11 @@ extract-gems$(gnumake:yes=-nongnumake): PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1360
 	$(Q) $(RUNRUBY) -C "$(srcdir)" \
 	    -Itool -rfileutils -rgem-unpack -answ \
 	    -e 'BEGIN {FileUtils.mkdir_p(d = ".bundle/gems")}' \
+	    -e 'BEGIN {FileUtils.mkdir_p(s = ".bundle/specifications")}' \
 	    -e 'gem, ver = *$$F' \
 	    -e 'next if !ver or /^#/=~gem' \
 	    -e 'g = "#{gem}-#{ver}"' \
-	    -e 'File.directory?("#{d}/#{g}") or Gem.unpack("gems/#{g}.gem", d)' \
+	    -e 'File.directory?("#{d}/#{g}") or Gem.unpack("gems/#{g}.gem", d, s)' \
 	    -e 'FileUtils.rm_rf("#{d}/#{g}/.github")' \
 	    gems/bundled_gems
 
diff --git a/defs/gmake.mk b/defs/gmake.mk
index a625379a68..27e3e21cc4 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -295,7 +295,7 @@ extract-gems: | $(patsubst %,.bundle/gems/%,$(bundled-gems)) https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L295
 	$(ECHO) Extracting bundle gem $*...
 	$(Q) $(BASERUBY) -C "$(srcdir)" \
 	    -Itool -rgem-unpack \
-	    -e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems")'
+	    -e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems", ".bundle/specifications")'
 	$(RMALL) "$(srcdir)/$(@:.gem=)/".git*
 
 $(srcdir)/.bundle/gems:
diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb
index cb05719463..fe10b0e420 100644
--- a/tool/gem-unpack.rb
+++ b/tool/gem-unpack.rb
@@ -5,13 +5,14 @@ require 'rubygems/package' https://github.com/ruby/ruby/blob/trunk/tool/gem-unpack.rb#L5
 # This library is used by "make extract-gems" to
 # unpack bundled gem files.
 
-def Gem.unpack(file, dir = nil)
+def Gem.unpack(file, dir = nil, spec_dir = nil)
   pkg = Gem::Package.new(file)
   spec = pkg.spec
   target = spec.full_name
   target = File.join(dir, target) if dir
   pkg.extract_files target
-  spec_file = File.join(target, "#{spec.name}-#{spec.version}.gemspec")
+  FileUtils.mkdir_p(spec_dir ||= target)
+  spec_file = File.join(spec_dir, "#{spec.name}-#{spec.version}.gemspec")
   open(spec_file, 'wb') do |f|
     f.print spec.to_ruby
   end
-- 
cgit v1.2.1


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

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