wpkg --canonicalize-version

The wpkg tool has full access to the version code available in the libdebpackages library. This code is capable of canonicalizing Debian compatible versions but making them as short as possible. There are mainly 3 things that happen:

  1. Any .0 at the end of a version are removed
  2. The epoch is removed if zero (0:)
  3. The release is removed if zero (-0)

So for example a version such as: 0:1.0.0-0 becomes 1.

However, the version 1:1.0.3-1 remains the same.

Also, wpkg returns 0 when the version being canonicalized is valid, and it returns 1 if the version is not valid.

Note that a version that is more than 255 characters is considered valid but it will generate an error as it is longer than the available buffer. It should anyway never be necessary to have such long versions!

wpkg also allows you to compare two versions against each others to determine which one is larger, smaller, or whether they are equal. This is done using the --compare-versions command.

Syndicate content