debian: update service test to match changes in specinfra
debian: update package tests to match changes in specinfra
Add version method to package type for testing package version
Merge pull request #310 from vincentbernat/feature/debian

Update debian-related tests for changes in specinfra
Fix a spec
Return nil if package is not installed
Merge pull request #311 from serverspec/check-package-version

Add version method to package type for testing package version
Bump up version
debian: update package test for new :version attribute
Merge pull request #312 from vincentbernat/feature/debian-package-version

debian: update package test for new :version attribute
Support comparing versions of packages.
Merge pull request #315 from ryotarai/compare-versions-of-packages

Support comparing versions of packages.
Bump up version
Add spec for package version cpmarison
package: fix version comparison

`Gem::Version` does not accept the same versions that are usually used
in packages. Notably, packages like to define an upstream version and a
downstream version. For example, `2.2.4-15` is the 15th iteration of the
Apache 2.2.4 package.

With Debian, there are some more complex conventions:

 - epoch is a way to use a smaller version number while ensuring strict
   increase of version numbers. For example, upstream was numbering with
   versions like 2011, 2012, 2013 and suddenly go back to a 1.2, 1.3
   versioning scheme. In this cases, distributions like Debian are using
   an epoch: 1:1.2, 1:1.3. Each time there is a problem with version
   numbering, epoch is increased. Default epoch is 0.

 - tilde is a way to make a version smaller than any other versions
   sharing the same suffix. This is used when backporting a version to a
   previous version of the distribution. For example, you backport
   Apache 2.2.14-15, the version will be something like
   2.2.14-15~bpo60+1 which is inferior to 2.2.14-15 or
   2.2.14-15+something1.

The proposed implementation is quite basic, not widely tested but works
with the cases described above. Debian provides `libdpkg-rubyXX`
packages containing a more comprehensive way to compare version but this
would add a dependency. I believe that the proposed implementation is
equivalent with version numbers that can be found in the
wild.
Merge pull request #316 from vincentbernat/fix/debian-version-compare

package: fix version comparison
Refactor Serverspec::Type::Package::Version.
String#ord is not supported in Ruby 1.8.7, so hard-code the code point of "~"
Remove unnecessary String#dup.
Bump up version