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

ruby-changes:69670

From: Jun <ko1@a...>
Date: Tue, 9 Nov 2021 21:21:49 +0900 (JST)
Subject: [ruby-changes:69670] d713b602ea (master): [rubygems/rubygems] Fix assert_contains_make_command on make defined by environment variable.

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

From d713b602eaf798b2b429347a772dc7268ce063be Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@r...>
Date: Fri, 15 Oct 2021 13:47:32 +0200
Subject: [rubygems/rubygems] Fix assert_contains_make_command on make defined
 by environment variable.

The `parse_make_command_line` in `assert_contains_make_command` fails to get
the make targets correctly, when the make command is set with make options by
environment variable such as `export make='make -j2'` at
lib/rubygems/ext/builder.rb::make.

So, we include the make options (eg, -XX) as a part of the command to fix the
case. Note that this commit still doesn't fix the case of
`export make='make -j 2'`.

https://github.com/rubygems/rubygems/commit/7730ef3fa0
---
 test/rubygems/helper.rb                        |  4 ++--
 test/rubygems/test_gem_ext_ext_conf_builder.rb | 10 +++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index 3c4f09a37ff..d7f4796b8a8 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -246,7 +246,7 @@ class Gem::TestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/helper.rb#L246
   end
 
   def parse_make_command_line(line)
-    command, *args = line.shellsplit
+    args = line.sub(/^#{Regexp.escape make_command}/, "").shellsplit
 
     targets = []
     macros = {}
@@ -263,7 +263,7 @@ class Gem::TestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/helper.rb#L263
     targets << '' if targets.empty?
 
     {
-      :command => command,
+      :command => make_command,
       :targets => targets,
       :macros => macros,
     }
diff --git a/test/rubygems/test_gem_ext_ext_conf_builder.rb b/test/rubygems/test_gem_ext_ext_conf_builder.rb
index 70833f35cfc..10a544cbbc4 100644
--- a/test/rubygems/test_gem_ext_ext_conf_builder.rb
+++ b/test/rubygems/test_gem_ext_ext_conf_builder.rb
@@ -66,8 +66,11 @@ class TestGemExtExtConfBuilder < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_ext_ext_conf_builder.rb#L66
     end
   end
 
-  def test_class_build_env_make
-    env_make = ENV.delete 'MAKE'
+  def test_class_build_env_MAKE
+    env_make = ENV.delete 'make'
+    ENV['make'] = nil
+
+    env_MAKE = ENV.delete 'MAKE'
     ENV['MAKE'] = 'anothermake'
 
     if java_platform?
@@ -89,7 +92,8 @@ class TestGemExtExtConfBuilder < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_ext_ext_conf_builder.rb#L92
       assert_contains_make_command 'clean', output[4]
     end
   ensure
-    ENV['MAKE'] = env_make
+    ENV['MAKE'] = env_MAKE
+    ENV['make'] = env_make
   end
 
   def test_class_build_extconf_fail
-- 
cgit v1.2.1


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

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