summaryrefslogtreecommitdiffstats
path: root/pym/portage
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-01-04 19:44:20 +0000
committerZac Medico <zmedico@gentoo.org>2010-01-04 19:44:20 +0000
commit9cf10f07ecede8bdf8c07dd85bcb1a36030f2c60 (patch)
treedb970758f09596228a5f59ee2d3d8eb5b754f923 /pym/portage
parent9f6ffeb8b0216316ad17a34f78144f0cd5a4c15b (diff)
downloadportage-9cf10f07ecede8bdf8c07dd85bcb1a36030f2c60.tar.gz
portage-9cf10f07ecede8bdf8c07dd85bcb1a36030f2c60.tar.bz2
portage-9cf10f07ecede8bdf8c07dd85bcb1a36030f2c60.zip
Revert vercmp() behavior so 12.2b > 12.2.5 which was accidentally changed in
r2309 (between portage-2.0.x and portage-2.1). Thanks to Brian Harring for reporting in bug #287848, comment #3. svn path=/main/trunk/; revision=15161
Diffstat (limited to 'pym/portage')
-rw-r--r--pym/portage/tests/versions/test_vercmp.py6
-rw-r--r--pym/portage/versions.py17
2 files changed, 15 insertions, 8 deletions
diff --git a/pym/portage/tests/versions/test_vercmp.py b/pym/portage/tests/versions/test_vercmp.py
index 22ab2aa10..3aecbfa87 100644
--- a/pym/portage/tests/versions/test_vercmp.py
+++ b/pym/portage/tests/versions/test_vercmp.py
@@ -17,7 +17,8 @@ class VerCmpTestCase(TestCase):
("1.0-r1", "1.0"),
("999999999999999999999999999999", "999999999999999999999999999998"),
("1.0.0", "1.0"),
- ("12.2.5", "12.2b"),
+ ("1.0b", "1.0.0"),
+ ("12.2b", "12.2.5"),
]
for test in tests:
self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) )
@@ -35,7 +36,8 @@ class VerCmpTestCase(TestCase):
("1.0-r0", "1.0-r1"),
("1.0", "1.0-r1"),
("1.0", "1.0.0"),
- ("12.2b", "12.2.5"),
+ ("1.0.0", "1.0b"),
+ ("12.2.5", "12.2b"),
]
for test in tests:
self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1]))
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index 426abff18..72c79ba77 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -103,6 +103,17 @@ def vercmp(ver1, ver2, silent=1):
if len(match1.group(3)) or len(match2.group(3)):
vlist1 = match1.group(3)[1:].split(".")
vlist2 = match2.group(3)[1:].split(".")
+
+ # and now the final letter
+ if match1.group(5):
+ vlist1.append(str(ord(match1.group(5))))
+ else:
+ vlist1.append('0')
+ if match2.group(5):
+ vlist2.append(str(ord(match2.group(5))))
+ else:
+ vlist2.append('0')
+
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
@@ -131,12 +142,6 @@ def vercmp(ver1, ver2, silent=1):
list1.append(int(vlist1[i].ljust(max_len, "0")))
list2.append(int(vlist2[i].ljust(max_len, "0")))
- # and now the final letter
- if len(match1.group(5)):
- list1.append(ord(match1.group(5)))
- if len(match2.group(5)):
- list2.append(ord(match2.group(5)))
-
for i in range(0, max(len(list1), len(list2))):
if len(list1) <= i:
vercmp_cache[mykey] = -1