deb-version.5 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. .\" dpkg manual page - deb-version(5)
  2. .\"
  3. .\" Copyright © 1996-1998 Ian Jackson and Christian Schwarz
  4. .\" for parts of the text reused from the Debian Policy
  5. .\" Copyright © 2007 Frank Lichtenheld <djpig@debian.org>
  6. .\" Copyright © 2011, 2013, 2015 Guillem Jover <guillem@debian.org>
  7. .\"
  8. .\" This is free software; you can redistribute it and/or modify
  9. .\" it under the terms of the GNU General Public License as published by
  10. .\" the Free Software Foundation; either version 2 of the License, or
  11. .\" (at your option) any later version.
  12. .\"
  13. .\" This is distributed in the hope that it will be useful,
  14. .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. .\" GNU General Public License for more details.
  17. .\"
  18. .\" You should have received a copy of the GNU General Public License
  19. .\" along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. .
  21. .TH deb\-version 5 "2013-04-02" "Debian Project" "Debian"
  22. .SH NAME
  23. deb\-version \- Debian package version number format
  24. .
  25. .SH SYNOPSIS
  26. .RI "[" epoch "\fB:\fP]" upstream-version "[\fB\-\fP" debian-revision "]"
  27. .SH DESCRIPTION
  28. Version numbers as used for Debian binary and source packages
  29. consist of three components. These are:
  30. .TP
  31. .I epoch
  32. This is a single (generally small) unsigned integer. It
  33. may be omitted, in which case zero is assumed. If it is
  34. omitted then the \fIupstream-version\fP may not
  35. contain any colons.
  36. .IP
  37. It is provided to allow mistakes in the version numbers
  38. of older versions of a package, and also a package's
  39. previous version numbering schemes, to be left behind.
  40. .TP
  41. .I upstream-version
  42. This is the main part of the version number. It is
  43. usually the version number of the original (\(lqupstream\(rq)
  44. package from which the \fI.deb\fP file has been made,
  45. if this is applicable. Usually this will be in the same
  46. format as that specified by the upstream author(s);
  47. however, it may need to be reformatted to fit into the
  48. package management system's format and comparison
  49. scheme.
  50. .IP
  51. The comparison behavior of the package management system
  52. with respect to the \fIupstream-version\fP is
  53. described below. The \fIupstream-version\fP
  54. portion of the version number is mandatory.
  55. .IP
  56. The \fIupstream-version\fP may contain only
  57. alphanumerics (\(lqA-Za-z0-9\(rq) and the characters
  58. .BR . " " + " " \- " " : " " ~
  59. (full stop, plus, hyphen, colon, tilde) and should
  60. start with a digit. If there is no
  61. \fIdebian-revision\fP then hyphens are not allowed;
  62. if there is no \fIepoch\fP then colons are not
  63. allowed.
  64. .TP
  65. .I debian-revision
  66. This part of the version number specifies the version of
  67. the Debian package based on the upstream version. It
  68. may contain only alphanumerics and the characters
  69. .BR + " " . " " ~
  70. (plus, full stop, tilde) and is
  71. compared in the same way as the
  72. \fIupstream-version\fP is.
  73. .IP
  74. It is optional; if it isn't present then the
  75. \fIupstream-version\fP may not contain a hyphen.
  76. This format represents the case where a piece of
  77. software was written specifically to be turned into a
  78. Debian package, and so there is only one \(lqdebianisation\(rq
  79. of it and therefore no revision indication is required.
  80. .IP
  81. It is conventional to restart the
  82. \fIdebian-revision\fP at \(oq1\(cq each time time the
  83. \fIupstream-version\fP is increased.
  84. .IP
  85. Dpkg will break the version
  86. number apart at the last hyphen in the string (if there
  87. is one) to determine the \fIupstream-version\fP and
  88. \fIdebian-revision\fP. The absence of a
  89. \fIdebian-revision\fP compares earlier than the
  90. presence of one (but note that the \fIdebian-revision\fP
  91. is the least significant part of the version number).
  92. .SS Sorting algorithm
  93. The \fIupstream-version\fP and \fIdebian-revision\fP
  94. parts are compared by the package management system using the
  95. same algorithm:
  96. .PP
  97. The strings are compared from left to right.
  98. .PP
  99. First the initial part of each string consisting entirely of
  100. non-digit characters is determined. These two parts (one of
  101. which may be empty) are compared lexically. If a difference
  102. is found it is returned. The lexical comparison is a
  103. comparison of ASCII values modified so that all the letters
  104. sort earlier than all the non-letters and so that a tilde
  105. sorts before anything, even the end of a part. For example,
  106. the following parts are in sorted order: \(oq~~\(cq, \(oq~~a\(cq, \(oq~\(cq,
  107. the empty part, \(oqa\(cq.
  108. .PP
  109. Then the initial part of the remainder of each string which
  110. consists entirely of digit characters is determined. The
  111. numerical values of these two parts are compared, and any
  112. difference found is returned as the result of the comparison.
  113. For these purposes an empty string (which can only occur at
  114. the end of one or both version strings being compared) counts
  115. as zero.
  116. .PP
  117. These two steps (comparing and removing initial non-digit
  118. strings and initial digit strings) are repeated until a
  119. difference is found or both strings are exhausted.
  120. .PP
  121. Note that the purpose of epochs is to allow us to leave behind
  122. mistakes in version numbering, and to cope with situations
  123. where the version numbering scheme changes. It is
  124. \fBnot\fP intended to cope with version numbers containing
  125. strings of letters which the package management system cannot
  126. interpret (such as \(oqALPHA\(cq or \(oqpre\-\(cq), or with
  127. silly orderings.
  128. .SH NOTES
  129. The tilde character and its special sorting properties were introduced
  130. in dpkg 1.10 and some parts of the dpkg build scripts only gained
  131. support for it later in the 1.10.x series.
  132. .SH SEE ALSO
  133. .BR deb\-control (5),
  134. .BR deb (5),
  135. .BR dpkg (1)