Bug#750189: python-apt: compare_to_version_in_cache() not aware of multiarch
Package: python-apt
Version: 0.9.3.6
Severity: normal
Dear Maintainer,
python-apt fails to find installed packages of different architecture
when reading metadata from a deb file. For example, I've installed
libopenjpeg5:i386 on an amd64 system:
```
$ apt-cache policy libopenjpeg5:i386
libopenjpeg5:i386:
Installed: 1.5.2-2
Candidate: 1.5.2-2
Version table:
*** 1.5.2-2 0
500 http://ftp.cn.debian.org/debian/ unstable/main i386 Packages
100 /var/lib/dpkg/status
limbo@Skypiea in ~/.vim/bundle/YouCompleteMe [master]
$ apt-cache policy libopenjpeg5
libopenjpeg5:
Installed: (none)
Candidate: 1.5.2-2
Version table:
1.5.2-2 0
500 http://ftp.cn.debian.org/debian/ unstable/main amd64 Packages
```
But when I use python-apt to read the deb file, it reports that this
package is NOT installed on my system:
```python
from apt.debfile import DebPackage
pkg = DebPackage('/var/cache/apt/archives/libopenjpeg5_1.5.2-2_i386.deb')
print pkg.compare_to_version_in_cache() == DebPackage.VERSION_SAME # => False
print pkg.compare_to_version_in_cache() == DebPackage.VERSION_NONE # => True
```
I think the problem resides in function `compare_to_version_in_cache()`
in `debfile.py`, which does not check package names appended with
architecture name suffix.
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.12.14-debian (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-apt depends on:
ii libapt-inst1.5 1.0.3
ii libapt-pkg4.12 1.0.3
ii libc6 2.18-7
ii libgcc1 1:4.9.0-5
ii libstdc++6 4.9.0-5
ii python 2.7.6-2
ii python-apt-common 0.9.3.6
Versions of packages python-apt recommends:
ii iso-codes 3.53-1
ii lsb-release 4.1+Debian12
ii xz-utils 5.1.1alpha+20120614-2
Versions of packages python-apt suggests:
pn python-apt-dbg <none>
pn python-apt-doc <none>
ii python-gtk2 2.24.0-3+b1
ii python-vte 1:0.28.2-5
-- no debconf information
Reply to: