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

ruby-changes:74182

From: nagachika <ko1@a...>
Date: Fri, 21 Oct 2022 17:18:15 +0900 (JST)
Subject: [ruby-changes:74182] e9be76dc69 (ruby_3_1): merge revision(s) 44a0a66559ee4a03a84c27feca05e9b1b0f59df8:

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

From e9be76dc6937f15be8e6473cf726f395b749a7a7 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@r...>
Date: Fri, 21 Oct 2022 16:23:21 +0900
Subject: merge revision(s) 44a0a66559ee4a03a84c27feca05e9b1b0f59df8:

	Move to tool/lib/bundled_gem.rb

	---
	 common.mk               |  6 +++---
	 defs/gmake.mk           |  4 ++--
	 tool/gem-unpack.rb      | 53 -----------------------------------------------
	 tool/lib/bundled_gem.rb | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
	 4 files changed, 60 insertions(+), 58 deletions(-)
	 delete mode 100644 tool/gem-unpack.rb
	 create mode 100644 tool/lib/bundled_gem.rb
---
 common.mk               |  6 +++---
 defs/gmake.mk           |  4 ++--
 tool/gem-unpack.rb      | 53 -----------------------------------------------
 tool/lib/bundled_gem.rb | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
 version.h               |  2 +-
 5 files changed, 61 insertions(+), 59 deletions(-)
 delete mode 100644 tool/gem-unpack.rb
 create mode 100644 tool/lib/bundled_gem.rb

diff --git a/common.mk b/common.mk
index c3a5bfe7ce..9c693c295b 100644
--- a/common.mk
+++ b/common.mk
@@ -1368,16 +1368,16 @@ update-gems$(gnumake:yes=-sequential): PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1368
 extract-gems$(gnumake:yes=-sequential): PHONY
 	$(ECHO) Extracting bundled gem files...
 	$(Q) $(RUNRUBY) -C "$(srcdir)" \
-	    -Itool -rfileutils -rgem-unpack -answ \
+	    -Itool/lib -rfileutils -rbundled_gem -answ \
 	    -e 'BEGIN {FileUtils.mkdir_p(d = ".bundle/gems")}' \
 	    -e 'gem, ver, _, rev = *$$F' \
 	    -e 'next if !ver or /^#/=~gem' \
 	    -e 'g = "#{gem}-#{ver}"' \
 	    -e 'if File.directory?("#{d}/#{g}")' \
 	    -e 'elsif rev and File.exist?(gs = "gems/src/#{gem}/#{gem}.gemspec")' \
-	    -e   'Gem.copy(gs, ".bundle")' \
+	    -e   'BundledGem.copy(gs, ".bundle")' \
 	    -e 'else' \
-	    -e   'Gem.unpack("gems/#{g}.gem", ".bundle")' \
+	    -e   'BundledGem.unpack("gems/#{g}.gem", ".bundle")' \
 	    -e 'end' \
 	    -e 'FileUtils.rm_rf("#{d}/#{g}/.github")' \
 	    gems/bundled_gems
diff --git a/defs/gmake.mk b/defs/gmake.mk
index 1b395d60be..e0bcfc1c8d 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -297,8 +297,8 @@ extract-gems: | $(patsubst %,.bundle/gems/%,$(bundled-gems)) https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L297
 .bundle/gems/%: gems/%.gem | .bundle/gems
 	$(ECHO) Extracting bundle gem $*...
 	$(Q) $(BASERUBY) -C "$(srcdir)" \
-	    -Itool -rgem-unpack \
-	    -e 'Gem.unpack("gems/$(@F).gem", ".bundle")'
+	    -Itool/lib -rbundled_gem \
+	    -e 'BundledGem.unpack("gems/$(@F).gem", ".bundle")'
 	$(RMALL) "$(srcdir)/$(@:.gem=)/".git*
 
 $(srcdir)/.bundle/gems:
diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb
deleted file mode 100644
index 6310c3f92a..0000000000
--- a/tool/gem-unpack.rb
+++ /dev/null
@@ -1,53 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L0
-require 'fileutils'
-require 'rubygems'
-require 'rubygems/package'
-
-# This library is used by "make extract-gems" to
-# unpack bundled gem files.
-
-class << Gem
-  def unpack(file, *rest)
-    pkg = Gem::Package.new(file)
-    prepare_test(pkg.spec, *rest) {|dir| pkg.extract_files(dir)}
-    puts "Unpacked #{file}"
-  end
-
-  def copy(path, *rest)
-    spec = Gem::Specification.load(path)
-    path = File.dirname(path)
-    prepare_test(spec, *rest) do |dir|
-      FileUtils.rm_rf(dir)
-      files = spec.files.reject {|f| f.start_with?(".git")}
-      dirs = files.map {|f| File.dirname(f) if f.include?("/")}.uniq
-      FileUtils.mkdir_p(dirs.map {|d| d ? "#{dir}/#{d}" : dir}.sort_by {|d| d.count("/")})
-      files.each do |f|
-        File.copy_stream(File.join(path, f), File.join(dir, f))
-      end
-    end
-    puts "Copied #{path}"
-  end
-
-  def prepare_test(spec, dir = ".")
-    target = spec.full_name
-    Gem.ensure_gem_subdirectories(dir)
-    gem_dir = File.join(dir, "gems", target)
-    yield gem_dir
-    spec_dir = spec.extensions.empty? ? "specifications" : File.join("gems", target)
-    File.binwrite(File.join(dir, spec_dir, "#{target}.gemspec"), spec.to_ruby)
-    unless spec.extensions.empty?
-      spec.dependencies.clear
-      File.binwrite(File.join(dir, spec_dir, ".bundled.#{target}.gemspec"), spec.to_ruby)
-    end
-    if spec.bindir and spec.executables
-      bindir = File.join(dir, "bin")
-      Dir.mkdir(bindir) rescue nil
-      spec.executables.each do |exe|
-        File.open(File.join(bindir, exe), "wb", 0o777) {|f|
-          f.print "#!ruby\n",
-                  %[load File.realpath("../gems/#{target}/#{spec.bindir}/#{exe}", __dir__)\n]
-        }
-      end
-    end
-    FileUtils.rm_rf(Dir.glob("#{gem_dir}/.git*"))
-  end
-end
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
new file mode 100644
index 0000000000..0b7d52b86a
--- /dev/null
+++ b/tool/lib/bundled_gem.rb
@@ -0,0 +1,55 @@ https://github.com/ruby/ruby/blob/trunk/tool/lib/bundled_gem.rb#L1
+require 'fileutils'
+require 'rubygems'
+require 'rubygems/package'
+
+# This library is used by "make extract-gems" to
+# unpack bundled gem files.
+
+module BundledGem
+  module_function
+
+  def unpack(file, *rest)
+    pkg = Gem::Package.new(file)
+    prepare_test(pkg.spec, *rest) {|dir| pkg.extract_files(dir)}
+    puts "Unpacked #{file}"
+  end
+
+  def copy(path, *rest)
+    spec = Gem::Specification.load(path)
+    path = File.dirname(path)
+    prepare_test(spec, *rest) do |dir|
+      FileUtils.rm_rf(dir)
+      files = spec.files.reject {|f| f.start_with?(".git")}
+      dirs = files.map {|f| File.dirname(f) if f.include?("/")}.uniq
+      FileUtils.mkdir_p(dirs.map {|d| d ? "#{dir}/#{d}" : dir}.sort_by {|d| d.count("/")})
+      files.each do |f|
+        File.copy_stream(File.join(path, f), File.join(dir, f))
+      end
+    end
+    puts "Copied #{path}"
+  end
+
+  def prepare_test(spec, dir = ".")
+    target = spec.full_name
+    Gem.ensure_gem_subdirectories(dir)
+    gem_dir = File.join(dir, "gems", target)
+    yield gem_dir
+    spec_dir = spec.extensions.empty? ? "specifications" : File.join("gems", target)
+    File.binwrite(File.join(dir, spec_dir, "#{target}.gemspec"), spec.to_ruby)
+    unless spec.extensions.empty?
+      spec.dependencies.clear
+      File.binwrite(File.join(dir, spec_dir, ".bundled.#{target}.gemspec"), spec.to_ruby)
+    end
+    if spec.bindir and spec.executables
+      bindir = File.join(dir, "bin")
+      Dir.mkdir(bindir) rescue nil
+      spec.executables.each do |exe|
+        File.open(File.join(bindir, exe), "wb", 0o777) {|f|
+          f.print "#!ruby\n",
+                  %[load File.realpath("../gems/#{target}/#{spec.bindir}/#{exe}", __dir__)\n]
+        }
+      end
+    end
+    FileUtils.rm_rf(Dir.glob("#{gem_dir}/.git*"))
+  end
+end
diff --git a/version.h b/version.h
index 2255c186d4..01935eed0e 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@ 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 150
+#define RUBY_PATCHLEVEL 151
 
 #define RUBY_RELEASE_YEAR 2022
 #define RUBY_RELEASE_MONTH 10
-- 
cgit v1.2.3


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

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