parsing upstream version and revision from Ubuntu package Version strings

Stephen Quintero stephen at
Fri Jan 15 03:00:52 UTC 2016


I am trying to parse Ubuntu package Version strings (e.g., from repo
metadata, or package control files) into version and revision, and also
distinguish the upstream version where it may be different from the parsed

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:

   - upstream version;  *2.4.10*
   - revision:  *8ubuntu2* where 8 indicates the Debian revision and 2
   indicates the Ubuntu revision

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*

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.

If these Version strings are considered conforming to spec, then these
packages have no revision, and the versions are as stated, in which case
the upstream version is still not apparent (determinable).

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:  **

In summary, my questions:

   1. If a Version string such as that for apt *0.8.16~exp12ubuntu10* has
   no hyphen, is there really no revision (despite the 'ubuntu' in the
   string), or is the Version string malformed?
   2. How does one distinguish the upstream version where any parsed
   version from the Version string is clearly different, e.g. versions
   *2.85.13ubuntu2* or *0.30.0~git20131003.d20b8d+really20110821*

Any light shed on this subject would be much appreciated.

Best regards,

Stephen Quintero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Ubuntu-devel-discuss mailing list