apt: include arch in check for installed packages on multi-arch systems (#24846)

* apt: include arch in check for installed packages on multi-arch systems

Thanks: Stefan Löwen <stefan.loewen@gmail.com>

Fixes: #24673

* add an integration test for apt's multi-arch handling
This commit is contained in:
Evgeni Golov 2017-05-30 22:09:43 +02:00 committed by Brian Coca
parent 758cfeb73e
commit 1f78715848
4 changed files with 42 additions and 1 deletions

View file

@ -571,8 +571,13 @@ def install_deb(m, debs, cache, force, install_recommends, allow_unauthenticated
pkg = apt.debfile.DebPackage(deb_file)
pkg_name = get_field_of_deb(m, deb_file, "Package")
pkg_version = get_field_of_deb(m, deb_file, "Version")
if len(apt_pkg.get_architectures()) > 1:
pkg_arch = get_field_of_deb(m, deb_file, "Architecture")
pkg_key = "%s:%s" % (pkg_name, pkg_arch)
else:
pkg_key = pkg_name
try:
installed_pkg = apt.Cache()[pkg_name]
installed_pkg = apt.Cache()[pkg_key]
installed_version = installed_pkg.installed.version
if package_version_compare(pkg_version, installed_version) == 0:
# Does not need to down-/upgrade, move on to next package