Hello,
Now, upstream author of libgettext-ruby replaces liblocale-ruby
by his module intentionally. I didn't check that before upload
new version. That's my fault. I should to notice and discuss and
before uploading.
Anyway,
libgettex-ruby provides locale support in pure ruby. Therefor
you can run as before by rewriting just;
require 'locale'
to
require 'locale.so'
.
However I think, it's better that we transit to use ruby-gettext
from liblocale-ruby + libintl-gettext-ruby.
Because "setlocale" in C layer provides some bad side-effect on
ruby (breaks Mershal and probably another). But unfortunally,
ruby-gettext can NOT support full-feature of locale at present.
It just loads gettext catalog (no support for date and number format).
If you agree with my suggestion, please see the patch attached.
Thant is fixes to transit ruby-gettext from locale.so + intl.
# The patch includes changes to rename Config class. Because it
# conflicts with ruby built-in class name provided by rbconfig.
Regards,
--
Tatsuki Sugiura mailto:[EMAIL PROTECTED]
diff -ur apt-listbugs-0.0.86/apt-listbugs apt-listbugs-0.0.86.1/apt-listbugs
--- apt-listbugs-0.0.86/apt-listbugs 2008-01-29 21:27:18.000000000 +0900
+++ apt-listbugs-0.0.86.1/apt-listbugs 2008-03-23 03:56:20.000000000 +0900
@@ -222,11 +222,11 @@
require 'debian/bts'
require 'thread'
require 'tempfile'
-require 'intl'
-require 'locale'
+require 'gettext'
require 'rss/maker'
+include GetText
-$intl = Intl.new("apt-listbugs")
+bindtextdomain("apt-listbugs")
# ad-hoc
require 'debian/mytempfile'
@@ -236,38 +236,38 @@
end
end
-class Config
+class AppConfig
QUERYBTS = "/usr/bin/querybts"
WWW_BROWSER = "/usr/bin/www-browser"
SENSIBLE_BROWSER = "/usr/bin/sensible-browser"
def usage
- $stderr.print $intl._("Usage: "), File.basename($0),
- $intl._(" [options] <command> [arguments]"),
+ $stderr.print _("Usage: "), File.basename($0),
+ _(" [options] <command> [arguments]"),
"\n",
- $intl._("Options:\n"),
- $intl._(" -h : Display this help and exit.\n"),
- $intl._(" -v : Show version number and exit\n"),
- sprintf($intl._(" -s <severities> : Severities you want to see [%s], or [all].\n"), @severity.join(',')),
- $intl._(" -T <tags> : Tags you want to see.\n"),
- sprintf($intl._(" -S <stats> : Stats you want to see [%s].\n"), @stats.join(',')),
- $intl._(" -D : Show downgraded packages, too.\n"),
- sprintf($intl._(" -H <hostname> : Hostname of Debian Bug Tracking System [%s].\n"), @hostname),
- sprintf($intl._(" -p <port> : Port number of the server [%s]\n"), @port),
- sprintf($intl._(" --pin-priority : Specifies Pin-Priority value [%s]\n"), @pin_priority),
- $intl._(" --title : Specifies the title of rss output.\n"),
- $intl._(" -f : Retrieve bug reports from BTS forcibly.\n"),
- $intl._(" -q : Don't display progress bar.\n"),
- $intl._(" -C <apt.conf> : Specify apt.conf.\n"),
- $intl._(" -y : Assume that you select yes for all questions.\n"),
- $intl._(" -n : Assume that you select no for all questions.\n"),
- $intl._(" -d : Debug.\n"),
- $intl._("Commands:\n"),
- $intl._(" apt : apt mode\n"),
- $intl._(" list <pkg...> : list bug reports of the specified packages\n"),
- $intl._(" rss <pkg...> : list bug reports of the specified packages in rss\n"),
- $intl._("See the manual page for the long options.\n")
+ _("Options:\n"),
+ _(" -h : Display this help and exit.\n"),
+ _(" -v : Show version number and exit\n"),
+ sprintf(_(" -s <severities> : Severities you want to see [%s], or [all].\n"), @severity.join(',')),
+ _(" -T <tags> : Tags you want to see.\n"),
+ sprintf(_(" -S <stats> : Stats you want to see [%s].\n"), @stats.join(',')),
+ _(" -D : Show downgraded packages, too.\n"),
+ sprintf(_(" -H <hostname> : Hostname of Debian Bug Tracking System [%s].\n"), @hostname),
+ sprintf(_(" -p <port> : Port number of the server [%s]\n"), @port),
+ sprintf(_(" --pin-priority : Specifies Pin-Priority value [%s]\n"), @pin_priority),
+ _(" --title : Specifies the title of rss output.\n"),
+ _(" -f : Retrieve bug reports from BTS forcibly.\n"),
+ _(" -q : Don't display progress bar.\n"),
+ _(" -C <apt.conf> : Specify apt.conf.\n"),
+ _(" -y : Assume that you select yes for all questions.\n"),
+ _(" -n : Assume that you select no for all questions.\n"),
+ _(" -d : Debug.\n"),
+ _("Commands:\n"),
+ _(" apt : apt mode\n"),
+ _(" list <pkg...> : list bug reports of the specified packages\n"),
+ _(" rss <pkg...> : list bug reports of the specified packages in rss\n"),
+ _("See the manual page for the long options.\n")
end
def initialize
@@ -377,10 +377,10 @@
# http_proxy sanity check
if ENV["HTTP_PROXY"] != nil && ENV["http_proxy"] == nil
- $stderr.print $intl._("W: sanity check failed: environment variable http_proxy is unset and HTTP_PROXY is set.")
+ $stderr.print _("W: sanity check failed: environment variable http_proxy is unset and HTTP_PROXY is set.")
end
if ENV["http_proxy"] != nil && ENV["soap_use_proxy"] != "on"
- $stderr.print $intl._("W: sanity check failed: environment variable http_proxy is set and soap_use_proxy is not 'on'.")
+ $stderr.print _("W: sanity check failed: environment variable http_proxy is set and soap_use_proxy is not 'on'.")
end
# http_proxy check
@@ -411,7 +411,7 @@
command = ARGV.shift
case command
when nil
- STDERR.puts $intl._("E: You need to specify a command.")
+ STDERR.puts _("E: You need to specify a command.")
usage
exit 1
when "list"
@@ -421,7 +421,7 @@
when "rss"
@command = "rss"
else
- STDERR.puts $intl._("E: Unknown command ") + "'#{command}'."
+ STDERR.puts _("E: Unknown command ") + "'#{command}'."
usage
exit 1
end
@@ -484,7 +484,7 @@
rescue Errno::EACCES
# write-access is not possible, ignore it for now.
if @gavewarning.nil?
- $stderr.puts $intl._("W: Cannot write to bug ignore list file")
+ $stderr.puts _("W: Cannot write to bug ignore list file")
@gavewarning = true
end
end
@@ -503,7 +503,7 @@
class SimpleViewer < Viewer
- DeprecatedWarning = $intl._("********** on_hold IS DEPRECATED. USE p INSTEAD to use pin **********")
+ DeprecatedWarning = _("********** on_hold IS DEPRECATED. USE p INSTEAD to use pin **********")
DeprecatedWarningHeader = "*" * DeprecatedWarning.length
def view(new_pkgs, cur_pkgs, bugs)
@@ -518,7 +518,7 @@
answer = "n"
hold_pkgs = []
while true
- ask_str = $intl._("Are you sure you want to install/upgrade the above packages?")
+ ask_str = _("Are you sure you want to install/upgrade the above packages?")
if @config.querybts != nil || @config.browser != nil
if hold_pkgs.empty?
ask_str << " [Y/n/?/...] "
@@ -560,15 +560,15 @@
if @config.querybts != nil
system("[EMAIL PROTECTED] #{$1} < /dev/tty")
else
- @config.frontend.puts sprintf($intl._("You must install the reportbug package to be able to do this"))
+ @config.frontend.puts sprintf(_("You must install the reportbug package to be able to do this"))
end
when /^i\s+(\d+)$/
if ! @config.system_ignore_bugs.include?($1)
@config.system_ignore_bugs.add($1)
Factory::BugsFactory.delete_ignore_bugs(bugs)
- @config.frontend.puts sprintf($intl._("%s ignored"), $1)
+ @config.frontend.puts sprintf(_("%s ignored"), $1)
else
- @config.frontend.puts sprintf($intl._("%s already ignored"), $1)
+ @config.frontend.puts sprintf(_("%s already ignored"), $1)
end
when "r"
display_bugs(bugs, new_pkgs.keys - hold_pkgs, cur_pkgs, new_pkgs)
@@ -613,7 +613,7 @@
}
end
if pkgs.size != 0
- if @config.frontend.yes_or_no? sprintf($intl._("The following %s packages will be pinned or on hold:\n %s\nAre you sure "), pkgs.size, pkgs.keys.join(', '))
+ if @config.frontend.yes_or_no? sprintf(_("The following %s packages will be pinned or on hold:\n %s\nAre you sure "), pkgs.size, pkgs.keys.join(', '))
if key == "h"
h = on_hold(pkgs.keys)
else
@@ -622,22 +622,22 @@
end
hold_pkgs.concat(h) if h != nil
else
- @config.frontend.puts sprintf($intl._("Every packages already pinned or on hold. Ignoring %s command."), key)
+ @config.frontend.puts sprintf(_("Every packages already pinned or on hold. Ignoring %s command."), key)
end
else
if hold_pkgs.empty?
- @config.frontend.puts $intl._(" y - continue the apt installation.\n")
+ @config.frontend.puts _(" y - continue the apt installation.\n")
end
@config.frontend.puts "" +
- $intl._(" n - stop the apt installation.\n") +
- $intl._(" <num> - query the specified bug number (requires reportbug).\n") +
- $intl._(" r - redisplay bug lists.\n") +
- $intl._(" p <pkg..> - make pkgs pinned: need to restart apt to enable.\n") +
- $intl._(" p - make all the above pkgs pinned. need to restart.\n") +
- $intl._(" i <num> - make bug_number <num> ignored.\n") +
- $intl._(" ? - print this help.\n")
+ _(" n - stop the apt installation.\n") +
+ _(" <num> - query the specified bug number (requires reportbug).\n") +
+ _(" r - redisplay bug lists.\n") +
+ _(" p <pkg..> - make pkgs pinned: need to restart apt to enable.\n") +
+ _(" p - make all the above pkgs pinned. need to restart.\n") +
+ _(" i <num> - make bug_number <num> ignored.\n") +
+ _(" ? - print this help.\n")
if @config.browser != nil
- @config.frontend.puts sprintf($intl._(" w - display bug lists in html (uses %s).\n"), File.basename(@config.browser))
+ @config.frontend.puts sprintf(_(" w - display bug lists in html (uses %s).\n"), File.basename(@config.browser))
end
end
end
@@ -655,7 +655,7 @@
holdstr = ""
pkgs.each { |pkg|
if cur_pkgs[pkg] == nil
- @config.frontend.puts sprintf($intl._("Package '%s' is newly installed, ignored"), pkg)
+ @config.frontend.puts sprintf(_("Package '%s' is newly installed, ignored"), pkg)
next
end
holdstr << "
@@ -674,7 +674,7 @@
if holdstr != ""
File.open("/etc/apt/preferences", "a") { |io|
io.puts holdstr
- @config.frontend.puts sprintf($intl._("%s pinned by adding Pin preferences in /etc/apt/preferences. You need to restart apt to enable"), pkgs.join(' '))
+ @config.frontend.puts sprintf(_("%s pinned by adding Pin preferences in /etc/apt/preferences. You need to restart apt to enable"), pkgs.join(' '))
return pkgs
}
end
@@ -687,7 +687,7 @@
holdstr << "#{pkg} hold\n"
}
if system("echo '#{holdstr}' | dpkg --set-selections")
- @config.frontend.puts sprintf($intl._("%s held: you need to restart apt to enable"), pkgs.join(' '))
+ @config.frontend.puts sprintf(_("%s held: you need to restart apt to enable"), pkgs.join(' '))
return pkgs
end
return nil
@@ -708,18 +708,18 @@
bugs_statistics[pkg] += 1
p_bug_numbers << bug.bug_number
if bug_exist == 0
- buf = sprintf($intl._("%s bugs of %s ("), severity, pkg)
+ buf = sprintf(_("%s bugs of %s ("), severity, pkg)
buf += "#{cur_pkgs[pkg]['version']} " if cur_pkgs[pkg] != nil
buf += "-> #{new_pkgs[pkg]['version']}) <#{bug.stat}>"
@config.frontend.puts buf
bug_exist = 1
end
bug_str = " ##{bug.bug_number} - #{bug.desc}"
- bug_str += sprintf($intl._(" (Found: %s)"), "#{bug.found}") if ( ! bug.found.nil? ) && $DEBUG
- bug_str += sprintf($intl._(" (Fixed: %s)"), "#{bug.fixed}") if ! bug.fixed.nil?
+ bug_str += sprintf(_(" (Found: %s)"), "#{bug.found}") if ( ! bug.found.nil? ) && $DEBUG
+ bug_str += sprintf(_(" (Fixed: %s)"), "#{bug.fixed}") if ! bug.fixed.nil?
@config.frontend.puts bug_str
if bug.mergeids.size > 0
- bug_str = $intl._(" Merged with:")
+ bug_str = _(" Merged with:")
bug.mergeids.each { |m|
bug_str << " #{m}"
p_bug_numbers << m
@@ -734,15 +734,15 @@
bugs_statistics.each { |pkg, num|
if num > 0
if num > 1
- buf = sprintf($intl._("%s(%s bugs)"), pkg, num)
+ buf = sprintf(_("%s(%s bugs)"), pkg, num)
else
- buf = sprintf($intl._("%s(%s bug)"), pkg, num)
+ buf = sprintf(_("%s(%s bug)"), pkg, num)
end
stat_str_ary << buf
end
}
if stat_str_ary.size > 0
- @config.frontend.puts $intl._("Summary:\n ") + stat_str_ary.join(', ')
+ @config.frontend.puts _("Summary:\n ") + stat_str_ary.join(', ')
return true
else
return false
@@ -754,9 +754,9 @@
sub = bugs.sub("stat", stat)
if sub.size > 0
o.puts "<table border=2 width=100%>"
- o.puts sprintf($intl._(" <caption>Bug reports which are marked as %s "), stat) +
- $intl._("in the bug tracking system</caption>")
- o.puts $intl._(" <tr><th>package</th><th>severity</th><th>bug number</th><th>description</th></tr>")
+ o.puts sprintf(_(" <caption>Bug reports which are marked as %s "), stat) +
+ _("in the bug tracking system</caption>")
+ o.puts _(" <tr><th>package</th><th>severity</th><th>bug number</th><th>description</th></tr>")
yield sub
o.puts "</table><br>"
end
@@ -770,10 +770,10 @@
displayed_pkgs = []
tmp = HtmlTempfile.new("apt-listbugs")
- tmp.puts "<html><head><title>"+$intl._("critical bugs for your upgrade")+"</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=#{Locale::LangInfo.langinfo(Locale::LangInfo::CODESET)}\"></head><body>"
- tmp.puts $intl._("<h1 align=\"center\">Critical bugs for your upgrade</h1>")
- tmp.puts $intl._("<p align=\"right\">by apt-listbugs</p><hr>")
- tmp.puts $intl._("<h2>Bug reports</h2>")
+ tmp.puts "<html><head><title>"+_("critical bugs for your upgrade")+"</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=#{Locale.codeset}\"></head><body>"
+ tmp.puts _("<h1 align=\"center\">Critical bugs for your upgrade</h1>")
+ tmp.puts _("<p align=\"right\">by apt-listbugs</p><hr>")
+ tmp.puts _("<h2>Bug reports</h2>")
each_state_table(tmp, bugs, @config.stats) { |bugs|
bugs.each { |bug|
@@ -782,7 +782,7 @@
}
}
- tmp.puts $intl._("<h2>Package upgrade information in question</h2>")
+ tmp.puts _("<h2>Package upgrade information in question</h2>")
tmp.puts "<ul>"
displayed_pkgs.each { |pkg|
tmp.puts "<li>#{pkg}("
@@ -803,7 +803,7 @@
if system(browsercommandline)
puts "successfully invoked www-browswer" if $DEBUG
else
- $stderr.puts $intl._("W: Failed to invoke www-browser.")
+ $stderr.puts _("W: Failed to invoke www-browser.")
$stderr.puts " #{browsercommandline}"
end
end
@@ -870,7 +870,7 @@
module Factory
- Done = $intl._("Done")
+ Done = _("Done")
CONCURRENCY_LEVEL = 3
def done?(done)
@@ -886,7 +886,7 @@
end
def create(arg, *args)
- raise $intl._("Not Implemented")
+ raise _("Not Implemented")
end
module_function :config, :config=, :create, :done?
@@ -938,7 +938,7 @@
# obtain package names and get information about them
step = 100.0 / pkgnames.size.to_f
pkgs = {}
- reading = $intl._("Reading package fields...")
+ reading = _("Reading package fields...")
pkgnames.each_index { |index|
if block_given?
yield reading, (index * step).to_i.to_s + "%"
@@ -953,7 +953,7 @@
when "rss"
f = ListFactory.field(pkgnames[index])
else
- raise $intl._("Not Implemented")
+ raise _("Not Implemented")
end
pkgs[f["package"]] = f
}
@@ -976,7 +976,7 @@
module StatusFactory
extend Factory
- ReadStatusMsg = $intl._("Reading package status...")
+ ReadStatusMsg = _("Reading package status...")
def create(pkgs, *args)
# creating status database, which contains the list of packages.
@@ -1021,7 +1021,7 @@
module BugsFactory
extend Factory
- RetrvBTSMsg = $intl._("Retrieving bug reports...")
+ RetrvBTSMsg = _("Retrieving bug reports...")
def create(new_pkgs, *args, &progress)
cur_pkgs = args[0]
@@ -1043,34 +1043,34 @@
yield RetrvBTSMsg, pct
}
rescue SOAP::HTTPStreamError => exception
- config.frontend.puts $intl._(" Fail")
+ config.frontend.puts _(" Fail")
config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
- $stderr.puts $intl._(" E: HTTP GET failed")
+ $stderr.puts _(" E: HTTP GET failed")
retrycount -= 1
- retry if config.frontend.yes_or_no?($intl._("Retry downloading bug information?")) && retrycount > 0
- raise $intl._("Exiting with error") if config.frontend.yes_or_no?($intl._("Abort the installation"))
+ retry if config.frontend.yes_or_no?(_("Retry downloading bug information?")) && retrycount > 0
+ raise _("Exiting with error") if config.frontend.yes_or_no?(_("Abort the installation"))
bugs = []
rescue SOAP::EmptyResponseError => exception
- config.frontend.puts $intl._(" Fail")
+ config.frontend.puts _(" Fail")
config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
- $stderr.puts $intl._(" E: Empty stream from SOAP")
+ $stderr.puts _(" E: Empty stream from SOAP")
retrycount -= 1
- retry if config.frontend.yes_or_no?($intl._("Retry downloading bug information?")) && retrycount > 0
- raise $intl._("Exiting with error") if config.frontend.yes_or_no?($intl._("Abort the installation"))
+ retry if config.frontend.yes_or_no?(_("Retry downloading bug information?")) && retrycount > 0
+ raise _("Exiting with error") if config.frontend.yes_or_no?(_("Abort the installation"))
bugs = []
rescue Exception => exception
- config.frontend.puts $intl._(" Fail")
+ config.frontend.puts _(" Fail")
config.frontend.puts " Exception: " + exception.class.to_s if $DEBUG
- config.frontend.puts $intl._("Error retrieving bug reports from the server with the following error message:")
+ config.frontend.puts _("Error retrieving bug reports from the server with the following error message:")
config.frontend.puts " W: #{$!}"
if exception.kind_of? SocketError
- config.frontend.puts $intl._("It appears that your network connection is down. Check network configuration and try again")
+ config.frontend.puts _("It appears that your network connection is down. Check network configuration and try again")
else
- config.frontend.puts $intl._("It could be because your network is down, or because of broken proxy servers, or the BTS server itself is down. Check network configuration and try again")
+ config.frontend.puts _("It could be because your network is down, or because of broken proxy servers, or the BTS server itself is down. Check network configuration and try again")
end
retrycount -= 1
- retry if config.frontend.yes_or_no?($intl._("Retry downloading bug information?")) && retrycount > 0
- raise $intl._("Exiting with error") if config.frontend.yes_or_no?($intl._("Abort the installation"))
+ retry if config.frontend.yes_or_no?(_("Retry downloading bug information?")) && retrycount > 0
+ raise _("Exiting with error") if config.frontend.yes_or_no?(_("Abort the installation"))
bugs = []
end
yield RetrvBTSMsg, "100%"
@@ -1124,7 +1124,7 @@
fixed_max
end
- BugFixedParseMsg = $intl._("Parsing Found/Fixed information...")
+ BugFixedParseMsg = _("Parsing Found/Fixed information...")
def delete_threshold_bugs (bugs, cur_pkgs, new_pkgs)
# Ignore bugs that do not apply to the installing version.
@@ -1303,7 +1303,7 @@
exit 0
end
# handle options
-config = Config.new
+config = AppConfig.new
config.parse_options
Factory.config = config
@@ -1322,7 +1322,7 @@
if pkg == "VERSION 2"
state=2
else
- $stderr.print $intl._("E: apt Pre-Install-Pkgs is not giving me expected 'VERSION 2' string.\n")
+ $stderr.print _("E: apt Pre-Install-Pkgs is not giving me expected 'VERSION 2' string.\n")
exit 1
end
when 2
@@ -1412,7 +1412,7 @@
viewer = Viewer::RSSViewer.new(config)
end
if viewer.view(new_pkgs, cur_pkgs, bugs) == false
- ErrorWarning = $intl._("****** Exit with an error by force in order to stop the installation. ******")
+ ErrorWarning = _("****** Exit with an error by force in order to stop the installation. ******")
ErrorWarningHeader = "*" * ErrorWarning.length
config.frontend.puts ErrorWarningHeader
config.frontend.puts ErrorWarning
diff -ur apt-listbugs-0.0.86/debian/changelog apt-listbugs-0.0.86.1/debian/changelog
--- apt-listbugs-0.0.86/debian/changelog 2008-02-02 17:59:57.000000000 +0900
+++ apt-listbugs-0.0.86.1/debian/changelog 2008-03-23 03:51:14.000000000 +0900
@@ -1,3 +1,9 @@
+apt-listbugs (0.0.86.1) unstable; urgency=low
+
+ * Transit to libgettext-ruby from liblocale-ruby + libintl-gettext-ruby.
+
+ -- Tatsuki Sugiura <[EMAIL PROTECTED]> Sun, 23 Mar 2008 03:32:46 +0900
+
apt-listbugs (0.0.86) unstable; urgency=low
* Update README.Debian to add instructions on debugging.
diff -ur apt-listbugs-0.0.86/debian/control apt-listbugs-0.0.86.1/debian/control
--- apt-listbugs-0.0.86/debian/control 2008-01-26 14:08:37.000000000 +0900
+++ apt-listbugs-0.0.86.1/debian/control 2008-03-23 03:49:58.000000000 +0900
@@ -10,7 +10,7 @@
Package: apt-listbugs
Architecture: all
-Depends: ruby (>= 1.8), libruby1.8 (>= 1.8.5), libdpkg-ruby1.8 (>= 0.3.2), apt, libzlib-ruby1.8, libintl-gettext-ruby1.8, libxml-parser-ruby1.8, libhttp-access2-ruby1.8 (>= 2.0.6), liblocale-ruby1.8
+Depends: ruby (>= 1.8), libruby1.8 (>= 1.8.5), libdpkg-ruby1.8 (>= 0.3.2), apt, libzlib-ruby1.8, libgettext-ruby1.8, libxml-parser-ruby1.8, libhttp-access2-ruby1.8 (>= 2.0.6)
Suggests: reportbug, debianutils (>= 2.0) | www-browser | w3m
Description: Lists critical bugs before each apt installation
apt-listbugs is a tool which retrieves bug reports from the Debian Bug