1deb-version(5) Debian 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 "debianisation" 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 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_revi‐
62 sion 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 fol‐
76 lowing 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 num‐
93 bers containing strings of letters which the package management system
94 cannot interpret (such as 'ALPHA' or 'pre-'), or with silly orderings.
95
97 The tilde character and its special sorting properties were introduced
98 in dpkg, version 1.10 and some parts of dpkg-dev only gained support
99 for it later in the 1.10.x series.
100
102 deb-control(5), deb(5), dpkg(1)
103
105 Copyright © 1996,1997,1998 Ian Jackson and Christian Schwarz
106 Copyright © 2007 Frank Lichtenheld
107
108 This is free software; see the GNU General Public Licence version 2 or
109 later for copying conditions. There is NO WARRANTY.
110
111
112
113Debian Project 2008-08-18 deb-version(5)