1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #2905 from kjkuan/bugfix-apt-version-comparison

Make package version comparison use globbing.
This commit is contained in:
Michael DeHaan 2013-05-18 12:48:28 -07:00
commit e389b00050

View file

@ -115,6 +115,7 @@ warnings.filterwarnings('ignore', "apt API not stable yet", FutureWarning)
import os import os
import datetime import datetime
import fnmatch
# APT related constants # APT related constants
APTITUDE_CMD = "aptitude" APTITUDE_CMD = "aptitude"
@ -143,10 +144,10 @@ def package_status(m, pkgname, version, cache, state):
return False, False return False, False
if version: if version:
try : try :
return pkg.is_installed and pkg.installed.version == version, False return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False
except AttributeError: except AttributeError:
#assume older version of python-apt is installed #assume older version of python-apt is installed
return pkg.isInstalled and pkg.installedVersion == version, False return pkg.isInstalled and fnmatch.fnmatch(pkg.installedVersion, version), False
else: else:
try : try :
return pkg.is_installed, pkg.is_upgradable return pkg.is_installed, pkg.is_upgradable