deb-version.5 5.3 KB

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