[DRE-commits] [ruby-tzinfo] 04/08: Update patches
Hleb Valoshka
tsfgnu-guest at alioth.debian.org
Sat Aug 17 14:51:40 UTC 2013
This is an automated email from the git hooks/post-receive script.
tsfgnu-guest pushed a commit to branch master
in repository ruby-tzinfo.
commit 04a19d04ae21d3dd9503f4daaff4071004f9b98a
Author: Hleb Valoshka <375GNU at Gmail.COM>
Date: Sat Aug 17 13:19:01 2013 +0300
Update patches
---
.../patches/0001-disable-tainted-load-test.patch | 42 ++--
debian/patches/0002-use-system-tz-data.patch | 226 --------------------
debian/patches/series | 3 +-
3 files changed, 29 insertions(+), 242 deletions(-)
diff --git a/debian/patches/0001-disable-tainted-load-test.patch b/debian/patches/0001-disable-tainted-load-test.patch
index 5e5f8cb..ad41fd3 100644
--- a/debian/patches/0001-disable-tainted-load-test.patch
+++ b/debian/patches/0001-disable-tainted-load-test.patch
@@ -1,22 +1,36 @@
-From: Dmitry Borodaenko <angdraug at debian.org>
-Date: Sat, 18 Feb 2012 21:27:41 +0300
+From: Hleb Valoshka <375GNU at Gmail.COM>
+Date: Sat, 17 Aug 2013 13:18:12 +0300
Subject: disable tainted load test
This test won't work when building the package under /tmp.
---
- test/tc_timezone.rb | 2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
+ test/tc_ruby_data_source.rb | 2 +-
+ test/tc_timezone.rb | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+diff --git a/test/tc_ruby_data_source.rb b/test/tc_ruby_data_source.rb
+index 25395ee..af6f260 100644
+--- a/test/tc_ruby_data_source.rb
++++ b/test/tc_ruby_data_source.rb
+@@ -76,7 +76,7 @@ class TCRubyDataSource < Test::Unit::TestCase
+ assert_equal('Etc/GMT-1', info.identifier)
+ end
+
+- def test_load_timezone_info_tainted
++ def disabled_test_load_timezone_info_tainted
+ safe_test do
+ info = @data_source.load_timezone_info('Europe/Amsterdam'.taint)
+ assert_equal('Europe/Amsterdam', info.identifier)
diff --git a/test/tc_timezone.rb b/test/tc_timezone.rb
-index f49a4d8..4f99fbc 100644
+index fe31490..20d3076 100644
--- a/test/tc_timezone.rb
+++ b/test/tc_timezone.rb
-@@ -151,7 +151,7 @@ class TCTimezone < Test::Unit::TestCase
- # Disable test in Ruby 1.9 and Ruby 2.0. See:
- # http://groups.google.com/group/ruby-talk-google/browse_thread/thread/170a7205555cedfc
- # It doesn't appear to be possible to require a file from the load path in Ruby 1.9.
-- if RUBY_VERSION !~ /\A(1\.9|2)\./
-+ if RUBY_VERSION !~ /\A(1\.9|2)\./ and false
- def test_get_tainted_not_loaded
- safe_test do
- tz = Timezone.get('Europe/Amsterdam'.taint)
+@@ -164,7 +164,7 @@ class TCTimezone < Test::Unit::TestCase
+ end
+ end
+
+- def test_get_tainted_not_previously_loaded
++ def disabled_test_get_tainted_not_previously_loaded
+ safe_test do
+ tz = Timezone.get('Europe/Amsterdam'.taint)
+ assert_equal('Europe/Amsterdam', tz.identifier)
diff --git a/debian/patches/0002-use-system-tz-data.patch b/debian/patches/0002-use-system-tz-data.patch
deleted file mode 100644
index 4777f86..0000000
--- a/debian/patches/0002-use-system-tz-data.patch
+++ /dev/null
@@ -1,226 +0,0 @@
-From e9f3e0764c532ddbf19228e0dd822fdeba7b739f Mon Sep 17 00:00:00 2001
-From: Hleb Valoshka <375GNU at Gmail.COM>
-Date: Sun, 8 Jul 2012 12:09:43 +0300
-Subject: [PATCH] use system tz data
-
- apply patch from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503591#64
- fix tests for UTC
----
- lib/tzinfo.rb | 2 +
- lib/tzinfo/timezone.rb | 30 +-------
- lib/tzinfo/zoneinfo_timezone_info.rb | 129 ++++++++++++++++++++++++++++++++++
- test/tc_timezone.rb | 4 +-
- 4 files changed, 135 insertions(+), 30 deletions(-)
- create mode 100644 lib/tzinfo/zoneinfo_timezone_info.rb
-
-diff --git a/lib/tzinfo.rb b/lib/tzinfo.rb
-index e5d042e..5bcd1cb 100644
---- a/lib/tzinfo.rb
-+++ b/lib/tzinfo.rb
-@@ -53,3 +53,5 @@ require 'tzinfo/country_info'
-
- require 'tzinfo/country'
- require 'tzinfo/country_timezone'
-+
-+require 'tzinfo/zoneinfo_timezone_info'
-diff --git a/lib/tzinfo/timezone.rb b/lib/tzinfo/timezone.rb
-index b4a8b0e..b2d4e24 100644
---- a/lib/tzinfo/timezone.rb
-+++ b/lib/tzinfo/timezone.rb
-@@ -96,34 +96,8 @@ module TZInfo
- instance = @@loaded_zones[identifier]
- unless instance
- raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /^[A-Za-z0-9\+\-_]+(\/[A-Za-z0-9\+\-_]+)*$/
-- identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__')
-- begin
-- # Use a temporary variable to avoid an rdoc warning
-- file = "tzinfo/definitions/#{identifier}".untaint
-- require file
--
-- m = Definitions
-- identifier.split(/\//).each {|part|
-- m = m.const_get(part)
-- }
--
-- info = m.get
--
-- # Could make Timezone subclasses register an interest in an info
-- # type. Since there are currently only two however, there isn't
-- # much point.
-- if info.kind_of?(DataTimezoneInfo)
-- instance = DataTimezone.new(info)
-- elsif info.kind_of?(LinkedTimezoneInfo)
-- instance = LinkedTimezone.new(info)
-- else
-- raise InvalidTimezoneIdentifier, "No handler for info type #{info.class}"
-- end
--
-- @@loaded_zones[instance.identifier] = instance
-- rescue LoadError, NameError => e
-- raise InvalidTimezoneIdentifier, e.message
-- end
-+ instance = DataTimezone.new(ZoneinfoTimezoneInfo.new(identifier))
-+ @@loaded_zones[instance.identifier] = instance
- end
-
- instance
-diff --git a/lib/tzinfo/zoneinfo_timezone_info.rb b/lib/tzinfo/zoneinfo_timezone_info.rb
-new file mode 100644
-index 0000000..b73a553
---- /dev/null
-+++ b/lib/tzinfo/zoneinfo_timezone_info.rb
-@@ -0,0 +1,129 @@
-+#--
-+# Copyright (c) 2008 Philip Ross
-+#
-+# Permission is hereby granted, free of charge, to any person obtaining a copy
-+# of this software and associated documentation files (the "Software"), to deal
-+# in the Software without restriction, including without limitation the rights
-+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-+# copies of the Software, and to permit persons to whom the Software is
-+# furnished to do so, subject to the following conditions:
-+#
-+# The above copyright notice and this permission notice shall be included in all
-+# copies or substantial portions of the Software.
-+#
-+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-+# THE SOFTWARE.
-+#++
-+
-+require 'tzinfo/data_timezone_info'
-+require 'tzinfo/timezone'
-+
-+module TZInfo
-+ class ZoneinfoTimezoneInfo < DataTimezoneInfo #:nodoc:
-+
-+ @@zoneinfo_dir = nil
-+
-+ class << self
-+ def zoneinfo_dir
-+ @@zoneinfo_dir ||= find_zoneinfo_dir
-+ end
-+
-+ def zoneinfo_dir=(dir)
-+ @@zoneinfo_dir = dir
-+ end
-+
-+ private
-+ def find_zoneinfo_dir
-+ dir = ['/usr/share/zoneinfo', '/usr/share/lib/zoneinfo', '/etc/zoneinfo'].detect do |dir|
-+ File.directory?(dir)
-+ end
-+
-+ raise InvalidTimezoneIdentifier, 'Zoneinfo directory not found, use TZInfo::ZoneinfoTimezoneInfo.zoneinfo_dir= to set' unless dir
-+ dir
-+ end
-+ end
-+
-+ def initialize(identifier)
-+ super(identifier)
-+
-+ begin
-+ File.open(File.join(self.class.zoneinfo_dir, identifier)) do |f|
-+ parse(f)
-+ end
-+ rescue Errno::ENOENT => e
-+ raise InvalidTimezoneIdentifier, e.message
-+ end
-+ end
-+
-+ private
-+ def make_signed(long)
-+ long -= 0x100000000 if long >= 0x80000000
-+ long
-+ end
-+
-+ def parse(input)
-+ magic, ttisgmtcnt, ttisstdcnt, leapcnt, timecnt, typecnt, charcnt =
-+ input.read(44).unpack('a5 x15 NNNNNN')
-+
-+ raise InvalidTimezoneIdentifier, "Invalid magic: #{magic}" unless magic =~ /^TZif2?/
-+
-+ transitions = []
-+
-+ (0...timecnt).each do |i|
-+ transition_time = make_signed(input.read(4).unpack('N')[0])
-+ transitions << {:time => Time.at(transition_time).utc}
-+ end
-+
-+ (0...timecnt).each do |i|
-+ localtime_type = input.read(1).unpack('C')[0]
-+ transitions[i][:offset] = localtime_type
-+ end
-+
-+ offsets = []
-+
-+ (0...typecnt).each do |i|
-+ gmtoff, isdst, abbrind = input.read(6).unpack('NCC')
-+ gmtoff = make_signed(gmtoff)
-+ isdst = isdst == 1
-+
-+ # The setting of offsets is a hack at the moment.
-+ # TZInfo wants the base UTC offset and daylight savings offset separately.
-+ # For now just assume all dst offsets are 1 hour.
-+ std_offset = isdst ? 3600 : 0
-+
-+ offsets << {:utc_offset => gmtoff - std_offset, :std_offset => std_offset, :is_dst => isdst, :abbr_index => abbrind}
-+ end
-+
-+ abbrev = input.read(charcnt)
-+
-+ offsets.each do |o|
-+ o[:abbr] = abbrev[o[:abbr_index]...abbrev.index("\0", o[:abbr_index])]
-+ end
-+
-+ first = nil
-+ offsets.each_with_index do |o, i|
-+ if !o[:is_dst]
-+ first = i
-+ break
-+ end
-+ end
-+
-+ if first
-+ offset first, offsets[first][:utc_offset], offsets[first][:std_offset], offsets[first][:abbr].to_sym
-+ end
-+
-+ offsets.each_with_index do |o, i|
-+ offset i, o[:utc_offset], o[:std_offset], o[:abbr].to_sym unless i == first
-+ end
-+
-+ transitions.each do |t|
-+ transition t[:time].year, t[:time].mon, t[:offset], t[:time].to_i
-+ end
-+ end
-+ end
-+end
-diff --git a/test/tc_timezone.rb b/test/tc_timezone.rb
-index f49a4d8..51c5508 100644
---- a/test/tc_timezone.rb
-+++ b/test/tc_timezone.rb
-@@ -75,7 +75,7 @@ class TCTimezone < Test::Unit::TestCase
- def test_get_valid_2
- tz = Timezone.get('UTC')
-
-- assert_kind_of(LinkedTimezone, tz)
-+ assert_kind_of(DataTimezone, tz)
- assert_equal('UTC', tz.identifier)
- end
-
-@@ -934,7 +934,7 @@ class TCTimezone < Test::Unit::TestCase
-
- def test_marshal_linked
- tz = Timezone.get('UTC')
-- assert_kind_of(LinkedTimezone, tz)
-+ assert_kind_of(DataTimezone, tz)
- assert_same(tz, Marshal.load(Marshal.dump(tz)))
- end
-
---
-1.7.10.4
-
diff --git a/debian/patches/series b/debian/patches/series
index 68587a3..50ee78d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
-#0001-disable-tainted-load-test.patch
-#0002-use-system-tz-data.patch
+0001-disable-tainted-load-test.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-tzinfo.git
More information about the Pkg-ruby-extras-commits
mailing list