[Development] Adding support for version number comparisons

Oswald Buddenhagen oswald.buddenhagen at digia.com
Mon May 12 12:27:46 CEST 2014


On Sat, May 10, 2014 at 03:39:51PM -0700, Thiago Macieira wrote:
> Em sáb 10 maio 2014, às 22:04:26, Sune Vuorela escreveu:
> > On 2014-05-10, Thiago Macieira <thiago.macieira at intel.com> wrote:
> > > How do you make 5.3.0-rc1 compare less than 5.3.0?
> > 
> > we call them 5.3.0~rc1.
> 
> And how does "5.3.0~rc1" compare less than "5.3.0"?
> 
> Anyway, you can't change the version string. Please note requirements from the 
> original post:
> 
> >    - Plugin loading where there are multiple versions on the same system.
> >    - File format validation.
> >    - Executing an already installed command line application where the
> >    behavior is dependent on the called application's version.
> >    - Performing software installations and updates.
> >    - QMake support for version number comparisons.
> 
> Four of the five of those require parsing input that other people create.
> 
this is rather obviously a no-win situation.

the only use case for an actual class i buy is the first one (and maybe
the fourth one), which can be cleanly implemented with a minimalistic
implementation of semver.

independently from that, we can implement a plain natural compare
function for strings (which treats groups of digits as numbers, not as
unicode values).
any a-priori transformations needed to make it actually work with random
versioning schemes are highly specific, and should therefore be left to
the user. arbitrary policies totally do not belong into a generic
low-level class in qtcore.



More information about the Development mailing list