diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-07 21:00:21 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-07 21:00:21 +0000 |
commit | c9b0888ba71b5d740075ff998fb8574a8d704592 (patch) | |
tree | dc1fd4051d821ac0ba2d3d2079c5d8c37e681c81 | |
parent | 156872a0afbc16fdee26c594f0527a89cdd1f8c8 (diff) | |
download | portage-c9b0888ba71b5d740075ff998fb8574a8d704592.tar.gz portage-c9b0888ba71b5d740075ff998fb8574a8d704592.tar.bz2 portage-c9b0888ba71b5d740075ff998fb8574a8d704592.zip |
For bug #152127, make vercmp give less value to implcit .0, so two versions that aren't literally equal are not ambiguously given the same value (in sorting, for example).
svn path=/main/trunk/; revision=5205
-rw-r--r-- | pym/portage_versions.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage_versions.py b/pym/portage_versions.py index 7492d606e..1d9a1972c 100644 --- a/pym/portage_versions.py +++ b/pym/portage_versions.py @@ -54,12 +54,15 @@ def vercmp(ver1, ver2, silent=1): vlist1 = match1.group(3)[1:].split(".") vlist2 = match2.group(3)[1:].split(".") for i in range(0, max(len(vlist1), len(vlist2))): + # Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it + # would be ambiguous if two versions that aren't literally equal + # are given the same value (in sorting, for example). if len(vlist1) <= i or len(vlist1[i]) == 0: - list1.append(0) + list1.append(-1) list2.append(string.atoi(vlist2[i])) elif len(vlist2) <= i or len(vlist2[i]) == 0: list1.append(string.atoi(vlist1[i])) - list2.append(0) + list2.append(-1) # Let's make life easy and use integers unless we're forced to use floats elif (vlist1[i][0] != "0" and vlist2[i][0] != "0"): list1.append(string.atoi(vlist1[i])) |