[DRE-commits] [SCM] ohai.git branch, master, updated. upstream/0.6.10-22-g2e61ced

Antonio Terceiro terceiro at debian.org
Fri Apr 13 12:25:46 UTC 2012


The following commit has been merged in the master branch:
commit 16c2bf73c3d31715d6cb03d671bd2969f25221b9
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Fri Apr 13 08:20:11 2012 -0300

    Add patch sent upstream to fix tests of ruby plugin

diff --git a/debian/patches/Obtain-Ruby-plugin-test-data-from-system-ruby b/debian/patches/Obtain-Ruby-plugin-test-data-from-system-ruby
new file mode 100644
index 0000000..356e370
--- /dev/null
+++ b/debian/patches/Obtain-Ruby-plugin-test-data-from-system-ruby
@@ -0,0 +1,67 @@
+Description: Obtain Ruby plugin test data from system ruby
+ This fixes the tests for the case where `ruby` is not the same Ruby
+ interpreter as the one you are running the tests against. For example, the
+ `ruby` in yout $PATH might be Ruby 1.8, but you are running the tests under
+ Ruby 1.9 (or vice-versa).
+Author: Antonio Terceiro <terceiro at softwarelivre.org>
+Bug: http://tickets.opscode.com/browse/OHAI-332
+
+--- ohai-0.6.12.orig/spec/ohai/plugins/ruby_spec.rb
++++ ohai-0.6.12/spec/ohai/plugins/ruby_spec.rb
+@@ -18,8 +18,7 @@
+ 
+ require 'rubygems'
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
+-
+-ruby_bin = File.join(::Config::CONFIG['bindir'], ::Config::CONFIG['ruby_install_name'])
++require 'tempfile'
+ 
+ describe Ohai::System, "plugin ruby" do
+ 
+@@ -36,23 +35,34 @@ describe Ohai::System, "plugin ruby" do
+     @ruby_ohai_data = @ruby_ohai_data_pristine.dup
+   end
+ 
+-  {
++  code = <<-EOS
++  ruby_bin = File.join(::RbConfig::CONFIG['bindir'], ::RbConfig::CONFIG['ruby_install_name'])
++  data = {
+     :platform => RUBY_PLATFORM,
+     :version => RUBY_VERSION,
+     :release_date => RUBY_RELEASE_DATE,
+-    :target => ::Config::CONFIG['target'],
+-    :target_cpu => ::Config::CONFIG['target_cpu'],
+-    :target_vendor => ::Config::CONFIG['target_vendor'],
+-    :target_os => ::Config::CONFIG['target_os'],
+-    :host => ::Config::CONFIG['host'],
+-    :host_cpu => ::Config::CONFIG['host_cpu'],
+-    :host_os => ::Config::CONFIG['host_os'],
+-    :host_vendor => ::Config::CONFIG['host_vendor'],
+-    :gems_dir => %x{#{ruby_bin} #{::Config::CONFIG['bindir']}/gem env gemdir}.chomp!,
+-    :gem_bin => [ ::Gem.default_exec_format % 'gem', 'gem' ].map{|bin| "#{::Config::CONFIG['bindir']}/#{bin}"
++    :target => ::RbConfig::CONFIG['target'],
++    :target_cpu => ::RbConfig::CONFIG['target_cpu'],
++    :target_vendor => ::RbConfig::CONFIG['target_vendor'],
++    :target_os => ::RbConfig::CONFIG['target_os'],
++    :host => ::RbConfig::CONFIG['host'],
++    :host_cpu => ::RbConfig::CONFIG['host_cpu'],
++    :host_os => ::RbConfig::CONFIG['host_os'],
++    :host_vendor => ::RbConfig::CONFIG['host_vendor'],
++    :gems_dir => %x{\#{ruby_bin} \#{::RbConfig::CONFIG['bindir']}/gem env gemdir}.chomp!,
++    :gem_bin => [ ::Gem.default_exec_format % 'gem', 'gem' ].map{|bin| "\#{::RbConfig::CONFIG['bindir']}/\#{bin}"
+       }.find{|bin| ::File.exists? bin},
+     :ruby_bin => ruby_bin
+-  }.each do |attribute, value|
++  }
++  puts data.inspect
++  EOS
++  program = Tempfile.new('ruby')
++  program.write(code)
++  program.close
++  data = eval(`ruby #{program.path}`)
++  program.unlink
++
++  data.each do |attribute, value|
+     it "should have #{attribute} set" do
+       @ruby_ohai_data[attribute].should eql(value)
+     end
diff --git a/debian/patches/series b/debian/patches/series
index e3c7330..4893040 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 Missing-require-rubygems.patch
+Obtain-Ruby-plugin-test-data-from-system-ruby

-- 
ohai.git



More information about the Pkg-ruby-extras-commits mailing list