[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 6.0-19-ge600e18

Sandro Tosi morph at debian.org
Wed Aug 17 14:44:22 UTC 2011


The following commit has been merged in the master branch:
commit c55ea24b6a06c1812f96218ce16829b9faebd2a8
Author: Sandro Tosi <morph at debian.org>
Date:   Wed Aug 17 16:01:58 2011 +0200

    automatically select the package for the running kernel if selecting 'kernel' or 'linux-image' packages; thanks to Ben Hutchings for the report; Closes: #619870

diff --git a/bin/reportbug b/bin/reportbug
index 7d41f69..56ad82a 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -460,8 +460,9 @@ def get_package_name(bts='debian', mode=MODE_EXPERT):
         package = validate_package_name(package)
 
     if package in ('kernel', 'linux-image'):
-        ui.long_message("%s package has been removed, use linux-2.6 instead (replaced here automatically).", package)
-        package = 'linux-2.6'
+        ui.long_message(
+            "Automatically selecting the package for the running kernel")
+        package = utils.get_running_kernel_pkg()
 
     if mode < MODE_STANDARD:
         if package == 'reportbug':
@@ -1258,8 +1259,9 @@ class UI(object):
             package = get_other_package_name(others)
 
         if package in ('kernel', 'linux-image'):
-            ui.long_message("%s package has been removed, use linux-2.6 instead (replaced here automatically).", package)
-            package = 'linux-2.6'
+            ui.long_message(
+                "Automatically selecting the package for the running kernel")
+            package = utils.get_running_kernel_pkg()
 
         if not package:
             efail("No package specified or we were unable to find it in the apt"
diff --git a/debian/changelog b/debian/changelog
index 1e00403..a1be586 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,8 +26,12 @@ reportbug (6.1) UNRELEASED; urgency=low
     - when sending/writing the report fails, output the message in the UI, so
       also GTK+ and urwid users can see the failure and where the report is
       saved; thanks to Stefan Monnier for the report; Closes: #626930
+  * bin/reportbug, reportbug/utils.py
+    - automatically select the package for the running kernel if selecting
+      'kernel' or 'linux-image' packages; thanks to Ben Hutchings for the
+      report; Closes: #619870
 
- -- Sandro Tosi <morph at debian.org>  Tue, 16 Aug 2011 22:05:27 +0200
+ -- Sandro Tosi <morph at debian.org>  Wed, 17 Aug 2011 15:51:57 +0200
 
 reportbug (6.0) unstable; urgency=low
 
diff --git a/reportbug/utils.py b/reportbug/utils.py
index 6080374..32b377d 100644
--- a/reportbug/utils.py
+++ b/reportbug/utils.py
@@ -1110,3 +1110,17 @@ def launch_mbox_reader(cmd, url, http_proxy, timeout):
         os.system('mail -f ' + fname)
     finally:
         os.unlink(fname)
+
+def get_running_kernel_pkg():
+    """Return the package of the currently running kernel, needed to force
+    assignment for 'kernel' package to a real one"""
+
+    system = platform.system()
+    release = platform.release()
+
+    if system == 'Linux':
+        return 'linux-image-' + release
+    elif system == 'GNU/kFreeBSD':
+        return 'kfreebsd-image-' + release
+    else:
+        return None
diff --git a/test/test_utils.py b/test/test_utils.py
index 39edc8f..5e92fca 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -2,6 +2,7 @@ import unittest2
 
 from reportbug import utils
 import os.path
+import platform
 
 class TestUtils(unittest2.TestCase):
 
@@ -255,6 +256,12 @@ class TestSystemInformation(unittest2.TestCase):
         res = utils.lsb_release_info()
         self.assertIn('Debian', res)
 
+    def test_get_running_kernel_pkg(self):
+
+        package = utils.get_running_kernel_pkg()
+
+        self.assertIn(platform.release(), package)
+
 class TestMua(unittest2.TestCase):
 
     def test_mua_is_supported(self):

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list