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

ruby-changes:29583

From: nagachika <ko1@a...>
Date: Wed, 26 Jun 2013 02:55:47 +0900 (JST)
Subject: [ruby-changes:29583] nagachika:r41635 (ruby_2_0_0): merge revision(s) 41629: [Backport #8533]

nagachika	2013-06-26 02:55:32 +0900 (Wed, 26 Jun 2013)

  New Revision: 41635

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41635

  Log:
    merge revision(s) 41629: [Backport #8533]
    
    * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Pass
      DESTDIR via command line to override what's in MAKEFLAGS.  This
      fixes an installation problem under a package building
      environment where DESTDIR is specified in the (parent) command
      line. [Fixes GH-327]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/rubygems/ext/builder.rb
    branches/ruby_2_0_0/lib/rubygems/test_case.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb
    branches/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41634)
+++ ruby_2_0_0/ChangeLog	(revision 41635)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Wed Jun 26 02:25:52 2013  Akinori MUSHA  <knu@i...>
+
+	* lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Pass
+	  DESTDIR via command line to override what's in MAKEFLAGS.  This
+	  fixes an installation problem under a package building
+	  environment where DESTDIR is specified in the (parent) command
+	  line. [Fixes GH-327]
+
 Tue Jun 25 00:12:19 2013  Zachary Scott  <zachary@z...>
 
 	* array.c: Return value in Array overview example found by @PragTob
Index: ruby_2_0_0/lib/rubygems/ext/builder.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/ext/builder.rb	(revision 41634)
+++ ruby_2_0_0/lib/rubygems/ext/builder.rb	(revision 41635)
@@ -23,9 +23,14 @@ class Gem::Ext::Builder https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/ext/builder.rb#L23
       make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
     end
 
-    ['', ' install'].each do |target|
-      cmd = "#{make_program}#{target}"
-      run(cmd, results, "make#{target}")
+    ['', 'install'].each do |target|
+      # Pass DESTDIR via command line to override what's in MAKEFLAGS
+      cmd = [
+        make_program,
+        '"DESTDIR=%s"' % ENV['DESTDIR'],
+        target
+      ].join(' ').rstrip
+      run(cmd, results, "make #{target}".rstrip)
     end
   end
 
Index: ruby_2_0_0/lib/rubygems/test_case.rb
===================================================================
--- ruby_2_0_0/lib/rubygems/test_case.rb	(revision 41634)
+++ ruby_2_0_0/lib/rubygems/test_case.rb	(revision 41635)
@@ -28,6 +28,7 @@ require 'rubygems/test_utilities' https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/test_case.rb#L28
 require 'pp'
 require 'zlib'
 require 'pathname'
+require 'shellwords'
 Gem.load_yaml
 
 require 'rubygems/mock_gem_ui'
@@ -89,6 +90,63 @@ class Gem::TestCase < MiniTest::Unit::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/rubygems/test_case.rb#L90
     refute File.exist?(path), msg
   end
 
+  def scan_make_command_lines(output)
+    output.scan(/^#{Regexp.escape make_command}(?:[[:blank:]].*)?$/)
+  end
+
+  def parse_make_command_line(line)
+    command, *args = line.shellsplit
+
+    targets = []
+    macros = {}
+
+    args.each do |arg|
+      case arg
+      when /\A(\w+)=/
+        macros[$1] = $'
+      else
+        targets << arg
+      end
+    end
+
+    targets << '' if targets.empty?
+
+    {
+      :command => command,
+      :targets => targets,
+      :macros => macros,
+    }
+  end
+
+  def assert_contains_make_command(target, output, msg = nil)
+    if output.match(/\n/)
+      msg = message(msg) {
+        'Expected output containing make command "%s": %s' % [
+          ('%s %s' % [make_command, target]).rstrip,
+          output.inspect
+        ]
+      }
+    else
+      msg = message(msg) {
+        'Expected make command "%s": %s' % [
+          ('%s %s' % [make_command, target]).rstrip,
+          output.inspect
+        ]
+      }
+    end
+
+    assert scan_make_command_lines(output).any? { |line|
+      make = parse_make_command_line(line)
+
+      if make[:targets].include?(target)
+        yield make, line if block_given?
+        true
+      else
+        false
+      end
+    }, msg
+  end
+
   include Gem::DefaultUserInteraction
 
   undef_method :default_test if instance_methods.include? 'default_test' or
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41634)
+++ ruby_2_0_0/version.h	(revision 41635)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-06-25"
-#define RUBY_PATCHLEVEL 241
+#define RUBY_RELEASE_DATE "2013-06-26"
+#define RUBY_PATCHLEVEL 242
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 6
-#define RUBY_RELEASE_DAY 25
+#define RUBY_RELEASE_DAY 26
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb	(revision 41634)
+++ ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb	(revision 41635)
@@ -30,9 +30,9 @@ class TestGemExtConfigureBuilder < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb#L30
 
     assert_equal "sh ./configure --prefix=#{@dest_path}", output.shift
     assert_equal "", output.shift
-    assert_equal make_command, output.shift
+    assert_contains_make_command '', output.shift
     assert_match(/^ok$/m, output.shift)
-    assert_equal make_command + " install", output.shift
+    assert_contains_make_command 'install', output.shift
     assert_match(/^ok$/m, output.shift)
   end
 
@@ -76,8 +76,8 @@ class TestGemExtConfigureBuilder < Gem:: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_configure_builder.rb#L76
       Gem::Ext::ConfigureBuilder.build nil, nil, @dest_path, output
     end
 
-    assert_equal make_command, output[0]
-    assert_equal "#{make_command} install", output[2]
+    assert_contains_make_command '', output[0]
+    assert_contains_make_command 'install', output[2]
   end
 
 end
Index: ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 41634)
+++ ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb	(revision 41635)
@@ -32,14 +32,8 @@ class TestGemExtExtConfBuilder < Gem::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb#L32
 
     assert_match(/^#{Gem.ruby} extconf.rb/, output[0])
     assert_equal "creating Makefile\n", output[1]
-    case RUBY_PLATFORM
-    when /mswin/ then
-      assert_equal "nmake", output[2]
-      assert_equal "nmake install", output[4]
-    else
-      assert_equal "make", output[2]
-      assert_equal "make install", output[4]
-    end
+    assert_contains_make_command '', output[2]
+    assert_contains_make_command 'install', output[4]
   end
 
   def test_class_build_rbconfig_make_prog
@@ -56,8 +50,8 @@ class TestGemExtExtConfBuilder < Gem::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb#L50
     end
 
     assert_equal "creating Makefile\n", output[1]
-    assert_equal make_command, output[2]
-    assert_equal "#{make_command} install", output[4]
+    assert_contains_make_command '', output[2]
+    assert_contains_make_command 'install', output[4]
   ensure
     RbConfig::CONFIG['configure_args'] = configure_args
   end
@@ -80,7 +74,7 @@ class TestGemExtExtConfBuilder < Gem::Te https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb#L74
     end
 
     assert_equal "creating Makefile\n", output[1]
-    assert_equal "anothermake", output[2]
+    assert_contains_make_command '', output[2]
   ensure
     RbConfig::CONFIG['configure_args'] = configure_args
     ENV['make'] = env_make
@@ -132,8 +126,8 @@ checking for main\(\) in .*?nonexistent/ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_ext_conf_builder.rb#L126
       Gem::Ext::ExtConfBuilder.make @ext, output
     end
 
-    assert_equal make_command, output[0]
-    assert_equal "#{make_command} install", output[2]
+    assert_contains_make_command '', output[0]
+    assert_contains_make_command 'install', output[2]
   end
 
   def test_class_make_no_Makefile
Index: ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb
===================================================================
--- ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb	(revision 41634)
+++ ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb	(revision 41635)
@@ -38,8 +38,8 @@ install (FILES test.txt DESTINATION bin) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb#L38
     assert_match \
       %r%^cmake \. -DCMAKE_INSTALL_PREFIX=#{Regexp.escape @dest_path}%, output
     assert_match %r%#{Regexp.escape @ext}%, output
-    assert_match %r%^#{Regexp.escape make_command}$%, output
-    assert_match %r%^#{Regexp.escape make_command} install$%, output
+    assert_contains_make_command '', output
+    assert_contains_make_command 'install', output
     assert_match %r%test\.txt%, output
   end
 
@@ -82,8 +82,8 @@ install (FILES test.txt DESTINATION bin) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/rubygems/test_gem_ext_cmake_builder.rb#L82
 
     output = output.join "\n"
 
-    assert_match %r%^#{make_command}%,         output
-    assert_match %r%^#{make_command} install%, output
+    assert_contains_make_command '', output
+    assert_contains_make_command 'install', output
   end
 
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41629


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

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