Bug # 946966

Puppetlabs recommends following the semver 1.0.0 specification for publishing modules

Current pulp implementation of comparing module versions ignores semver 1.0.0 specification, particularly

"A pre-release version number MAY be denoted by appending an arbitrary string immediately following the patch version and a dash. The string MUST be comprised of only alphanumerics plus dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Precedence SHOULD be determined by lexicographic ASCII sort order. For instance: 1.0.0-alpha1 < 1.0.0-beta1 < 1.0.0-beta2 < 1.0.0-rc1 < 1.0.0."

This patch fixes the issue.

Some tests:

PUBLISH puppet-test-0.0.2-rc1

[root@puppet-master2 tmp]# puppet module install puppet/test --target-dir=/tmp/mods
Notice: Preparing to install into /tmp/mods ...
Notice: Downloading from http://.:puppetforge@puppetrepo.server.com ...
Notice: Installing -- do not interrupt ...
/tmp/mods
âââ puppet-test (v0.0.2-rc1)

PUBLISH puppet-test-0.0.2-rc1-11

[root@puppet-master2 tmp]# rm -rf /tmp/mods
[root@puppet-master2 tmp]# rm -rf mods
[root@puppet-master2 tmp]# puppet module install puppet/test --target-dir=/tmp/mods
Notice: Preparing to install into /tmp/mods ...
Notice: Created target directory /tmp/mods
Notice: Downloading from http://.:puppetforge@puppetrepo.server.com ...
Notice: Installing -- do not interrupt ...
/tmp/mods
âââ puppet-test (v0.0.2-rc1-11)

PUBLISH puppet-test-0.0.2

[root@puppet-master2 tmp]# rm -rf /tmp/mods
[root@puppet-master2 tmp]# puppet module install puppet/test --target-dir=/tmp/mods
Notice: Preparing to install into /tmp/mods ...
Notice: Created target directory /tmp/mods
Notice: Downloading from http://.:puppetforge@puppetrepo.server.com ...
Notice: Installing -- do not interrupt ...
/tmp/mods
âââ puppet-test (v0.0.2)