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