[Reportbug-commits] [reportbug] 01/27: utils.get_package_status(): properly capture package description
Sandro Tosi
morph at moszumanska.debian.org
Mon May 29 20:14:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository reportbug.
commit 3807e51157802aed4e26f214797424e862b65a8d
Author: Nis Martensen <nis.martensen at web.de>
Date: Fri May 26 19:08:56 2017 +0200
utils.get_package_status(): properly capture package description
The code trying to capture the package description has two issues:
1. The regexp used for detecting the description field also matches on
the Description-md5 field, which it should not.
2. Lines starting with a space are assumed to belong to the long
package description, even if they actually belong to another field
listed after the description.
This can be fixed by only matching a Description field with alphabetic
characters before the colon, and a "descmode" similar to the already
existing "confmode" in the parser.
---
reportbug/utils.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/reportbug/utils.py b/reportbug/utils.py
index e134bcd..5ff3dbe 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -338,7 +338,7 @@ def get_package_status(package, avail=False):
statusre = re.compile('Status: ')
originre = re.compile('Origin: ')
bugsre = re.compile('Bugs: ')
- descre = re.compile('Description(?:-.*)?: ')
+ descre = re.compile('Description(?:-[a-zA-Z]+)?: ')
fullre = re.compile(' ')
srcre = re.compile('Source: ')
sectionre = re.compile('Section: ')
@@ -351,6 +351,7 @@ def get_package_status(package, avail=False):
recommends = []
suggests = []
confmode = False
+ descmode = False
state = ''
try:
@@ -371,6 +372,12 @@ def get_package_status(package, avail=False):
if not line:
continue
+ if descmode:
+ if line[0] == ' ':
+ fulldesc.append(line)
+ else:
+ descmode = False
+
if confmode:
if line[:2] != ' /':
confmode = False
@@ -392,6 +399,7 @@ def get_package_status(package, avail=False):
(crud, bugs) = line.split(": ", 1)
elif descre.match(line):
(crud, desc) = line.split(": ", 1)
+ descmode = True
elif dependsre.match(line):
(crud, thisdepends) = line.split(": ", 1)
# Remove versioning crud
@@ -419,8 +427,6 @@ def get_package_status(package, avail=False):
src_name = src_name.split()[0]
elif sectionre.match(line):
crud, section = line.split(": ", 1)
- elif desc and line[0] == ' ':
- fulldesc.append(line)
installed = False
if status:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reportbug/reportbug.git
More information about the Reportbug-commits
mailing list