[Reportbug-commits] [reportbug] 02/02: correctly identify conffiles marked as obsolete; thanks to Jakub Wilk for the report; Closes: #791577
Sandro Tosi
morph at moszumanska.debian.org
Sun Aug 30 01:39:43 UTC 2015
This is an automated email from the git hooks/post-receive script.
morph pushed a commit to branch master
in repository reportbug.
commit 4679f26e155de6d11b699a3492383d6d904f1995
Author: Sandro Tosi <morph at debian.org>
Date: Sun Aug 30 02:39:35 2015 +0100
correctly identify conffiles marked as obsolete; thanks to Jakub Wilk for the report; Closes: #791577
---
debian/changelog | 5 ++++-
reportbug/utils.py | 2 +-
test/test_utils.py | 25 +++++++++++++++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index efccae0..b85f935 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,8 +13,11 @@ reportbug (6.6.5) UNRELEASED; urgency=medium
- special-case also the short alias -T along with --tag; this fixes a crash
in 'debian-bug' in Emacs; thanks to Sven Joachim for report and patch;
Closes: #794590
+ * reportbug/utils.py
+ - correctly identify conffiles marked as obsolete; thanks to Jakub Wilk for
+ the report; Closes: #791577
- -- Sandro Tosi <morph at debian.org> Sun, 30 Aug 2015 01:09:54 +0100
+ -- Sandro Tosi <morph at debian.org> Sun, 30 Aug 2015 02:39:06 +0100
reportbug (6.6.4) unstable; urgency=medium
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 5457faa..f80ea14 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -359,7 +359,7 @@ def get_package_status(package, avail=False):
confmode = False
else:
# re is used to identify also conffiles with spaces in the name
- conffiles = conffiles + [re.findall(' (.+) ([^ ]+)$', line)[0]]
+ conffiles = conffiles + [re.findall(r' (.+) ([^ |^(obsolete)]+).*$', line)[0]]
if versionre.match(line):
(crud, pkgversion) = line.split(": ", 1)
diff --git a/test/test_utils.py b/test/test_utils.py
index 443d5aa..d10cbe2 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -148,6 +148,31 @@ class TestPackages(unittest2.TestCase):
self.assertIsNotNone(recommends)
+ def test_bts791577(self):
+ """Verify obsolete config files are correctly parsed"""
+
+ # bonus points for testing also conffiles with spaces in the filename
+ pkgstatus = """Conffiles:
+ /etc/reportbug.conf 17b8e0850fa74d18b96ce5856321de0d
+ /etc/reportbug with spaces.conf feedcafefeedcafefeedcafefeedcafe
+ /etc/reportbug.conf.obsolete deadbeefdeadbeefdeadbeefdeadbeef obsolete
+ /etc/reportbug with spaces and obsolete.conf cafebabecafebabecafebabecafebabe obsolete
+ """
+
+ pkg = 'reportbug'
+
+ expected_conffiles = [u'/etc/reportbug.conf',
+ u'/etc/reportbug with spaces.conf',
+ u'/etc/reportbug.conf.obsolete',
+ u'/etc/reportbug with spaces and obsolete.conf']
+
+ __save = commands.getoutput
+ commands.getoutput = mock.MagicMock(return_value=pkgstatus)
+ result = utils.get_package_status(pkg)
+ conffile = [x[0] for x in result[4]]
+ self.assertListEqual(conffile, expected_conffiles)
+ commands.getoutput = __save
+ del __save
def test_get_changed_config_files(self):
--
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