[Apt-listbugs-commits] [apt-listbugs] 01/01: use ruby-unicode to compute string display widths

Francesco Poli frx-guest at moszumanska.debian.org
Tue Jun 10 20:01:05 UTC 2014


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

frx-guest pushed a commit to branch master
in repository apt-listbugs.

commit 9cc6e5aee2e9c7b48da407127b7a8876ec2202ef
Author: Francesco Poli (wintermute) <invernomuto at paranoici.org>
Date:   Tue Jun 10 21:58:20 2014 +0200

    use ruby-unicode to compute string display widths
---
 apt-listbugs              | 7 ++++---
 debian/changelog          | 2 ++
 debian/control            | 4 ++--
 lib/apt-listbugs/logic.rb | 5 +++--
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/apt-listbugs b/apt-listbugs
index 94d66e5..04e1cd9 100755
--- a/apt-listbugs
+++ b/apt-listbugs
@@ -319,13 +319,14 @@ GetText::bindtextdomain("apt-listbugs")
 
 begin
   require 'debian'
+  require 'unicode'
 rescue LoadError
   # TRANSLATORS: "E: " is a label for error messages; you may translate it with a suitable abbreviation of the word "error"
   $stderr.puts _("E: ") + "#{$!}"
-  $stderr.puts _("This may be caused by a ruby-debian package lacking support for the ruby interpreter in use. Try to fix the situation with the following commands:")
+  $stderr.puts _("This may be caused by a package lacking support for the ruby interpreter in use. Try to fix the situation with the following commands:")
   $stderr.puts "  # mv /etc/apt/apt.conf.d/10apt-listbugs /root/"
   $stderr.puts "  # aptitude update"
-  $stderr.puts "  # aptitude install ruby-debian ruby"
+  $stderr.puts "  # aptitude install ruby-debian ruby-unicode ruby"
   $stderr.puts "  # mv /root/10apt-listbugs /etc/apt/apt.conf.d/"
   exit 1
 end
@@ -525,7 +526,7 @@ when "rss"
 end
 if viewer.view(new_pkgs, cur_pkgs, bugs) == false
   ErrorWarning =  _("****** Exiting with an error in order to stop the installation. ******")
-  ErrorWarningHeader = "*" * ErrorWarning.length
+  ErrorWarningHeader = "*" * Unicode.width(ErrorWarning)
   config.frontend.puts ErrorWarningHeader
   config.frontend.puts ErrorWarning
   config.frontend.puts ErrorWarningHeader
diff --git a/debian/changelog b/debian/changelog
index 7cc99d1..1628cc8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,8 @@ apt-listbugs (0.1.14) UNRELEASED; urgency=medium
     installations/upgrades will automatically pin buggy packages!)
   * enhanced internationalization of error and warning messages
   * enhanced error handling (also catch Errno::EBADF in apt mode)
+  * added a dependency on ruby-unicode to correctly compute the width
+    of asterisk headers and of output to be updated
 
  -- Francesco Poli (wintermute) <invernomuto at paranoici.org>  Sun, 11 May 2014 16:45:18 +0200
 
diff --git a/debian/control b/debian/control
index 12041f7..d801b2d 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: admin
 Priority: optional
 Maintainer: Francesco Poli (wintermute) <invernomuto at paranoici.org>
 Build-Depends: debhelper (>= 7.0.50)
-Build-Depends-Indep: ruby, rdtool, gettext, ruby-debian (>= 0.3.3), ruby-gettext (>= 3.0.2), ruby-test-unit, ruby-soap4r
+Build-Depends-Indep: ruby, rdtool, gettext, ruby-debian (>= 0.3.3), ruby-gettext (>= 3.0.2), ruby-test-unit, ruby-soap4r, ruby-unicode
 Standards-Version: 3.9.5
 Vcs-Git: git://anonscm.debian.org/apt-listbugs/apt-listbugs.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=apt-listbugs/apt-listbugs.git
@@ -11,7 +11,7 @@ Homepage: http://alioth.debian.org/projects/apt-listbugs/
 
 Package: apt-listbugs
 Architecture: all
-Depends: ${misc:Depends}, ruby | ruby-interpreter, ruby-debian (>= 0.3.3), apt (>= 0.9.11), ruby-gettext (>= 3.0.2), ruby-soap4r
+Depends: ${misc:Depends}, ruby | ruby-interpreter, ruby-debian (>= 0.3.3), apt (>= 0.9.11), ruby-gettext (>= 3.0.2), ruby-soap4r, ruby-unicode
 Recommends: ruby-xmlparser, ruby-httpclient (>= 2.1.5.2-1)
 Suggests: reportbug, debianutils (>= 2.0) | www-browser | w3m
 Breaks: libapt-pkg4.12 (<< 0.9.11)
diff --git a/lib/apt-listbugs/logic.rb b/lib/apt-listbugs/logic.rb
index 6f3f7c5..dfd76f7 100644
--- a/lib/apt-listbugs/logic.rb
+++ b/lib/apt-listbugs/logic.rb
@@ -26,6 +26,7 @@
 
 require 'getoptlong'
 require 'debian'
+require 'unicode'
 require 'debian/bug'
 require 'debian/bts'
 require 'thread'
@@ -371,7 +372,7 @@ class Viewer
   class SimpleViewer < Viewer
 
     DeprecatedWarning = _("********** on_hold IS DEPRECATED. USE p INSTEAD to use pin **********")
-    DeprecatedWarningHeader = "*" * DeprecatedWarning.length
+    DeprecatedWarningHeader = "*" * Unicode.width(DeprecatedWarning)
 
     def view(new_pkgs, cur_pkgs, bugs)
       if display_bugs(bugs, new_pkgs.keys, cur_pkgs, new_pkgs) == false
@@ -1121,7 +1122,7 @@ class ConsoleFrontend
 
   def progress(msg, val)
     $stderr.print "\r"
-    $stderr.print " " * @old.length
+    $stderr.print " " * Unicode.width(@old)
     $stderr.print "\r"
     @old = "#{msg} #{val}"
     $stderr.print @old

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/apt-listbugs/apt-listbugs.git



More information about the Apt-listbugs-commits mailing list