Comment 2 for bug 174024

Revision history for this message
Sam Geeraerts (samgee) wrote :

While investigating bug 40058 I was looking through update-manager's code. The method get_changelog does the following:

            srcrecords = apt_pkg.GetPkgSrcRecords()
            srcrec = srcrecords.Lookup(srcpkg)
            if srcrec:
                srcver = srcrecords.Version

I tried something similar on the Python console for seahorse:

>>> import apt_pkg
>>> apt_pkg.init ()
>>> apt_pkg.GetCache()
Reading package lists... Done
Building dependency tree
Reading state information... Done
<pkgCache object at 0x8192060>
>>> rec = apt_pkg.GetPkgSrcRecords()
>>> lu = rec.Lookup('seahorse')
>>> lu
1
>>> rec.Version
'2.22.1-0ubuntu2'

apt-cache show seahorse shows the following versions:
Version: 2.22.2-0ubuntu1
Version: 2.22.1-0ubuntu2

And then for cpp:

>>> import apt_pkg
>>> apt_pkg.init()
>>> apt_pkg.GetCache()
Reading package lists... Done
Building dependency tree
Reading state information... Done
<pkgCache object at 0x8192060>
>>> rec = apt_pkg.GetPkgSrcRecords()
>>> lu = rec.Lookup('cpp')
>>> lu
1
>>> rec.Version
'1.62ubuntu3'

apt-cache show cpp:
Source: gcc-defaults (1.62ubuntu6)
Version: 4:4.2.3-1ubuntu6
Source: gcc-defaults (1.62ubuntu3)
Version: 4:4.2.3-1ubuntu3

So apt-cache shows the latest version first, but it looks like package information is sorted differently for the Lookup method.

This explanation fits the title of this bug report, but not really the description. If what I just described is fixed, then it will probably only get the changelog of the latest version. So it would still need to find the version of the source package that goes with the version of the binary package currently installed.