parsing upstream version and revision from Ubuntu package Version strings

Martin Pitt martin.pitt at
Fri Jan 15 07:21:38 UTC 2016

Hello Stephen,

Stephen Quintero [2016-01-14 19:00 -0800]:
> As I understand from the Debian policy manual a package Version string
> should include the revision, if any, appended after a hyphen to the
> version, while the version itself should represent the upstream version, so
> that apache2 *2.4.10-8ubuntu2* indicates:

This is true for packages which have an actual upstream, like Apache.

> Many packages appear not to conform to this.  For example:
>    - apt:   *0.8.16~exp12ubuntu10*
>    - apt:   *1.0.1ubuntu2*
>    - apt-clone:   *0.3.1~ubuntu11*
>    - apt-listchanges:   *2.85.13ubuntu2*

Projects like apt, debian-installer etc. have no "upstream" in that
sense, they are being developed by the Debian project itself for
Debian. As such they don't distinguish between an "upstream version"
and a "Debian revision", and should *not* have a revision number.


> None of these Version strings have a hyphen to separate any revision.  Take
> the last example.  Does it indicate version '2.85.1' revision '3ubuntu2',
> or version '2.85.13' revision 'ubuntu2', or just version '2.85.13ubuntu2'
> in which case it is clearly not an upstream version at all.

Appending "ubuntuX" to the version number (both for versions with
upstreams and native ones) is the Ubuntu version policy, so that it
can always be seen which Debian version the Ubuntu package derived
from. So you can always chop off "ubuntu.*" to get the Debian version.

> Other package Version strings do have a hyphen separating a revision from
> the version, but the version is still obviously not the upstream version.
> For example:
>    - account-plugins:  *0.11+14.04.20140409.1-0ubuntu1*
>    - xchat-gnome:  *1:0.30.0~git20131003.d20b8d+really20110821-0.2ubuntu12*
>    - x11proto-randr:  **

Yes, upstream versions can become pretty complicated when doing things
like "update to the latest upstream snapshot" (common for upstreams
which are slow to release), or "revert to an earlier version". Much of
that is coming from the fact that version numbers are required to be
monotonously increasing, which requires this
"oldversion+really_newversion" trick.


Martin Pitt                        |
Ubuntu Developer (  | Debian Developer  (

More information about the Ubuntu-devel-discuss mailing list