1deb-version(5) dpkg suite deb-version(5)
2
3
4
6 deb-version - Debian package version number format
7
9 [epoch:]upstream-version[-debian-revision]
10
12 Version numbers as used for Debian binary and source packages consist
13 of three components. These are:
14
15 epoch This is a single (generally small) unsigned integer. It may be
16 omitted, in which case zero is assumed. If it is omitted then
17 the upstream-version may not contain any colons.
18
19 It is provided to allow mistakes in the version numbers of older
20 versions of a package, and also a package's previous version
21 numbering schemes, to be left behind.
22
23 upstream-version
24 This is the main part of the version number. It is usually the
25 version number of the original (“upstream”) package from which
26 the .deb file has been made, if this is applicable. Usually
27 this will be in the same format as that specified by the
28 upstream author(s); however, it may need to be reformatted to
29 fit into the package management system's format and comparison
30 scheme.
31
32 The comparison behavior of the package management system with
33 respect to the upstream-version is described below. The
34 upstream-version portion of the version number is mandatory.
35
36 The upstream-version may contain only alphanumerics (“A-Za-
37 z0-9”) and the characters . + - : ~ (full stop, plus, hyphen,
38 colon, tilde) and should start with a digit. If there is no
39 debian-revision then hyphens are not allowed; if there is no
40 epoch then colons are not allowed.
41
42 debian-revision
43 This part of the version number specifies the version of the
44 Debian package based on the upstream version. It may contain
45 only alphanumerics and the characters + . ~ (plus, full stop,
46 tilde) and is compared in the same way as the upstream-version
47 is.
48
49 It is optional; if it isn't present then the upstream-version
50 may not contain a hyphen. This format represents the case where
51 a piece of software was written specifically to be turned into a
52 Debian package, and so there is only one “debianization” of it
53 and therefore no revision indication is required.
54
55 It is conventional to restart the debian-revision at ‘1’ each
56 time the upstream-version is increased.
57
58 Dpkg will break the version number apart at the last hyphen in
59 the string (if there is one) to determine the upstream-version
60 and debian-revision. The absence of a debian-revision compares
61 earlier than the presence of one (but note that the debian-
62 revision is the least significant part of the version number).
63
64 Sorting algorithm
65 The upstream-version and debian-revision parts are compared by the
66 package management system using the same algorithm:
67
68 The strings are compared from left to right.
69
70 First the initial part of each string consisting entirely of non-digit
71 characters is determined. These two parts (one of which may be empty)
72 are compared lexically. If a difference is found it is returned. The
73 lexical comparison is a comparison of ASCII values modified so that all
74 the letters sort earlier than all the non-letters and so that a tilde
75 sorts before anything, even the end of a part. For example, the
76 following parts are in sorted order: ‘~~’, ‘~~a’, ‘~’, the empty part,
77 ‘a’.
78
79 Then the initial part of the remainder of each string which consists
80 entirely of digit characters is determined. The numerical values of
81 these two parts are compared, and any difference found is returned as
82 the result of the comparison. For these purposes an empty string
83 (which can only occur at the end of one or both version strings being
84 compared) counts as zero.
85
86 These two steps (comparing and removing initial non-digit strings and
87 initial digit strings) are repeated until a difference is found or both
88 strings are exhausted.
89
90 Note that the purpose of epochs is to allow us to leave behind mistakes
91 in version numbering, and to cope with situations where the version
92 numbering scheme changes. It is not intended to cope with version
93 numbers containing strings of letters which the package management
94 system cannot interpret (such as ‘ALPHA’ or ‘pre-’), or with silly
95 orderings.
96
98 The tilde character and its special sorting properties were introduced
99 in dpkg 1.10 and some parts of the dpkg build scripts only gained
100 support for it later in the 1.10.x series.
101
103 deb-control(5), deb(5), dpkg(1)
104
105
106
1071.18.25 2018-06-26 deb-version(5)