puppetlabs/puppet — pull request #2262 by jantman (2014-01-15 01:24:55+00:00)
Title: Pup 1244 - Fix yum/rpm version comparison to work the way RPM actually does

Puppet uses one vercmp method for all package types by default. Unfortunately that method assumes the packages use semver, which RPM and Yum do not.

This is an almost line-for-line port of the version comparison algorithms in Yum (Python) and RPM (C) to Puppet. The comments I left in show how insane the actual version comparison algorithm is. It's essentially a bunch of special cases that might eventually fall through to strcmp().

I've also brought over all of RPM's upstream test cases and included them in rpm_spec.rb as a reference/sanity check.