puppetlabs/puppet — pull request #2866 by jantman (2014-07-12 03:27:46+00:00)
Title: PUP-1244 puppet4

As requested, this is a rebase of my earlier PR, https://github.com/puppetlabs/puppet/pull/2262, on the puppet-4 branch. So far I've only run specs locally.

Description of the original PR, for reference:

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.