[pacman-dev] about vercmp tools
Dan McGee
dpmcgee at gmail.com
Sun Oct 18 23:49:21 EDT 2009
On Sun, Oct 18, 2009 at 10:17 PM, mcu GPS <zlbgps at gmail.com> wrote:
> usage: vercmp <ver1> <ver2>
>
> return values:
> < 0 : if ver1 < ver2
> 0 : if ver1 == ver2
> > 0 : if ver1 > ver2
> [arch at myarchtp mkarchlive] $ vercmp 0.1 0.1_rc1
> -1
> [arch at myarchtp mkarchlive] $ vercmp 0.1_rc1 0.1
> 1
> [arch at myarchtp mkarchlive] $ vercmp 0.1_rc1 0.1_r1
> 1
> [arch at myarchtp mkarchlive] $ vercmp 0.1_r1 0.1_rc1
> -1
>
>
> 0.1_rc1 > 0.1 ?
> 0.1_rc1 > 0.1_r1 ?
>
> this is a bug?
No, it isn't a bug. For every example and corner case you try to fix,
you will break two more. The rules are quite simple- split on dots
".", and then compare numerically if possible, followed by
alphabetically. We don't deal with shitty versioning schemes because
there is no universal way to do so.
See pactest/vercmptest.sh for some examples of what vercmp does support.
-Dan
More information about the pacman-dev
mailing list