When virtual package providing only one package, look up status of target package
This commit is contained in:
Semyon Deviatkin 2015-05-18 08:10:22 +00:00
parent 68c3068940
commit adf34a6ccd

View file

@ -206,8 +206,16 @@ def package_status(m, pkgname, version, cache, state):
except KeyError: except KeyError:
if state == 'install': if state == 'install':
try: try:
if cache.get_providing_packages(pkgname): provided_packages = cache.get_providing_packages(pkgname)
return False, True, False 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) m.fail_json(msg="No package matching '%s' is available" % pkgname)
except AttributeError: except AttributeError:
# python-apt version too old to detect virtual packages # python-apt version too old to detect virtual packages