As you may know OpenBSD has their own pkg-config implementation in perl. Whilst adding support for alpha/beta/rc suffixes and writing the tests for this I noticed as rather bizarre quirk in your pkg-config. It treats 0.1.0beta2 being newer than 0.1.0: $ pkg-config --short-errors --errors-to-stdout --print-errors "vers1 > 0.1.0beta2" Requested 'vers1 > 0.1.0beta2' but version of Version test 1 is 0.1.0 $ This strikes me as nothing but bizarre...same goes for 'rc' and all other suffixes. pkg-config thinks that a release canidate is newer than the actual release? $ pkg-config --short-errors --errors-to-stdout --print-errors "rc < 0.1.0" Requested 'rc < 0.1.0' but version of rc suffix test is 0.1.0rc2 $
pkg-config uses the rpmvercmp algorithm. Here's the upstream code from rpm if you're interested. I don't think there have been any significant code changes in years. http://rpm.org/gitweb?p=rpm.git;a=blob;f=lib/rpmvercmp.c;hb=HEAD rpmvercmp takes the stance that any alphabetical characters make the version _newer_ than the unadorned version. This works when you have a tweaked version that you want to be seen as newer than the regular version: 0.1 vs 0.1dbn. Unfortunately, it does not work for the alpha/beta/rc suffix. Here's the redhat bug where they haggle about this: https://bugzilla.redhat.com/show_bug.cgi?id=50977 I'm personally disinclined to change this algorithm now. Obviously, using a purely dotted decimal version will always do the right thing for you. Feel free to reopen if you feel really strongly about and we can discuss some more, but for now I feel comfortable being compatible with rpm.
I'd like to say it even stronger: we're not going to change it now, since that is going to screw with people in the real world. (If we're going to change algorithm, I'd like to move to the dpkg algorithm where you can be explicit about version number ordering (because you have ~ which is less than anything, including the empty string).
Apparently rpm grew ~ handling recently. We should import the changes to rpmvercmp(), it's not bad at all. http://rpm.org/ticket/56 http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=db28221a4a48f6ee3c804c92314330637c808638
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.