One more patch on top, with some improvements.
>From 1e965eb715d80dd07f4b930db0e22a8011c03bae Mon Sep 17 00:00:00 2001
From: Nis Martensen <nis.marten...@web.de>
Date: Sun, 28 May 2017 13:07:25 +0200
Subject: [PATCH 3/3] utils.py: Do not use localized package description

.. and unify the regexps used for getting the description, so that we
never accidentally use the Description-md5 field.
---
 reportbug/utils.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/reportbug/utils.py b/reportbug/utils.py
index 51c9d23..e238a8d 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -362,7 +362,7 @@ def get_package_status(package, avail=False):
     packarg = pipes.quote(package)
     if avail:
         output = get_command_output(
-            "apt-cache show %s 2>/dev/null" % packarg)
+            "LC_ALL=C.UTF-8 apt-cache show %s 2>/dev/null" % packarg)
     else:
         output = get_command_output(
             "COLUMNS=79 dpkg --status %s 2>/dev/null" % packarg)
@@ -525,7 +525,7 @@ def get_avail_database():
 
 def available_package_description(package):
     data = get_command_output('apt-cache show ' + pipes.quote(package))
-    descre = re.compile('^Description(?:-.*)?: (.*)$')
+    descre = re.compile('^Description(?:-[a-zA-Z]+)?: (.*)$')
     for line in data.split('\n'):
         m = descre.match(line)
         if m:
@@ -599,7 +599,7 @@ def get_package_info(packages, skip_notfound=False):
     packob = re.compile('^Package: (?P<pkg>.*)$', re.MULTILINE)
     statob = re.compile('^Status: (?P<stat>.*)$', re.MULTILINE)
     versob = re.compile('^Version: (?P<vers>.*)$', re.MULTILINE)
-    descob = re.compile('^Description(?:-.*)?: (?P<desc>.*)$', re.MULTILINE)
+    descob = re.compile('^Description(?:-[a-zA-Z]+)?: (?P<desc>.*)$', re.MULTILINE)
 
     ret = []
     for p in packinfo:
-- 
2.1.4

_______________________________________________
Reportbug-maint mailing list
Reportbug-maint@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reportbug-maint

Reply via email to