saltstack/salt — pull request #3163 by archtaku (2013-01-05 21:59:04+00:00)
Title: Add multiple-package support to pkg.latest state

Currently only apt is supported, will work on the rest in the coming
days.

As part of this commit, a new function has been added to pkg_resource
called "compare". This will do version-checking where a specific package
provider does not provide a means of reliably comparing versions. This
was made necessary by the fact that distutils.LooseVersion does not
properly handle Ubuntu's weird version strings (like '1.2.3-0ubuntu1').
apt now has its own "compare" function which uses dpkg --compare-versions
to do the comparison. (thanks @thekuffs!)

As I start adding multiple package support for pkg.latest in other
platforms, I will (where possible) create provider-specific "compare"
functions. This should make version checking more reliable, and moving
forward should also make the audit of version support in pkg.installed
much easier to accomplish for providers which don't allow you to install
a package using the following syntax: pkgname>=1.2.3