Issue
how dose apt-get compares between two different version schemes of the same package?
for example: 1.3.8 ? 1.09
More detailed example:
Lets say i got package_a
in my repository with version 1.08 (package-a_1.08.deb
).
Then i upload a new version of the same package but I've changed then version scheme,
and its now 1.2.0 (package-a_1.2.0.deb
)
When i'll run apt-get install package_a
what version will be installed and why?
Solution
The algorithm used by Debian tools to compare package versions is described in the Debian Policy Manual:
https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
In short: within the upstream version of the package version (which is what you're describing here), each numeric "segment" of the version number is compared separately, and the first pair that differs is used for the comparison.
Given your example of comparing 1.08
vs 1.2.0
, the segments end up being 1, 8
and 1, 2, 0
. Because 8 is greater than 2, 1.08 would be treated as the newer version.
If your versioning scheme changes dramatically, use an epoch number to indicate the break. For instance, if 1.2.0
is part of a new version numbering scheme, use 1:1.2.0
as the Version field, and include that 1:
in all future versions.
Answered By - user149341