为什么有些软件包在版本号前面的冒号之前会有额外的数字?

我刚刚注意到Wine(以及其他一些软件包)已经将他们的版本方案转变为类似这样的形式:
1:1.6.2-0ubuntu3

我理解了1:之后的一切...但是1:指的是什么呢?
它似乎不是主要版本的镜像。看着一个待升级列表,有像2:4.1.3...这样的版本,也有很多没有#:前缀的软件包。
到底发生了什么?

似乎这是Ubuntu特定的,https://packages.debian.org/sid/wine没有这个前缀。 - Sylvain Pineau
这对于Ubuntu中的Wine来说也是新鲜事(从14.04开始),但其他软件包如python3-uno在Ubuntu中 以及 在Debian中)一直具有统一的前缀。 - Oli
确实,我在superuser上找到了答案。 - Sylvain Pineau
@Oli 这对于葡萄酒来说并不是新鲜事,它一直存在,但由于其价值一直为0,直到14.04版本,它被省略在版本字符串中写入。因此,你可以将所有那些没有“#:”前缀的包都视为实际上包含了“0:”。请查看你收到的答案以更好地理解。 - Radu Rădeanu
3个回答

man deb-version中:

NAME
       deb-version - Debian package version number format

SYNOPSIS
       [epoch:]upstream-version[-debian-revision]

DESCRIPTION
       Version  numbers as used for Debian binary and source packages
       consist of three components. These are:

       epoch  This is a single (generally  small)  unsigned  integer.
              It  may  be omitted, in which case zero is assumed.  If
              it is omitted then the upstream-version may not contain
              any colons.

              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.
那个额外的数字(在你的例子中是1)指的是时期组件,可以省略,省略时默认为0。所以,如果你看到一个版本字符串看起来像1.6.2-0ubuntu3,实际上它看起来像0:1.6.2-0ubuntu3。这有什么帮助和原因呢?它的目的是允许旧版本的软件包版本号出现错误,并且也能够遗弃软件包之前的版本编号方案。为了更好地理解,请仔细阅读Debian Policy Manual - Control files and their fields中的以下解释段落:

在比较两个版本号时,首先比较每个版本的时期,然后比较上游版本(如果时期相等),最后比较debian修订版(如果上游版本也相等)。时期按数字进行比较。

还有:

请注意,时代的目的是让我们摆脱版本编号中的错误,并应对版本编号方案发生变化的情况。它不适用于包管理系统无法解释的字母字符串(例如 ALPHA 或 pre-)或愚蠢的排序。


这是时代。它在确定两个软件包中哪个更新版本时会覆盖版本:

来自 deb-version 手册页:

   epoch  This is a single (generally small) unsigned integer.  It may  be
          omitted,  in  which case zero is assumed.  If it is omitted then
          the upstream-version may not contain any colons.

          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.

来源


具体例子

这里有一个具体的例子,可以最大限度地提高你的理解速度。

假设原始软件包有以下版本:

  • 2019.1
  • 2019.2
  • 1.2(原始软件包决定随机更改发布命名方案)
  • 1.3

那么Debian将它们视为:

  • 0:2019.1(通常简称为2019.1,因为前面的0:可以省略)
  • 0:2019.2
  • 1:1.2(Debian将时代从0增加到1以处理新的命名方案)
  • 1:1.3

通过这种方式,我们仍然可以清楚地从软件包版本字符串中知道版本顺序,或者如果原始软件包在新方案中犯了重用旧名称发布的错误,我们可以完全区分它们。

你能想象Debian开发者为了适应这种地狱般的事情所做出的努力吗?:-)