New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package: fix version comparison #316

Merged
merged 1 commit into from Dec 18, 2013

Conversation

Projects
None yet
3 participants
@vincentbernat
Contributor

vincentbernat commented Dec 17, 2013

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.

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.
@vincentbernat

This comment has been minimized.

Show comment
Hide comment
@vincentbernat

vincentbernat Dec 18, 2013

Contributor

Updated.

Contributor

vincentbernat commented Dec 18, 2013

Updated.

@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Dec 18, 2013

Owner

Thanks!

Owner

mizzy commented Dec 18, 2013

Thanks!

mizzy added a commit that referenced this pull request Dec 18, 2013

@mizzy mizzy merged commit e8c6bd5 into mizzy:master Dec 18, 2013

1 check failed

default The Travis CI build could not complete due to an error
Details
@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Dec 18, 2013

Owner

Released as v0.13.6.

Owner

mizzy commented Dec 18, 2013

Released as v0.13.6.

@mizzy

This comment has been minimized.

Show comment
Hide comment
@mizzy

mizzy Mar 27, 2014

Owner

Released as v1.0.0.

Owner

mizzy commented Mar 27, 2014

Released as v1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment