<div dir="ltr"><div>Hello,</div><div><br></div><div>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 version.</div><div><br></div><div>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 <b>2.4.10-8ubuntu2</b> indicates:</div><div><ul><li>upstream version;  <b>2.4.10</b><br></li><li>revision:  <b>8ubuntu2</b> where 8 indicates the Debian revision and 2 indicates the Ubuntu revision<br></li></ul></div><div>Many packages appear not to conform to this.  For example:<br></div><div><ul><li>apt:   <b>0.8.16~exp12ubuntu10</b>  <br></li><li>apt:   <b>1.0.1ubuntu2</b>          <br></li><li>apt-clone:   <b>0.3.1~ubuntu11</b><br></li><li>apt-listchanges:   <b>2.85.13ubuntu2</b><br></li></ul></div><div>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.<br></div><div><br></div><div>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).</div><div><br></div><div>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: </div><div><ul><li>account-plugins:  <b>0.11+14.04.20140409.1-0ubuntu1</b><br></li><li>xchat-gnome:  <b>1:0.30.0~git20131003.d20b8d+really20110821-0.2ubuntu12</b><br></li><li>x11proto-randr:  <b>1.4.0+git20120101.is.really.1.4.0-0ubuntu1</b><br></li></ul></div><div>In summary, my questions:<br></div><div><ol><li>If a Version string such as that for apt <b>0.8.16~exp12ubuntu10</b> has no hyphen, is there really no revision (despite the 'ubuntu' in the string), or is the Version string malformed?  <br></li><li>How does one distinguish the upstream version where any parsed version from the Version string is clearly different, e.g. versions  <b>2.85.13ubuntu2</b> or <b>0.30.0~git20131003.d20b8d+really20110821</b><br></li></ol></div><div>Any light shed on this subject would be much appreciated.<br></div><div><br></div><div>Best regards,</div><div><br></div><div>Stephen Quintero</div><div><br></div></div>