[DRE-commits] [ruby-bson] 04/06: Revert "drop all patches"

Prach Pongpanich prach-guest at moszumanska.debian.org
Thu May 15 05:20:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

prach-guest pushed a commit to branch master
in repository ruby-bson.

commit 5626726c5fbac6bc69a6d26b5aadfd59f52d6fd8
Author: Prach Pongpanich <prachpub at gmail.com>
Date:   Thu May 15 09:29:14 2014 +0700

    Revert "drop all patches"
    
    This reverts commit 1d3b2d56327fb8a803bc39435c70ba412b88495e.
---
 debian/patches/add_require_rbconfig.patch         |  15 ++
 debian/patches/add_test_helper.patch              | 212 ++++++++++++++++++++++
 debian/patches/add_to_bson_code.patch             |  19 ++
 debian/patches/change_require_activesupport.patch |  17 ++
 debian/patches/clean_test_helper.patch            | 195 ++++++++++++++++++++
 debian/patches/remove_rubygems_from_bins.patch    |  48 +++++
 debian/patches/series                             |   6 +
 7 files changed, 512 insertions(+)

diff --git a/debian/patches/add_require_rbconfig.patch b/debian/patches/add_require_rbconfig.patch
new file mode 100644
index 0000000..87741d1
--- /dev/null
+++ b/debian/patches/add_require_rbconfig.patch
@@ -0,0 +1,15 @@
+Description: add missing requirement on rbconfig
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://jira.mongodb.org/browse/RUBY-570
+Last-Updated: 2013-03-20
+ 
+--- a/test/bson/bson_test.rb
++++ b/test/bson/bson_test.rb
+@@ -1,6 +1,7 @@
+ # encoding:utf-8
+ require 'test_helper'
+ require 'set'
++require 'rbconfig'
+ 
+ if RUBY_VERSION < '1.9'
+   silently do
diff --git a/debian/patches/add_test_helper.patch b/debian/patches/add_test_helper.patch
new file mode 100644
index 0000000..0e788e1
--- /dev/null
+++ b/debian/patches/add_test_helper.patch
@@ -0,0 +1,212 @@
+Description: add full test_helper from MondoDB github repo
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://jira.mongodb.org/browse/RUBY-570
+Last-Updated: 2013-03-20
+
+--- /dev/null
++++ b/test/test_helper.rb
+@@ -0,0 +1,204 @@
++require 'rubygems'
++# SimpleCov must load before our code - A coverage report summary line will print after each test suite
++if RUBY_VERSION >= '1.9.0' && RUBY_ENGINE == 'ruby'
++  if ENV.key?('COVERAGE')
++    require 'simplecov'
++    SimpleCov.start do
++      add_group "Mongo", 'lib/mongo'
++      add_group "BSON", 'lib/bson'
++      add_filter "/test/"
++      merge_timeout 3600
++      command_name ENV['SIMPLECOV_COMMAND_NAME'] if ENV.has_key?('SIMPLECOV_COMMAND_NAME')
++    end
++  end
++end
++gem 'test-unit' # Do NOT remove this line - gem version is needed for Test::Unit::TestCase.shutdown
++require 'test/unit'
++require 'tools/mongo_config'
++
++class Test::Unit::TestCase
++
++  TEST_DATA = File.join(File.dirname(__FILE__), 'data')
++
++  def ensure_cluster(kind=nil, opts={})
++    @@cluster ||= nil
++
++    unless @@cluster
++      if kind == :rs
++        cluster_opts = Mongo::Config::DEFAULT_REPLICA_SET.dup
++      else
++        cluster_opts = Mongo::Config::DEFAULT_SHARDED_SIMPLE.dup
++      end
++
++      cluster_opts.merge!(opts)
++
++      dbpath = ENV['DBPATH'] || 'data'
++      cluster_opts.merge!(:dbpath => dbpath)
++
++      #debug 1, opts
++      config = Mongo::Config.cluster(cluster_opts)
++      #debug 1, config
++      @@cluster = Mongo::Config::ClusterManager.new(config)
++
++      Test::Unit::TestCase.class_eval do
++        @@force_shutdown = false
++
++        def self.shutdown
++          if @@force_shutdown || /rake_test_loader/ !~ $0
++            @@cluster.stop
++            @@cluster.clobber
++          end
++        end
++      end
++    end
++
++    @@cluster.start
++    instance_variable_set("@#{kind}", @@cluster)
++  end
++
++  # Generic code for rescuing connection failures and retrying operations.
++  # This could be combined with some timeout functionality.
++  def rescue_connection_failure(max_retries=30)
++    retries = 0
++    begin
++      yield
++    rescue Mongo::ConnectionFailure => ex
++      #puts "Rescue attempt #{retries}: from #{ex}"
++      retries += 1
++      raise ex if retries > max_retries
++      sleep(2)
++      retry
++    end
++  end
++end
++
++def silently
++  warn_level = $VERBOSE
++  $VERBOSE = nil
++  begin
++    result = yield
++  ensure
++    $VERBOSE = warn_level
++  end
++  result
++end
++
++begin
++  silently { require 'shoulda' }
++  silently { require 'mocha/setup' }
++rescue LoadError
++  puts <<MSG
++
++This test suite requires shoulda and mocha.
++You can install them as follows:
++  gem install shoulda
++  gem install mocha
++
++MSG
++  exit
++end
++
++unless defined? MONGO_TEST_DB
++  MONGO_TEST_DB = 'ruby-test-db'
++end
++
++unless defined? TEST_PORT
++  TEST_PORT = ENV['MONGO_RUBY_DRIVER_PORT'] ? ENV['MONGO_RUBY_DRIVER_PORT'].to_i : Mongo::MongoClient::DEFAULT_PORT
++end
++
++unless defined? TEST_HOST
++  TEST_HOST = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
++end
++
++class Test::Unit::TestCase
++  include Mongo
++  include BSON
++
++  def self.standard_connection(options={}, legacy=false)
++    if legacy
++      Connection.new(TEST_HOST, TEST_PORT, options)
++    else
++      MongoClient.new(TEST_HOST, TEST_PORT, options)
++    end
++  end
++
++  def standard_connection(options={}, legacy=false)
++    self.class.standard_connection(options, legacy)
++  end
++
++  def self.host_port
++    "#{mongo_host}:#{mongo_port}"
++  end
++
++  def self.mongo_host
++    TEST_HOST
++  end
++
++  def self.mongo_port
++    TEST_PORT
++  end
++
++  def host_port
++    self.class.host_port
++  end
++
++  def mongo_host
++    self.class.mongo_host
++  end
++
++  def mongo_port
++    self.class.mongo_port
++  end
++
++  def method_name
++    caller[0]=~/`(.*?)'/
++    $1
++  end
++
++  def step_down_command
++    # Adding force=true to avoid 'no secondaries within 10 seconds of my optime' errors
++    step_down_command = BSON::OrderedHash.new
++    step_down_command[:replSetStepDown] = 5
++    step_down_command[:force]           = true
++    step_down_command
++  end
++
++  def new_mock_socket(host='localhost', port=27017)
++    socket = Object.new
++    socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
++    socket.stubs(:close)
++    socket.stubs(:closed?)
++    socket.stubs(:checkin)
++    socket.stubs(:pool)
++    socket
++  end
++
++  def new_mock_unix_socket(sockfile='/tmp/mongod.sock')
++    socket = Object.new
++    socket.stubs(:setsockopt).with(Socket::IPPROTO_TCP)
++    socket.stubs(:close)
++    socket.stubs(:closed?)
++    socket
++  end
++
++  def new_mock_db
++    Object.new
++  end
++
++  def assert_raise_error(klass, message=nil)
++    begin
++      yield
++    rescue => e
++      if klass.to_s != e.class.to_s
++        flunk "Expected exception class #{klass} but got #{e.class}.\n #{e.backtrace}"
++      end
++
++      if message && !e.message.include?(message)
++        p e.backtrace
++        flunk "#{e.message} does not include #{message}.\n#{e.backtrace}"
++      end
++    else
++      flunk "Expected assertion #{klass} but none was raised."
++    end
++  end
++end
diff --git a/debian/patches/add_to_bson_code.patch b/debian/patches/add_to_bson_code.patch
new file mode 100644
index 0000000..889c3c5
--- /dev/null
+++ b/debian/patches/add_to_bson_code.patch
@@ -0,0 +1,19 @@
+Description: add code for to_bson_code for Strings, needed for the tests
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://jira.mongodb.org/browse/RUBY-570
+Last-Update: 2013-03-20
+
+--- a/test/bson/bson_test.rb
++++ b/test/bson/bson_test.rb
+@@ -761,3 +761,11 @@
+     end
+   end
+ end
++
++class String
++  def to_bson_code
++    BSON::Code.new(self)
++  end
++end
++
++
diff --git a/debian/patches/change_require_activesupport.patch b/debian/patches/change_require_activesupport.patch
new file mode 100644
index 0000000..005b1aa
--- /dev/null
+++ b/debian/patches/change_require_activesupport.patch
@@ -0,0 +1,17 @@
+Description: require all active_support to ensure all needed classes/modules
+ are defined
+Author: Cédric Boutillier
+Bug: https://jira.mongodb.org/browse/RUBY-570
+Last-Update: 2013-03-20
+
+--- a/test/bson/bson_test.rb
++++ b/test/bson/bson_test.rb
+@@ -29,7 +29,7 @@
+ end
+ 
+ begin
+-  require 'active_support/multibyte/chars'
++  require 'active_support'
+ rescue LoadError
+   warn 'Mocking ActiveSupport::Multibyte::Chars'
+   module ActiveSupport
diff --git a/debian/patches/clean_test_helper.patch b/debian/patches/clean_test_helper.patch
new file mode 100644
index 0000000..edcd31f
--- /dev/null
+++ b/debian/patches/clean_test_helper.patch
@@ -0,0 +1,195 @@
+Description: clean test_helper.rb from stuff not needed for ruby-bson
+Author: Cédric Boutillier <boutil at debian.org>
+Bug: https://jira.mongodb.org/browse/RUBY-570
+Last-Update: 2013-03-20
+
+--- a/test/test_helper.rb
++++ b/test/test_helper.rb
+@@ -1,77 +1,63 @@
+-require 'rubygems'
+-# SimpleCov must load before our code - A coverage report summary line will print after each test suite
+-if RUBY_VERSION >= '1.9.0' && RUBY_ENGINE == 'ruby'
+-  if ENV.key?('COVERAGE')
+-    require 'simplecov'
+-    SimpleCov.start do
+-      add_group "Mongo", 'lib/mongo'
+-      add_group "BSON", 'lib/bson'
+-      add_filter "/test/"
+-      merge_timeout 3600
+-      command_name ENV['SIMPLECOV_COMMAND_NAME'] if ENV.has_key?('SIMPLECOV_COMMAND_NAME')
+-    end
+-  end
+-end
+-gem 'test-unit' # Do NOT remove this line - gem version is needed for Test::Unit::TestCase.shutdown
+ require 'test/unit'
+-require 'tools/mongo_config'
+-
+-class Test::Unit::TestCase
+-
+-  TEST_DATA = File.join(File.dirname(__FILE__), 'data')
+-
+-  def ensure_cluster(kind=nil, opts={})
+-    @@cluster ||= nil
+-
+-    unless @@cluster
+-      if kind == :rs
+-        cluster_opts = Mongo::Config::DEFAULT_REPLICA_SET.dup
+-      else
+-        cluster_opts = Mongo::Config::DEFAULT_SHARDED_SIMPLE.dup
+-      end
+-
+-      cluster_opts.merge!(opts)
+-
+-      dbpath = ENV['DBPATH'] || 'data'
+-      cluster_opts.merge!(:dbpath => dbpath)
+-
+-      #debug 1, opts
+-      config = Mongo::Config.cluster(cluster_opts)
+-      #debug 1, config
+-      @@cluster = Mongo::Config::ClusterManager.new(config)
+-
+-      Test::Unit::TestCase.class_eval do
+-        @@force_shutdown = false
+-
+-        def self.shutdown
+-          if @@force_shutdown || /rake_test_loader/ !~ $0
+-            @@cluster.stop
+-            @@cluster.clobber
+-          end
+-        end
+-      end
+-    end
+-
+-    @@cluster.start
+-    instance_variable_set("@#{kind}", @@cluster)
+-  end
+-
+-  # Generic code for rescuing connection failures and retrying operations.
+-  # This could be combined with some timeout functionality.
+-  def rescue_connection_failure(max_retries=30)
+-    retries = 0
+-    begin
+-      yield
+-    rescue Mongo::ConnectionFailure => ex
+-      #puts "Rescue attempt #{retries}: from #{ex}"
+-      retries += 1
+-      raise ex if retries > max_retries
+-      sleep(2)
+-      retry
+-    end
+-  end
+-end
+-
++require 'bson'
++#require 'tools/mongo_config'
++#
++#class Test::Unit::TestCase
++#
++#  TEST_DATA = File.join(File.dirname(__FILE__), 'data')
++#
++#  def ensure_cluster(kind=nil, opts={})
++#    @@cluster ||= nil
++#
++#    unless @@cluster
++#      if kind == :rs
++#        cluster_opts = Mongo::Config::DEFAULT_REPLICA_SET.dup
++#      else
++#        cluster_opts = Mongo::Config::DEFAULT_SHARDED_SIMPLE.dup
++#      end
++#
++#      cluster_opts.merge!(opts)
++#
++#      dbpath = ENV['DBPATH'] || 'data'
++#      cluster_opts.merge!(:dbpath => dbpath)
++#
++#      #debug 1, opts
++#      config = Mongo::Config.cluster(cluster_opts)
++#      #debug 1, config
++#      @@cluster = Mongo::Config::ClusterManager.new(config)
++#
++#      Test::Unit::TestCase.class_eval do
++#        @@force_shutdown = false
++#
++#        def self.shutdown
++#          if @@force_shutdown || /rake_test_loader/ !~ $0
++#            @@cluster.stop
++#            @@cluster.clobber
++#          end
++#        end
++#      end
++#    end
++#
++#    @@cluster.start
++#    instance_variable_set("@#{kind}", @@cluster)
++#  end
++#
++#  # Generic code for rescuing connection failures and retrying operations.
++#  # This could be combined with some timeout functionality.
++#  def rescue_connection_failure(max_retries=30)
++#    retries = 0
++#    begin
++#      yield
++#    rescue Mongo::ConnectionFailure => ex
++#      #puts "Rescue attempt #{retries}: from #{ex}"
++#      retries += 1
++#      raise ex if retries > max_retries
++#      sleep(2)
++#      retry
++#    end
++#  end
++#end
++#
+ def silently
+   warn_level = $VERBOSE
+   $VERBOSE = nil
+@@ -83,35 +69,23 @@
+   result
+ end
+ 
+-begin
+-  silently { require 'shoulda' }
+-  silently { require 'mocha/setup' }
+-rescue LoadError
+-  puts <<MSG
+-
+-This test suite requires shoulda and mocha.
+-You can install them as follows:
+-  gem install shoulda
+-  gem install mocha
+-
+-MSG
+-  exit
+-end
+-
+-unless defined? MONGO_TEST_DB
+-  MONGO_TEST_DB = 'ruby-test-db'
+-end
+-
+-unless defined? TEST_PORT
+-  TEST_PORT = ENV['MONGO_RUBY_DRIVER_PORT'] ? ENV['MONGO_RUBY_DRIVER_PORT'].to_i : Mongo::MongoClient::DEFAULT_PORT
+-end
+-
+-unless defined? TEST_HOST
+-  TEST_HOST = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
+-end
++require 'shoulda'
++require 'mocha'
++#
++#unless defined? MONGO_TEST_DB
++#  MONGO_TEST_DB = 'ruby-test-db'
++#end
++#
++#unless defined? TEST_PORT
++#  TEST_PORT = ENV['MONGO_RUBY_DRIVER_PORT'] ? ENV['MONGO_RUBY_DRIVER_PORT'].to_i : Mongo::MongoClient::DEFAULT_PORT
++#end
++#
++#unless defined? TEST_HOST
++#  TEST_HOST = ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost'
++#end
+ 
+ class Test::Unit::TestCase
+-  include Mongo
++#  include Mongo
+   include BSON
+ 
+   def self.standard_connection(options={}, legacy=false)
diff --git a/debian/patches/remove_rubygems_from_bins.patch b/debian/patches/remove_rubygems_from_bins.patch
new file mode 100644
index 0000000..df52524
--- /dev/null
+++ b/debian/patches/remove_rubygems_from_bins.patch
@@ -0,0 +1,48 @@
+Description: remove use of and messages about rubygems
+Author: Cédric Boutillier <boutil at debian.org>,
+ Prach Pongpanich <prachpub at gmail.com>
+Forwarded: no
+Last-Updated: 2013-06-11
+--- a/bin/j2bson
++++ b/bin/j2bson
+@@ -15,19 +15,11 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ 
+-require 'rubygems'
+ require 'bson'
+ 
+ # Note that, at the moment, this will not properly round-trip
+ # in all cases from the output generated by b2json.
+-begin
+ require 'json/pure'  # broken with 'json/ext'
+-rescue LoadError
+-  puts "This script requires json/pure. Please install one of the following:"
+-  puts "  gem install json_pure"
+-  puts "  gem install json"
+-  Process.exit
+-end
+ 
+ # Convert all JSON objects in an IO into BSON.
+ def print_j2bson(io)
+--- a/bin/b2json
++++ b/bin/b2json
+@@ -15,18 +15,11 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ 
+-require 'rubygems'
+ require 'bson'
+ 
+ # Note that this will not properly round-trip in all cases
+ # from the output generated by j2bson.
+-begin
+ require 'yajl'
+-rescue LoadError
+-  puts "This script requires yajl. Please install as follows:"
+-  puts "  gem install yajl-ruby"
+-  Process.exit
+-end
+ 
+ # Convert all documents in an IO into JSON.
+ def print_b2json(io)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..b0b3f6e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,6 @@
+#add_test_helper.patch
+#clean_test_helper.patch
+#add_require_rbconfig.patch
+#change_require_activesupport.patch
+#add_to_bson_code.patch
+remove_rubygems_from_bins.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-bson.git



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