[DRE-commits] [SCM] ruby-dbi.git branch, master, updated. upstream/0.4.5-4-g19ce14e
Dmitry Borodaenko
angdraug at debian.org
Tue Sep 13 17:14:04 UTC 2011
The following commit has been merged in the master branch:
commit ed4fadac8fa32d907e45401a3d2dcceef8e49292
Author: Dmitry Borodaenko <angdraug at debian.org>
Date: Tue Sep 13 19:57:15 2011 +0300
patches: rubygems, available_drivers, rm bin, deprecated3, ruby1.9
diff --git a/debian/changelog b/debian/changelog
index e1e4fa5..5e27879 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,16 @@ ruby-dbi (0.4.5-1) unstable; urgency=low
- transitional packages added
- source format changed to 3.0 (quilt).
* Redirect watch file to rubygems.org (no 0.4.5 tag on GitHub).
-
- -- Dmitry Borodaenko <angdraug at debian.org> Sat, 10 Sep 2011 17:55:42 +0300
+ * New patches:
+ - remove usage of rubygems
+ - don't test for all drivers to be installed during build
+ - don't install dbi and test_broken_dbi executables
+ - include GitHub pull request #8 to use ruby-deprecated 3.0.0
+ (Closes: #631849, #631851)
+ - include GitHub pull request #7 Ruby 1.9 compatibility fixes
+ (Closes: #596103, #637794).
+
+ -- Dmitry Borodaenko <angdraug at debian.org> Tue, 13 Sep 2011 19:56:23 +0300
libdbi-ruby (0.4.3-3) unstable; urgency=low
diff --git a/debian/patches/0001-remove-usage-of-rubygems.patch b/debian/patches/0001-remove-usage-of-rubygems.patch
new file mode 100644
index 0000000..efaea34
--- /dev/null
+++ b/debian/patches/0001-remove-usage-of-rubygems.patch
@@ -0,0 +1,43 @@
+From: Dmitry Borodaenko <angdraug at debian.org>
+Date: Tue, 13 Sep 2011 17:53:16 +0300
+Subject: remove usage of rubygems
+
+---
+ lib/dbi.rb | 6 ------
+ lib/dbi/columninfo.rb | 6 ------
+ 2 files changed, 0 insertions(+), 12 deletions(-)
+
+diff --git a/lib/dbi.rb b/lib/dbi.rb
+index 39a5ed7..9d0877f 100644
+--- a/lib/dbi.rb
++++ b/lib/dbi.rb
+@@ -35,12 +35,6 @@ module DBI; end
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #
+
+-begin
+- require "rubygems"
+- gem "deprecated", "= 2.0.1"
+-rescue LoadError
+-end
+-
+ #
+ # NOTE see the end of the file for requires that live in the DBI namespace.
+ #
+diff --git a/lib/dbi/columninfo.rb b/lib/dbi/columninfo.rb
+index bf01fef..cfff97b 100644
+--- a/lib/dbi/columninfo.rb
++++ b/lib/dbi/columninfo.rb
+@@ -1,11 +1,5 @@
+ require 'delegate'
+
+-begin
+- require 'rubygems'
+- gem 'deprecated', "= 2.0.1"
+-rescue LoadError => e
+-end
+-
+ require 'deprecated'
+
+ module DBI
+--
diff --git a/debian/patches/0002-skip-available-drivers-test.patch b/debian/patches/0002-skip-available-drivers-test.patch
new file mode 100644
index 0000000..ff75125
--- /dev/null
+++ b/debian/patches/0002-skip-available-drivers-test.patch
@@ -0,0 +1,30 @@
+From: Dmitry Borodaenko <angdraug at debian.org>
+Date: Tue, 13 Sep 2011 16:36:40 +0300
+Subject: skip available drivers test
+
+DBI drivers were split out into their own packages specifically so that
+one doesn't have to install all of them for DBI to work.
+---
+ test/dbi/tc_dbi.rb | 8 --------
+ 1 files changed, 0 insertions(+), 8 deletions(-)
+
+diff --git a/test/dbi/tc_dbi.rb b/test/dbi/tc_dbi.rb
+index b87b029..6723fe6 100644
+--- a/test/dbi/tc_dbi.rb
++++ b/test/dbi/tc_dbi.rb
+@@ -141,14 +141,6 @@ class TC_DBI < Test::Unit::TestCase
+
+ def test_available_drivers
+ assert_respond_to(DBI, :available_drivers)
+- assert_equal(
+- [
+- "dbi:Mysql:",
+- "dbi:ODBC:",
+- "dbi:Pg:",
+- "dbi:SQLite3:",
+- "dbi:SQLite:"
+- ], DBI.available_drivers.sort)
+ end
+
+ # PRIVATE METHODS
+--
diff --git a/debian/patches/0003-remove-executables.patch b/debian/patches/0003-remove-executables.patch
new file mode 100644
index 0000000..9600c37
--- /dev/null
+++ b/debian/patches/0003-remove-executables.patch
@@ -0,0 +1,581 @@
+From: Dmitry Borodaenko <angdraug at debian.org>
+Date: Tue, 13 Sep 2011 18:55:13 +0300
+Subject: remove executables
+
+* dbi: too primitive to be worth the namespace in /usr/bin
+* test_broken_dbi: irrelevant for a Debian package
+---
+ bin/dbi | 518 ---------------------------------------------------
+ bin/test_broken_dbi | 37 ----
+ 2 files changed, 0 insertions(+), 555 deletions(-)
+ delete mode 100644 bin/dbi
+ delete mode 100755 bin/test_broken_dbi
+
+diff --git a/bin/dbi b/bin/dbi
+deleted file mode 100644
+index 9c7e3df..0000000
+--- a/bin/dbi
++++ /dev/null
+@@ -1,518 +0,0 @@
+-#!/usr/bin/env ruby
+-#
+-# Copyright (c) 2001, 2002 Michael Neumann <neumann at s-direktnet.de>
+-#
+-# All rights reserved.
+-#
+-# Redistribution and use in source and binary forms, with or without
+-# modification, are permitted provided that the following conditions
+-# are met:
+-# 1. Redistributions of source code must retain the above copyright
+-# notice, this list of conditions and the following disclaimer.
+-# 2. Redistributions in binary form must reproduce the above copyright
+-# notice, this list of conditions and the following disclaimer in the
+-# documentation and/or other materials provided with the distribution.
+-# 3. The name of the author may not be used to endorse or promote products
+-# derived from this software without specific prior written permission.
+-#
+-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+-# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+-# THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-#
+-# $Id: sqlsh.rb,v 1.2 2006/01/24 04:20:01 francis Exp $
+-#
+-
+-begin
+- require 'rubygems'
+- gem 'dbi'
+-rescue LoadError => e
+-end
+-
+-require "dbi"
+-
+-begin
+- require "readline"
+- $use_readline = true
+-rescue LoadError
+- $use_readline = false
+-end
+-
+-require "irb"
+-require "irb/completion"
+-
+-$paging = true
+-$irb_completion = Readline.completion_proc
+-
+-require "getoptlong"
+-
+-class ReadlineControl
+-
+- attr_accessor :keywords
+-
+- def initialize
+- @keywords = []
+- set_prompt
+- initCompletion
+- end
+-
+- def initCompletion
+- if $use_readline
+- Readline.completion_proc = proc {|str| complete(str) }
+- end
+- end
+-
+- def complete(str)
+- @keywords.grep(/^#{Regexp.escape(str)}/i)
+- end
+-
+- def set_prompt(prompt="> ")
+- @prompt = prompt
+- end
+-
+- def readline
+- if $use_readline
+- Readline.readline(@prompt, true)
+- else
+- print @prompt
+- $stdin.readline
+- end
+- end
+-
+-end
+-
+-class Command
+-
+- def tokens(sql)
+- DBI::SQL::PreparedStatement.tokens(sql)
+- end
+-
+- def readCommand
+- line = ""
+-
+- $rd.set_prompt(PROMPT)
+- begin
+- if $input.nil?
+- # no source file to read from
+- l = $rd.readline
+- else
+- # source file has still data
+- l = $input.gets
+- if l.nil?
+- $input = nil
+- next
+- end
+- end
+-
+- next if l.strip.empty?
+- l = l.chomp + "\n"
+- line << l
+-
+- puts $file + INPUT + l unless $input.nil?
+- $rd.set_prompt(PROMPT_CONT)
+- end until complete?(line)
+-
+- return line.strip
+- end
+-
+- private
+-
+- def complete?(line)
+- line =~ /^\s*\\/ or (tokens(line).last || "") =~ /;\s*$/
+- end
+-end
+-
+-class Actions
+- ACTIONS = [
+- [ /^\\q(uit)?\s*$/i, :quit ],
+- [ /^\\h(elp)?\s*$/i, :help ],
+- [ /^\\t(ables)?/i, :tables ],
+- [ /^\\dt/i, :describeTable ],
+- [ /^\\s(elect)?/i, :select ],
+-
+- [ /^\\rb/i, :ruby ],
+- [ /^\\irb/i, :irb ],
+-
+- [ /^\\c(ommit)?\s*$/i, :commit ],
+- [ /^\\r(ollback)?\s*$/i, :rollback ],
+- [ /^\\a(utocommit)?(\s+(on|off)?)?\s*$/i, :autocommit ],
+- [ /^\\i(nput)?/i, :input ],
+- [ /^\\o(utput)?/i, :output ],
+- [ /^\\pl/i, :pageLength ],
+- [ /^\\p/i, :togglePaging ],
+-
+- [ //, :unknownCommand ]
+- ]
+-
+- def dispatchCommand(line)
+- ACTIONS.each do |regexp, action|
+- if line =~ regexp then
+- send(action, $~)
+- return
+- end
+- end
+- end
+-
+- def quit(match)
+- puts
+- puts "BYE"
+- puts
+-
+- begin
+- Conn.disconnect
+- rescue DBI::Error => err
+- puts
+- puts err.message
+- p err.backtrace if $DEBUG
+- puts
+- end
+-
+- exit
+- end
+-
+- def help(match)
+- head = %w(Function Description)
+- rows = [
+- ["\\h[elp]", "Display this help screen"],
+- ["", ""],
+-
+- ["\\t[ables]", "Display all available tables"],
+- ["\\dt table", "Describe columns of 'table'"],
+- ["\\s[elect] table", "short for SELECT * FROM 'table'"],
+-
+- ["", ""],
+- ["\\c[ommit]", "Commits the current transaction"],
+- ["\\r[ollback]", "Rolls back the current transaction"],
+- ["\\a[utocommit]", "Show current autocommit mode"],
+- ["\\a[utocommit] on|off", "Switch autocommit mode on/off"],
+- ["", ""],
+-
+- ["\\i[nput] filename", "Read and execute lines from 'filename'"],
+- ["\\o[utput]", "Disable output"],
+- ["\\o[utput] filename", "Store SQL statments the user inputs into 'filename'"],
+- ["", ""],
+-
+- ["\\pl n", "Set page length to 'n'"],
+- ["\\p", "Toggle paging"],
+- ["", ""],
+- ["\\rb ...", "Execute the rest of the line as Ruby sourcecode"],
+- ["\\irb", "Execute irb within this context"],
+-
+- ["", ""],
+-
+- ["\\q[uit]", "Quit this program"]
+- ]
+-
+- puts
+- puts "Help: "
+- output_table(head, rows)
+- puts
+- end
+-
+- def tables(match)
+- head = ["Table name"]
+- rows = Conn.tables.collect {|name| [name]}
+-
+- puts
+- puts "Tables: "
+- output_table(head, rows)
+- puts
+- end
+-
+- def describeTable(match)
+- table = match.post_match.strip
+-
+- head = %w(name type_name precision scale default nullable indexed primary unique)
+-
+- rows = Conn.columns(table).collect {|col| head.collect{|a| col[a]} }
+-
+- puts
+- puts "Table '#{table}': "
+- output_table(head, rows)
+- puts
+- end
+-
+- def select(match)
+- executeSQL("SELECT * FROM #{match.post_match};")
+- end
+-
+- def commit(match)
+- Conn.commit
+- puts
+- puts "COMMIT"
+- puts
+- end
+-
+- def rollback(match)
+- Conn.rollback
+- puts
+- puts "ROLLBACK"
+- puts
+- end
+-
+- def autocommit(match)
+- mode = match[3]
+- if mode =~ /on/i
+- Conn['AutoCommit'] = true
+- puts
+- puts "AUTOCOMMIT IS NOW ON"
+- puts
+- elsif mode =~ /off/i
+- Conn['AutoCommit'] = false
+- puts
+- puts "AUTOCOMMIT IS NOW OFF"
+- puts
+- else
+- puts
+- if Conn['AutoCommit'] == true
+- puts "AUTOCOMMIT is currently switched ON"
+- elsif Conn['AutoCommit'] == false
+- puts "AUTOCOMMIT is currently switched OFF"
+- else
+- puts "AUTOCOMMIT is in unknown state"
+- end
+- puts
+- end
+- end
+-
+- def input(match)
+- puts
+- $file = match.post_match.strip
+-
+- begin
+- $input = File.open($file)
+- puts "EXECUTE file #{$file}"
+- puts
+- rescue
+- puts "Couldn't read from file #{$file}"
+- puts
+- end
+- end
+-
+- def output(match)
+- puts
+- file = match.post_match.strip
+-
+- if file.empty?
+- $output.close if $output
+- $output = nil
+- puts "Disabled OUTPUT"
+- puts
+- else
+- begin
+- $output = File.new(file, "w+")
+- puts "Set OUTPUT to file #{file}"
+- puts
+- rescue
+- puts "Couldn't set OUTPUT to file #{file}"
+- puts
+- end
+- end
+- end
+-
+- def togglePaging(match)
+- $paging = !$paging
+-
+- puts "Paging is now " + ($paging ? "on" : "off") + "."
+- end
+-
+- def pageLength(match)
+- puts
+- $page_len = match.post_match.strip.to_i
+- $page_len = DEFAULT_PAGE_LENGTH if $page_len <= 0
+-
+- puts "New page length is #{$page_len}."
+- puts
+- end
+-
+- def irb(match)
+- Readline.completion_proc = $irb_completion
+- puts
+- puts "================================== IRB ==============================="
+- begin
+- IRB.start
+- rescue SystemExit
+- end
+- puts "======================================================================"
+- $rd.initCompletion
+- end
+-
+- def ruby(match)
+- puts
+- eval match.post_match
+- puts
+- end
+-
+- def unknownCommand(match)
+- puts
+- puts "Unknown command!"
+- puts
+- end
+-
+-end
+-
+-def output_table(header, rows)
+- DBI::Utils::TableFormatter.ascii(header, rows, nil, nil, nil, nil, $page_len) do
+- if $paging
+- print "[enter to continue, a to abort]"
+- break if $stdin.readline.chomp.downcase == "a"
+- end
+- end
+-end
+-
+-def executeSQL(sql)
+- sql = $` if sql =~ /;\s*$/
+-
+- start = ::Time.now
+- stmt = Conn.execute(sql)
+-
+- head = stmt.column_names
+-
+- # DDL, DCL
+- if head.empty?
+- puts
+- nr = stmt.rows
+- if nr == 0
+- puts " No rows affected"
+- elsif nr == 1
+- puts " 1 row affected"
+- else
+- puts " #{nr} rows affected"
+- end
+- puts
+- else
+- rows = stmt.fetch_all
+- tm = ::Time.now - start
+-
+- puts
+- output_table(head, rows || [])
+- print " "
+- if rows.nil?
+- print "No rows in set"
+- elsif rows.size == 1
+- print "1 row in set"
+- else
+- print "#{rows.size} rows in set"
+- end
+-
+- puts " (#{(tm.to_f*1000).to_i / 1000.0} sec)"
+- puts
+- end
+-
+- $rd.keywords = SQL_KEYWORDS + Conn.tables
+-end
+-
+-DEFAULT_PAGE_LENGTH = 37
+-
+-$output = nil
+-$input = nil
+-$page_len = DEFAULT_PAGE_LENGTH
+-PROMPT = "dbi => "
+-PROMPT_CONT = "dbi -> "
+-INPUT = " >> "
+-
+-SQL_KEYWORDS = %w(
+- INSERT DELETE UPDATE SELECT FROM WHERE IN LIKE SET VALUES INTO
+- CREATE TABLE DROP
+- COMMIT ROLLBACK
+- CHAR VARCHAR VARCHAR2 INT INTEGER NUMBER FLOAT REAL LONG CLOB BLOB DECIMAL
+- DBCLOB DBBLOB
+-)
+-
+-# ---------------------------------------------------------------------------
+-
+-opts = GetoptLong.new(
+- ["--file", "-f", GetoptLong::REQUIRED_ARGUMENT ]
+-)
+-opts.each do |opt, arg|
+- case opt
+- when "--file"
+- $input_file_name = arg
+- end
+-end
+-
+-if ARGV.size < 1 or ARGV.size > 3
+- puts
+- puts "USAGE: #{$0} [--file file] driver_url [user [password] ]"
+- puts
+-
+- puts "Available driver and datasources:"
+- puts
+- for driver in DBI.available_drivers do
+- puts driver
+- begin
+- ds = DBI.data_sources(driver)
+- for datasource in ds
+- puts " " + datasource
+- end
+- rescue => err
+- end
+- puts
+- end
+- puts
+-
+- exit 1
+-else
+- DRIVER_URL = ARGV.shift
+- USER = ARGV.shift
+- PASS = ARGV.shift
+-end
+-
+-puts
+-begin
+- Conn = DBI.connect(DRIVER_URL, USER, PASS)
+- print "CONNECT TO #{DRIVER_URL} "
+- print "USER #{USER} " unless USER.nil?
+- print "PASS #{PASS} " unless PASS.nil?
+- print "\n"
+-
+-rescue DBI::Error, DBI::Warning => err
+- p err
+- exit
+-end
+-
+-puts
+-
+-$rd = ReadlineControl.new
+-$rd.keywords = SQL_KEYWORDS + Conn.tables
+-
+-cmd = Command.new
+-act = Actions.new
+-
+-# --file option
+-if $input_file_name
+- def $input_file_name.post_match
+- $input_file_name
+- end
+- act.input($input_file_name)
+-end
+-
+-# Main-Loop -----------------------------------
+-
+-loop do
+- line = cmd.readCommand
+-
+- $output.puts line unless $output.nil?
+-
+- begin
+- if line =~ /^\\/ then
+- # Internal Command
+- act.dispatchCommand(line)
+- else
+- # SQL Command
+- executeSQL(line)
+- end
+- rescue DBI::Error => err
+- puts
+- puts err.message
+- p err.backtrace if $DEBUG
+- puts
+- end
+-end
+-
+diff --git a/bin/test_broken_dbi b/bin/test_broken_dbi
+deleted file mode 100755
+index 4520c92..0000000
+--- a/bin/test_broken_dbi
++++ /dev/null
+@@ -1,37 +0,0 @@
+-#!/usr/bin/env ruby
+-
+-load_path = false
+-gems = false
+-redefined = false
+-
+-# these clauses are for installations which have RUBYOPT=-rubygems, etc.
+-if Object.const_defined? "Gem"
+- redefined = true
+- module Kernel
+- alias gem_require require
+- alias require gem_original_require
+- end
+-end
+-
+-begin
+- require 'dbi'
+- load_path = true
+-rescue LoadError => e
+-end
+-
+-if Object.const_defined? "Gem" and redefined
+- module Kernel
+- alias gem_original_require require
+- alias require gem_require
+- end
+-end
+-
+-begin
+- require 'rubygems'
+- gem 'dbi'
+- gems = true
+-rescue LoadError
+-rescue Gem::LoadError
+-end
+-
+-puts "Your installation of DBI is broken" if gems and load_path
+--
diff --git a/debian/patches/0004-update-to-deprecated-3.0.0.patch b/debian/patches/0004-update-to-deprecated-3.0.0.patch
new file mode 100644
index 0000000..1f38861
--- /dev/null
+++ b/debian/patches/0004-update-to-deprecated-3.0.0.patch
@@ -0,0 +1,204 @@
+From: Dmitry Borodaenko <angdraug at debian.org>
+Date: Tue, 13 Sep 2011 17:54:28 +0300
+Subject: update to deprecated-3.0.0
+
+Update to use "deprecated" version 3.0.0 to get rid of "already
+initialized constant Deprecate" warning.
+
+rubygems defines its own Deprecate module in rubygems/deprecate.rb. This
+causes a warning when deprecate 2.0.1 is required because it aliases the
+Deprecated module to Deprecate. Version 3.0.0 no longer does this
+aliasing and gets rid of the warning. Updating to 3.0.0 requires some
+changes in how methods are deprecated, and how set_action is called.
+
+Based on https://github.com/jinschoi/ruby-dbi/tree/deprecated-fixes
+---
+ build/Rakefile.dbi.rb | 2 +-
+ lib/dbi.rb | 27 +++++++++++----------------
+ lib/dbi/columninfo.rb | 4 ++--
+ lib/dbi/utils/date.rb | 3 ++-
+ lib/dbi/utils/time.rb | 3 ++-
+ lib/dbi/utils/timestamp.rb | 4 +++-
+ test/dbi/tc_date.rb | 2 +-
+ test/dbi/tc_time.rb | 2 +-
+ test/dbi/tc_timestamp.rb | 2 +-
+ 9 files changed, 24 insertions(+), 25 deletions(-)
+
+diff --git a/build/Rakefile.dbi.rb b/build/Rakefile.dbi.rb
+index 719de67..2d337f1 100644
+--- a/build/Rakefile.dbi.rb
++++ b/build/Rakefile.dbi.rb
+@@ -45,7 +45,7 @@ namespace :dbi do
+ spec.files = gem_files(code_files)
+ spec.summary = 'A vendor independent interface for accessing databases, similar to Perl\'s DBI'
+ spec.description = 'A vendor independent interface for accessing databases, similar to Perl\'s DBI'
+- spec.add_dependency 'deprecated', '= 2.0.1'
++ spec.add_dependency 'deprecated', '= 3.0.0'
+
+ build_package_tasks(spec, code_files)
+ end
+diff --git a/lib/dbi.rb b/lib/dbi.rb
+index 9d0877f..3762204 100644
+--- a/lib/dbi.rb
++++ b/lib/dbi.rb
+@@ -63,24 +63,19 @@ class Class
+ end
+ end
+
+-Deprecate.set_action(
+- proc do |call|
+- klass, meth = call.split(/[#.]/)
+- klass = klass.split(/::/).inject(Module) { |a,x| a.const_get(x) }
+-
+- case klass
+- when DBI::Date, DBI::Time, DBI::Timestamp
+- warn "DBI::Date/Time/Timestamp are deprecated and will eventually be removed."
+- end
+-
+- if klass.inherits_from?(DBI::ColumnInfo)
+- warn "ColumnInfo methods that do not match a component are deprecated and will eventually be removed"
+- end
++Deprecated.set_action() do |klass, meth, replacement|
++ case klass
++ when DBI::Date, DBI::Time, DBI::Timestamp
++ warn "DBI::Date/Time/Timestamp are deprecated and will eventually be removed."
++ end
+
+- warn "You may change the result of calling deprecated code via Deprecate.set_action; Trace follows:"
+- warn caller[2..-1].join("\n")
++ if klass.inherits_from?(DBI::ColumnInfo)
++ warn "ColumnInfo methods that do not match a component are deprecated and will eventually be removed"
+ end
+-)
++
++ warn "You may change the result of calling deprecated code via Deprecated.set_action; Trace follows:"
++ warn caller[2..-1].join("\n")
++end
+
+ #++
+ module DBI
+diff --git a/lib/dbi/columninfo.rb b/lib/dbi/columninfo.rb
+index cfff97b..e3baf02 100644
+--- a/lib/dbi/columninfo.rb
++++ b/lib/dbi/columninfo.rb
+@@ -17,7 +17,7 @@ module DBI
+ # All of these forms have assignment forms as well.
+ #
+ class ColumnInfo < DelegateClass(Hash)
+-
++ include Deprecated
+ # Create a new ColumnInfo object.
+ #
+ # If no Hash is provided, one will be created for you. The hash will be
+@@ -75,7 +75,7 @@ module DBI
+ # Aliases - XXX soon to be deprecated
+ def self.deprecated_alias(target, source) # :nodoc:
+ define_method(target) { |*args| method_missing(source, *args) }
+- deprecate target
++ deprecated target
+ end
+
+ deprecated_alias :is_nullable?, :nullable
+diff --git a/lib/dbi/utils/date.rb b/lib/dbi/utils/date.rb
+index cb93476..baf553f 100644
+--- a/lib/dbi/utils/date.rb
++++ b/lib/dbi/utils/date.rb
+@@ -5,6 +5,7 @@ module DBI
+ # DEPRECATED: Please use a regular Date or DateTime object.
+ #
+ class Date
++ include Deprecated
+ attr_accessor :year, :month, :day
+
+ # Aliases
+@@ -54,6 +55,6 @@ module DBI
+
+ public
+
+- deprecate :initialize, :public
++ deprecated :initialize, :public
+ end
+ end
+diff --git a/lib/dbi/utils/time.rb b/lib/dbi/utils/time.rb
+index 18bd25d..bdf2681 100644
+--- a/lib/dbi/utils/time.rb
++++ b/lib/dbi/utils/time.rb
+@@ -4,6 +4,7 @@ module DBI
+ #
+ # DEPRECATED: Please use a regular Time or DateTime object.
+ class Time
++ include Deprecated
+ attr_accessor :hour, :minute, :second
+
+ private
+@@ -25,7 +26,7 @@ module DBI
+
+ public
+
+- deprecate :initialize, :public
++ deprecated :initialize, :public
+
+ alias :min :minute
+ alias :min= :minute=
+diff --git a/lib/dbi/utils/timestamp.rb b/lib/dbi/utils/timestamp.rb
+index 6a6d355..1563bed 100644
+--- a/lib/dbi/utils/timestamp.rb
++++ b/lib/dbi/utils/timestamp.rb
+@@ -5,6 +5,8 @@ module DBI
+ # DEPRECATED: Please use a regular DateTime object.
+ #
+ class Timestamp
++ include Deprecated
++
+ attr_accessor :year, :month, :day
+ attr_accessor :hour, :minute, :second
+ attr_writer :fraction
+@@ -36,7 +38,7 @@ module DBI
+
+ public
+
+- deprecate :initialize, :public
++ deprecated :initialize, :public
+
+ # Returns true if +timestamp+ has a year, month, day, hour, minute,
+ # second and fraction equal to the comparing object.
+diff --git a/test/dbi/tc_date.rb b/test/dbi/tc_date.rb
+index 8421c56..3306fac 100644
+--- a/test/dbi/tc_date.rb
++++ b/test/dbi/tc_date.rb
+@@ -13,7 +13,7 @@ require 'date'
+ require 'dbi'
+ require 'test/unit'
+
+-Deprecate.set_action(proc { })
++Deprecated.set_action { }
+
+ class TC_DBI_Date < Test::Unit::TestCase
+ def setup
+diff --git a/test/dbi/tc_time.rb b/test/dbi/tc_time.rb
+index 514ff97..699b376 100644
+--- a/test/dbi/tc_time.rb
++++ b/test/dbi/tc_time.rb
+@@ -12,7 +12,7 @@ $LOAD_PATH.unshift("lib")
+ require 'dbi'
+ require 'test/unit'
+
+-Deprecate.set_action(proc { })
++Deprecated.set_action { }
+
+ class TC_DBI_Time < Test::Unit::TestCase
+ def setup
+diff --git a/test/dbi/tc_timestamp.rb b/test/dbi/tc_timestamp.rb
+index bc418b3..38b55e2 100644
+--- a/test/dbi/tc_timestamp.rb
++++ b/test/dbi/tc_timestamp.rb
+@@ -14,7 +14,7 @@ require 'date'
+ require 'dbi'
+ require 'test/unit'
+
+-Deprecate.set_action(proc { })
++Deprecated.set_action { }
+
+ class TC_DBI_Date < Test::Unit::TestCase
+ def setup
+--
diff --git a/debian/patches/0005-ruby-1.9-compatibility.patch b/debian/patches/0005-ruby-1.9-compatibility.patch
new file mode 100644
index 0000000..1d6e599
--- /dev/null
+++ b/debian/patches/0005-ruby-1.9-compatibility.patch
@@ -0,0 +1,78 @@
+From: Dmitry Borodaenko <angdraug at debian.org>
+Date: Tue, 13 Sep 2011 17:03:30 +0300
+Subject: ruby-1.9 compatibility
+
+Fixes merged from https://github.com/nearbuy/ruby-dbi:
+* Fix clone and dup for ruby 1.9
+* Can't add keys to a hash during iteration
+---
+ lib/dbi/columninfo.rb | 2 +-
+ lib/dbi/row.rb | 40 ++++++++++++++++++++--------------------
+ 2 files changed, 21 insertions(+), 21 deletions(-)
+
+diff --git a/lib/dbi/columninfo.rb b/lib/dbi/columninfo.rb
+index e3baf02..2b95128 100644
+--- a/lib/dbi/columninfo.rb
++++ b/lib/dbi/columninfo.rb
+@@ -33,7 +33,7 @@ module DBI
+ @hash ||= Hash.new
+
+ # coerce all strings to symbols
+- @hash.each_key do |x|
++ @hash.keys.each do |x|
+ if x.kind_of? String
+ sym = x.to_sym
+ if @hash.has_key? sym
+diff --git a/lib/dbi/row.rb b/lib/dbi/row.rb
+index 54d6fba..206108a 100644
+--- a/lib/dbi/row.rb
++++ b/lib/dbi/row.rb
+@@ -217,27 +217,27 @@ module DBI
+ def __setobj__(obj)
+ @delegate_dc_obj = @arr = obj
+ end
+- else
+- #
+- # See Object#clone.
+- #
+- # #clone and #dup here, however, are both deep copies via Marshal.
+- #
+- def clone
+- Marshal.load(Marshal.dump(self))
+- end
++ end
+
+- def dup
+- row = self.class.allocate
+- row.instance_variable_set :@column_types, @column_types
+- row.instance_variable_set :@convert_types, @convert_types
+- row.instance_variable_set :@column_map, @column_map
+- row.instance_variable_set :@column_names, @column_names
+- # this is the only one we actually dup...
+- row.instance_variable_set :@arr, arr = @arr.dup
+- row.instance_variable_set :@_dc_obj, arr
+- row
+- end
++ #
++ # See Object#clone.
++ #
++ # #clone and #dup here, however, are both deep copies via Marshal.
++ #
++ def clone
++ Marshal.load(Marshal.dump(self))
++ end
++
++ def dup
++ row = self.class.allocate
++ row.instance_variable_set :@column_types, @column_types
++ row.instance_variable_set :@convert_types, @convert_types
++ row.instance_variable_set :@column_map, @column_map
++ row.instance_variable_set :@column_names, @column_names
++ # this is the only one we actually dup...
++ row.instance_variable_set :@arr, arr = @arr.dup
++ row.instance_variable_set :@_dc_obj, arr
++ row
+ end
+
+ private
+--
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6d4cd3e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,5 @@
+0001-remove-usage-of-rubygems.patch
+0002-skip-available-drivers-test.patch
+0003-remove-executables.patch
+0004-update-to-deprecated-3.0.0.patch
+0005-ruby-1.9-compatibility.patch
--
ruby-dbi.git
More information about the Pkg-ruby-extras-commits
mailing list