[Reportbug-commits] [reportbug] 01/01: don't split multiarch information on multiple lines; thanks to James Cowgill for the report; Closes: #759690

Sandro Tosi morph at moszumanska.debian.org
Thu Nov 6 22:31:48 UTC 2014


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

morph pushed a commit to branch master
in repository reportbug.

commit 0066f8894734178258a2ec5633dd9dab26a498fe
Author: Sandro Tosi <morph at debian.org>
Date:   Thu Nov 6 22:09:43 2014 +0000

    don't split multiarch information on multiple lines; thanks to James Cowgill for the report; Closes: #759690
---
 debian/changelog   |  8 ++++++++
 reportbug/utils.py |  4 +++-
 test/test_utils.py | 20 ++++++++++++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 741687f..2609f94 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+reportbug (6.6.1) UNRELEASED; urgency=medium
+
+  * reportbug/utils.py
+    - don't split multiarch information on multiple lines; thanks to James
+      Cowgill for the report; Closes: #759690
+
+ -- Sandro Tosi <morph at debian.org>  Thu, 06 Nov 2014 22:08:34 +0000
+
 reportbug (6.6.0) unstable; urgency=medium
 
   * bin/reportbug, man/reportbug.1 share/reportbug.el
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 47c5937..fa81091 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -765,7 +765,9 @@ def get_arch():
     return arch
 
 def get_multiarch():
-    return commands.getoutput('COLUMNS=79 dpkg --print-foreign-architectures 2>/dev/null')
+    out = commands.getoutput('COLUMNS=79 dpkg --print-foreign-architectures 2>/dev/null')
+    print '>' + str(out) + '<'
+    return ', '.join(out.splitlines())
 
 def generate_blank_report(package, pkgversion, severity, justification,
                           depinfo, confinfo, foundfile='', incfiles='',
diff --git a/test/test_utils.py b/test/test_utils.py
index ac07fce..eae3d91 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -5,6 +5,8 @@ import os.path
 import platform
 from nose.plugins.attrib import attr
 import debianbts
+import mock
+import commands
 
 class TestUtils(unittest2.TestCase):
 
@@ -264,6 +266,24 @@ class TestSystemInformation(unittest2.TestCase):
 
         self.assertIn(platform.release(), package)
 
+    def test_get_multiarch(self):
+
+        orig = commands.getoutput
+
+        commands.getoutput = mock.MagicMock(return_value = '')
+        multiarch = utils.get_multiarch()
+        self.assertEqual(multiarch, '')
+
+        commands.getoutput = mock.MagicMock(return_value = 'i386')
+        multiarch = utils.get_multiarch()
+        self.assertEqual(multiarch, 'i386')
+
+        commands.getoutput = mock.MagicMock(return_value = 'i386\namd64')
+        multiarch = utils.get_multiarch()
+        self.assertItemsEqual(multiarch.split(', '), ['i386', 'amd64'])
+
+        commands.getoutput = orig
+
 class TestMua(unittest2.TestCase):
 
     def test_mua_is_supported(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