[DRE-commits] [ruby-locale] 02/05: install data files to /usr/share

Hleb Valoshka tsfgnu-guest at moszumanska.debian.org
Wed Sep 23 08:50:57 UTC 2015


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

tsfgnu-guest pushed a commit to branch master
in repository ruby-locale.

commit 8afc49bebf1e9bae65c06f0cfb89052d373eb7d8
Author: Hleb Valoshka <375gnu at gmail.com>
Date:   Tue Sep 15 18:47:39 2015 +0300

    install data files to /usr/share
---
 debian/patches/0001-Read-data-from-usr-share.patch | 53 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 debian/rules                                       |  6 +++
 3 files changed, 60 insertions(+)

diff --git a/debian/patches/0001-Read-data-from-usr-share.patch b/debian/patches/0001-Read-data-from-usr-share.patch
new file mode 100644
index 0000000..58c8d1d
--- /dev/null
+++ b/debian/patches/0001-Read-data-from-usr-share.patch
@@ -0,0 +1,53 @@
+From: Hleb Valoshka <375gnu at gmail.com>
+Date: Tue, 15 Sep 2015 19:25:41 +0300
+Subject: Read data from /usr/share
+
+---
+ lib/locale.rb               | 6 ++++++
+ lib/locale/info/language.rb | 2 +-
+ lib/locale/info/region.rb   | 2 +-
+ 3 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/lib/locale.rb b/lib/locale.rb
+index d746f33..3ef3c24 100644
+--- a/lib/locale.rb
++++ b/lib/locale.rb
+@@ -42,6 +42,12 @@ module Locale
+     end
+   end
+ 
++  module_function
++  def root #:nodoc:
++    Dir[File.join(File.dirname(__FILE__), '../../../share/ruby-locale'),
++        File.join(File.dirname(__FILE__), 'locale'),
++        '/usr/share/ruby-locale' ].first
++  end
+   # Initialize Locale library. 
+   # Usually, you don't need to call this directly, because
+   # this is called when Locale's methods are called.
+diff --git a/lib/locale/info/language.rb b/lib/locale/info/language.rb
+index 45d25ce..c272e9e 100644
+--- a/lib/locale/info/language.rb
++++ b/lib/locale/info/language.rb
+@@ -90,7 +90,7 @@ module Locale
+     @@lang_two_codes = Hash.new
+     @@lang_three_codes = Hash.new
+ 
+-    Zlib::GzipReader.open(File.dirname(__FILE__) + "/../data/languages.tab.gz") do |gz|
++    Zlib::GzipReader.open(File.join(Locale.root, "data/languages.tab.gz")) do |gz|
+       gz.readlines.each do |l|
+         l.force_encoding('UTF-8') if l.respond_to?(:force_encoding)
+         unless l =~ /^\s*$/
+diff --git a/lib/locale/info/region.rb b/lib/locale/info/region.rb
+index daf1924..8a25095 100644
+--- a/lib/locale/info/region.rb
++++ b/lib/locale/info/region.rb
+@@ -37,7 +37,7 @@ module Locale
+     end
+ 
+     @@regions = Hash.new
+-    Zlib::GzipReader.open(File.dirname(__FILE__) + "/../data/regions.tab.gz") do |gz|
++    Zlib::GzipReader.open(File.join(Locale.root,  "data/regions.tab.gz")) do |gz|
+       gz.readlines.each do |l|
+         l.force_encoding('UTF-8') if l.respond_to?(:force_encoding)
+         unless l =~ /^\s*$/
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..daa8cdd
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Read-data-from-usr-share.patch
diff --git a/debian/rules b/debian/rules
index 608b8a0..dcf0bf1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,5 +14,11 @@
 %:
 	dh $@ --buildsystem=ruby --with ruby
 
+override_dh_auto_install:
+	dh_auto_install
+	mkdir -p debian/ruby-locale/usr/share/ruby-locale
+	mv debian/ruby-locale/usr/lib/ruby/vendor_ruby/locale/data \
+	   debian/ruby-locale/usr/share/ruby-locale
+
 override_dh_installchangelogs:
 	dh_installchangelogs doc/text/news.md -O--buildsystem=ruby

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



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