man-pages/man7/deb-version.7.html
2021-03-31 01:06:50 +01:00

172 lines
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of deb-version</TITLE>
</HEAD><BODY>
<H1>deb-version</H1>
Section: dpkg suite (7)<BR>Updated: 2020-03-23<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
deb-version - Debian package version number format
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
[<I>epoch</I><B>:</B>]<I>upstream-version</I>[<B>-</B><I>debian-revision</I>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Version numbers as used for Debian binary and source packages
consist of three components. These are:
<DL COMPACT>
<DT id="1"><I>epoch</I>
<DD>
This is a single (generally small) unsigned integer. It
may be omitted, in which case zero is assumed. If it is
omitted then the <I>upstream-version</I> may not
contain any colons.
<DT id="2"><DD>
It is provided to allow mistakes in the version numbers
of older versions of a package, and also a package's
previous version numbering schemes, to be left behind.
<DT id="3"><I>upstream-version</I>
<DD>
This is the main part of the version number. It is
usually the version number of the original ("upstream")
package from which the <I>.deb</I> file has been made,
if this is applicable. Usually this will be in the same
format as that specified by the upstream author(s);
however, it may need to be reformatted to fit into the
package management system's format and comparison
scheme.
<DT id="4"><DD>
The comparison behavior of the package management system
with respect to the <I>upstream-version</I> is
described below. The <I>upstream-version</I>
portion of the version number is mandatory.
<DT id="5"><DD>
The <I>upstream-version</I> may contain only
alphanumerics ("A-Za-z0-9") and the characters
<B>.</B> <B>+</B> <B>-</B> <B>:</B> <B>~</B>
(full stop, plus, hyphen, colon, tilde) and should
start with a digit. If there is no
<I>debian-revision</I> then hyphens are not allowed;
if there is no <I>epoch</I> then colons are not
allowed.
<DT id="6"><I>debian-revision</I>
<DD>
This part of the version number specifies the version of
the Debian package based on the upstream version. It
may contain only alphanumerics and the characters
<B>+</B> <B>.</B> <B>~</B>
(plus, full stop, tilde) and is
compared in the same way as the
<I>upstream-version</I> is.
<DT id="7"><DD>
It is optional; if it isn't present then the
<I>upstream-version</I> may not contain a hyphen.
This format represents the case where a piece of
software was written specifically to be turned into a
Debian package, and so there is only one "debianization"
of it and therefore no revision indication is required.
<DT id="8"><DD>
It is conventional to restart the
<I>debian-revision</I> at '1' each time the
<I>upstream-version</I> is increased.
<DT id="9"><DD>
Dpkg will break the version
number apart at the last hyphen in the string (if there
is one) to determine the <I>upstream-version</I> and
<I>debian-revision</I>. The absence of a
<I>debian-revision</I> compares earlier than the
presence of one (but note that the <I>debian-revision</I>
is the least significant part of the version number).
</DL>
<A NAME="lbAE">&nbsp;</A>
<H3>Sorting algorithm</H3>
The <I>upstream-version</I> and <I>debian-revision</I>
parts are compared by the package management system using the
same algorithm:
<P>
The strings are compared from left to right.
<P>
First the initial part of each string consisting entirely of
non-digit characters is determined. These two parts (one of
which may be empty) are compared lexically. If a difference
is found it is returned. The lexical comparison is a
comparison of ASCII values modified so that all the letters
sort earlier than all the non-letters and so that a tilde
sorts before anything, even the end of a part. For example,
the following parts are in sorted order: '~~', '~~a', '~',
the empty part, 'a'.
<P>
Then the initial part of the remainder of each string which
consists entirely of digit characters is determined. The
numerical values of these two parts are compared, and any
difference found is returned as the result of the comparison.
For these purposes an empty string (which can only occur at
the end of one or both version strings being compared) counts
as zero.
<P>
These two steps (comparing and removing initial non-digit
strings and initial digit strings) are repeated until a
difference is found or both strings are exhausted.
<P>
Note that the purpose of epochs is to allow us to leave behind
mistakes in version numbering, and to cope with situations
where the version numbering scheme changes. It is
<B>not</B> intended to cope with version numbers containing
strings of letters which the package management system cannot
interpret (such as 'ALPHA' or 'pre-'), or with
silly orderings.
<A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2>
The tilde character and its special sorting properties were introduced
in dpkg 1.10 and some parts of the dpkg build scripts only gained
support for it later in the 1.10.x series.
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+deb-control">deb-control</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+deb">deb</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?1+dpkg">dpkg</A></B>(1)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="10"><A HREF="#lbAB">NAME</A><DD>
<DT id="11"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="12"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DL>
<DT id="13"><A HREF="#lbAE">Sorting algorithm</A><DD>
</DL>
<DT id="14"><A HREF="#lbAF">NOTES</A><DD>
<DT id="15"><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:08 GMT, March 31, 2021
</BODY>
</HTML>