From adf34a6ccde75f32403d3d28a24f28ed9281c52a Mon Sep 17 00:00:00 2001 From: Semyon Deviatkin Date: Mon, 18 May 2015 08:10:22 +0000 Subject: [PATCH] Fix issue #1230 When virtual package providing only one package, look up status of target package --- packaging/os/apt.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packaging/os/apt.py b/packaging/os/apt.py index a160c13c311..ac82f41a7ff 100644 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -206,8 +206,16 @@ def package_status(m, pkgname, version, cache, state): except KeyError: if state == 'install': try: - if cache.get_providing_packages(pkgname): - return False, True, False + provided_packages = cache.get_providing_packages(pkgname) + if provided_packages: + is_installed = False + # when virtual package providing only one package, look up status of target package + if cache.is_virtual_package(pkgname) and len(provided_packages) == 1: + package = provided_packages[0] + installed, upgradable, has_files = package_status(m, package.name, version, cache, state='install') + if installed: + is_installed = True + return is_installed, True, False m.fail_json(msg="No package matching '%s' is available" % pkgname) except AttributeError: # python-apt version too old to detect virtual packages