[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#581831: python-apt: apt.Package.get_changelog only checks the first source record



Package: python-apt
Version: 0.7.94.3
Severity: normal
Tags: patch upstream

If there is an upgradable package which is availabe in two repositories
e.g. lenny and lenny/updates, the changelog from the older
source version would be downloaded. This leads to an empty changelog.

The apt.package.Package.get_changelog method tries to get the correct
section from the source record, but it only checks the first source
record of a binary package name and doesn't check if it is older than the
binary version.

Cheers,

Sebastian

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-trunk-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-apt depends on:
ii  apt [libapt-pkg-libc6.9-6-4.8 0.7.25.3   Advanced front-end for dpkg
ii  apt-utils [libapt-inst-libc6. 0.7.25.3   APT utility programs
ii  libc6                         2.10.2-8   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.4-1  GCC support library
ii  libstdc++6                    4.4.4-1    The GNU Standard C++ Library v3
ii  python                        2.5.4-9    An interactive high-level object-o
ii  python-central                0.6.16     register and build utility for Pyt

Versions of packages python-apt recommends:
ii  iso-codes                     3.16-1     ISO language, territory, currency,
ii  lsb-release                   3.2-23.1   Linux Standard Base version report
ii  python2.6                     2.6.5-2    An interactive high-level object-o

Versions of packages python-apt suggests:
pn  python-apt-dbg                <none>     (no description available)
ii  python-apt-doc                0.7.94.3   Python interface to libapt-pkg (AP
ii  python-gtk2                   2.17.0-2   Python bindings for the GTK+ widge
ii  python-vte                    1:0.24.1-1 Python bindings for the VTE widget

-- no debconf information
=== modified file 'apt/package.py'
--- apt/package.py	2010-03-31 14:48:21 +0000
+++ apt/package.py	2010-05-16 12:22:27 +0000
@@ -1010,30 +1010,21 @@
         # get the source version, start with the binaries version
         bin_ver = self.candidate.version
         src_ver = self.candidate.version
-        #print "bin: %s" % binver
         try:
-            # FIXME: This try-statement is too long ...
             # try to get the source version of the pkg, this differs
             # for some (e.g. libnspr4 on ubuntu)
             # this feature only works if the correct deb-src are in the
-            # sources.list
-            # otherwise we fall back to the binary version number
+            # sources.list otherwise we fall back to the binary version number
             src_records = apt_pkg.SourceRecords()
-            src_rec = src_records.lookup(src_pkg)
-            if src_rec:
+        except SystemError:
+            pass
+        else:
+            while src_records.lookup(src_pkg):
+                if not src_records.version or \
+                   apt_pkg.version_compare(bin_ver, src_records.version) > 0:
+                    continue
                 src_ver = src_records.version
-                #if apt_pkg.VersionCompare(binver, srcver) > 0:
-                #    srcver = binver
-                if not src_ver:
-                    src_ver = bin_ver
-                #print "srcver: %s" % src_ver
                 section = src_records.section
-                #print "srcsect: %s" % section
-            else:
-                # fail into the error handler
-                raise SystemError
-        except SystemError:
-            src_ver = bin_ver
 
         section_split = section.split("/", 1)
         if len(section_split) > 1:


Reply to: