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

Sandro Tosi morph at debian.org
Wed Aug 24 21:17:25 UTC 2011


The following commit has been merged in the master branch:
commit f2c2031484adbab8b16d13de7db79e9b60c7fb19
Author: Sandro Tosi <morph at debian.org>
Date:   Wed Aug 24 23:16:37 2011 +0200

    when using --src don't present the menu with possible binary packages (and also try to be smart and infer the version from the bin pkgs list); thanks to Vincent Lefevre for the report; Closes: #638616
    
    In case --src is used, we don't want to suggests bin pkgs, but we translate the
    pkg passed as args into its source pkg (already done) and then we short-circuit
    the checks.
    
    The trick for getting the src pkg version right (since we don't have a utils
    function to retrieve source packages information, like for bin) is done looping
    over the bin pkgs (that we retrive anyhow) and find the first version, and use
    it as the src one.

diff --git a/bin/reportbug b/bin/reportbug
index 56ad82a..4561372 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -1402,7 +1402,18 @@ class UI(object):
             if not pkgavail and not isvirtual:
                 # Look for a matching source package
                 packages = utils.get_source_package(package)
-                if len(packages) > 0:
+                if self.options.source:
+                    issource = True
+                    # package is already ok here, just need the version
+                    # so we loop over the bin pkgs looking for one installed
+                    # and then get its version
+                    if len(packages) > 0:
+                        for p in packages:
+                            v = utils.get_package_status(p[0])[0]
+                            if v:
+                                pkgversion = v
+                                break
+                elif len(packages) > 0:
                     src = package
                     if len(packages) and not notatty:
                         packages.sort()
@@ -1492,9 +1503,11 @@ class UI(object):
                     efail("Package does not exist; stopping.\n")
                     sys.exit(1)
 
-            (pkgversion, pkgavail, depends, recommends, conffiles, maintainer,
-             installed, origin, vendor, reportinfo, priority, desc, src_name,
-             fulldesc, state, suggests, section) = status
+            # we can use status only if it's not a source pkg
+            if not issource:
+                (pkgversion, pkgavail, depends, recommends, conffiles, maintainer,
+                 installed, origin, vendor, reportinfo, priority, desc, src_name,
+                 fulldesc, state, suggests, section) = status
 
         buginfo = '/usr/share/bug/' + package
         bugexec = submitas = submitto = presubj = None
@@ -1554,7 +1567,8 @@ class UI(object):
                     efail("Package integrity check failed; stopping.\n")
 
         if not pkgversion or usedavail or (not pkgavail and
-                                           not self.options.pkgversion):
+                                           not self.options.pkgversion and
+                                           not self.options.source):
             if not bugnumber and not (isvirtual or notatty):
                 pkgversion = ui.get_string('Please enter the version of the '
                                            'package this report applies to '
diff --git a/debian/changelog b/debian/changelog
index 2fc03bc..a74fb0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,8 +12,12 @@ reportbug (6.2) UNRELEASED; urgency=low
   * reportbug/checkversions.py
     - ignore if we can't compare the version of a currently installed package;
       thanks to Josh Triplett for the report; Closes: #638575
+  * bin/reportbug
+    - when using --src don't present the menu with possible binary packages (and
+      also try to be smart and infer the version from the bin pkgs list); thanks
+      to Vincent Lefevre for the report; Closes: #638616
 
- -- Sandro Tosi <morph at debian.org>  Wed, 24 Aug 2011 19:08:30 +0200
+ -- Sandro Tosi <morph at debian.org>  Wed, 24 Aug 2011 23:13:37 +0200
 
 reportbug (6.1) unstable; urgency=low
 

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list