deb-version
Debian package version number format
- Provided by: dpkg-dev (Version: 1.17.5ubuntu5.8)
- Source: dpkg
- Report a bug
Debian package version number format
[epoch:]upstream-version[-debian-revision]
Version numbers as used for Debian binary and source packages consist of three components. These are:
The upstream-version and debian-revision parts are compared by the package management system using the same algorithm:
The strings are compared from left to right.
First the initial part of each string consisting entirely of non-digit characters is determined. These two parts (one of which may be empty) are compared lexically. If a difference is found it is returned. The lexical comparison is a comparison of ASCII values modified so that all the letters sort earlier than all the non-letters and so that a tilde sorts before anything, even the end of a part. For example, the following parts are in sorted order: '~~', '~~a', '~', the empty part, 'a'.
Then the initial part of the remainder of each string which consists entirely of digit characters is determined. The numerical values of these two parts are compared, and any difference found is returned as the result of the comparison. For these purposes an empty string (which can only occur at the end of one or both version strings being compared) counts as zero.
These two steps (comparing and removing initial non-digit strings and initial digit strings) are repeated until a difference is found or both strings are exhausted.
Note that the purpose of epochs is to allow us to leave behind mistakes in version numbering, and to cope with situations where the version numbering scheme changes. It is not intended to cope with version numbers containing strings of letters which the package management system cannot interpret (such as 'ALPHA' or 'pre-'), or with silly orderings.
The tilde character and its special sorting properties were introduced in dpkg 1.10 and some parts of the dpkg build scripts only gained support for it later in the 1.10.x series.