Debian packages, version numbers and pre-release versions

Getting the latest version of a package into Debian involves checking when there are new versions available – fortunately (and not surprisingly) Debian has tools to make this simpler.

I have recently ran into the problem when an upstream beta version sorts higher than a newer non-beta version. Which is problematic, of course. This is due to Debian sorting something like 1.0b as later than a pure 1.0 version.

gusnan@debian-i7:~ > dpkg --compare-versions 1.0b lt 1.0 && echo true
gusnan@debian-i7:~ > dpkg --compare-versions 1.0b gt 1.0 && echo true
true

But there’s a solution – name the beta versions something like 1.0~beta. And you don’t need to force upstream to make any changes either. You can use uscan and the watch file to make it interpret an upstream 1.0b version as 1.0~beta in Debian.

This is done by using a line like

uversionmangle=s/(\d)[\_\.\-\+]?((RC|rc|pre|dev|beta|alpha|b|a)\d*)$/$1~$2/;s/\~b/\~beta/;,\

in uversionmangle in your debian/watch file. In this case i have added on the end something to make the ending ~b into ~beta instead. Full version of the watch file available here.

2 Replies to “Debian packages, version numbers and pre-release versions”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.