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

ruby-changes:62128

From: Nobuyoshi <ko1@a...>
Date: Sun, 5 Jul 2020 19:08:50 +0900 (JST)
Subject: [ruby-changes:62128] 358f91bf6f (master): Skip comment and empty lines in gems/bundled_gems file

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

From 358f91bf6f9999ba4683f702bc47483789bd4e7e Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 5 Jul 2020 18:59:06 +0900
Subject: Skip comment and empty lines in gems/bundled_gems file


diff --git a/common.mk b/common.mk
index 8438089..7e1088c 100644
--- a/common.mk
+++ b/common.mk
@@ -1294,6 +1294,7 @@ update-gems$(gnumake:yes=-nongnumake): PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1294
 	$(Q) $(BASERUBY) -C "$(srcdir)" \
 	    -I./tool -rdownloader -answ \
 	    -e 'gem, ver = *$$F' \
+	    -e 'next if !ver or /^#/=~gem' \
 	    -e 'old = Dir.glob("gems/#{gem}-*.gem")' \
 	    -e 'gem = "#{gem}-#{ver}.gem"' \
 	    -e 'Downloader::RubyGems.download(gem, "gems", nil) and' \
@@ -1308,19 +1309,22 @@ extract-gems$(gnumake:yes=-nongnumake): PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1309
 	    -Itool -rgem-unpack -answ \
 	    -e 'BEGIN {FileUtils.mkdir_p(d = ".bundle/gems")}' \
 	    -e 'gem, ver = *$$F' \
+	    -e 'next if !ver or /^#/=~gem' \
 	    -e 'Gem.unpack("gems/#{gem}-#{ver}.gem", d)' \
 	    gems/bundled_gems
 
 update-bundled_gems: PHONY
 	$(Q) $(RUNRUBY) -rrubygems \
 	    -pla \
+	    -e 'unless /^[^#]/!~(gem=$$F[0])' \
 	    -e '(gem,src), = Gem::SpecFetcher.fetcher.detect(:latest) {'"|s|" \
-	    -e   's.platform=="ruby"&&s.name==$$F[0]' \
+	    -e   's.platform=="ruby"&&s.name==gem' \
 	    -e '}' \
 	    -e 'gem = src.fetch_spec(gem)' \
 	    -e 'uri = gem.metadata["source_code_uri"]||gem.homepage' \
 	    -e 'uri = uri.sub(%r[\Ahttps://github\.com/[^/]+/[^/]+\K/tree/.*], "")' \
 	    -e '$$_ = [gem.name, gem.version, uri].join(" ")' \
+	    -e 'end' \
 	     "$(srcdir)/gems/bundled_gems" | \
 	"$(IFCHANGE)" "$(srcdir)/gems/bundled_gems" -
 
diff --git a/defs/gmake.mk b/defs/gmake.mk
index ba461f8..a04707f 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -248,7 +248,7 @@ HELP_EXTRA_TASKS = \ https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L248
 
 extract-gems: update-gems
 
-BUNDLED_GEMS := $(shell sed 's/[ 	][ 	]*/-/;s/[ 	].*//' $(srcdir)/gems/bundled_gems)
+BUNDLED_GEMS := $(shell sed '/^[ 	]*#/d;/^[ 	]*$$/d;s/[ 	][ 	]*/-/;s/[ 	].*//' $(srcdir)/gems/bundled_gems)
 
 update-gems: | $(patsubst %,gems/%.gem,$(BUNDLED_GEMS))
 
diff --git a/tool/make-snapshot b/tool/make-snapshot
index 79289d6..609f455 100755
--- a/tool/make-snapshot
+++ b/tool/make-snapshot
@@ -502,6 +502,7 @@ touch-unicode-files: https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L502
     if File.exist?("gems/bundled_gems")
       gems = Dir.glob("gems/*.gem")
       gems -= File.readlines("gems/bundled_gems").map {|line|
+        next if /^\s*(?:#|$)/ =~ line
         name, version, _ = line.split(' ')
         "gems/#{name}-#{version}.gem"
       }
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index aadfd41..eb13be9 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -923,6 +923,7 @@ install?(:ext, :comm, :gem, :'bundled-gems') do https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L923
   gem_ext_dir = "#$extout/gems/#{CONFIG['arch']}"
   extensions_dir = 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/gems/#{gem_name}/#$1.gemspec"
diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb
index c7b7ade..5d21311 100644
--- a/tool/test-bundled-gems.rb
+++ b/tool/test-bundled-gems.rb
@@ -9,6 +9,7 @@ gem_dir = File.realpath('../../gems', __FILE__) https://github.com/ruby/ruby/blob/trunk/tool/test-bundled-gems.rb#L9
 exit_code = 0
 ruby = ENV['RUBY'] || RbConfig.ruby
 File.foreach("#{gem_dir}/bundled_gems") do |line|
+  next if /^\s*(?:#|$)/ =~ line
   gem = line.split.first
   puts "\nTesting the #{gem} gem"
 
-- 
cgit v0.10.2


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

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