Open Arfrever opened 12 years ago
Well, decimals are sortable, but they're clearly nonstandard. I think I'll release the next version as 4.0 and do it with multiple-periods from then on; that should be clear to everyone.
Arfrever: My solution in Debian was to put decimals between every number, e.g. 3.1.0.1. I do it pretty hackily with a pair of regexes, I don't know if Gentoo has any similar mechanism. http://anonscm.debian.org/viewvc/python-modules/packages/python-html2text/trunk/debian/watch?view=markup
I can use something similar to:
$ version="3.101"
$ version="${version//./}"
$ parsed_version=
$ for ((i=0; i<${#version}; i++)); do parsed_version+="${parsed_version:+.}${version:${i}:1}"; done
$ echo "${parsed_version}"
3.1.0.1
Please use easily sortable versions (e.g. "3.1.0", "3.1.0.1", "3.1.1", "3.1.2"). Many tools treat "3.101" as newer than "3.11". (The master branch now has version "3.11 dev".)
Examples from a function used by Portage (main package manager for Gentoo Linux):