1 |
Author: zmedico |
2 |
Date: 2010-01-29 18:44:31 +0000 (Fri, 29 Jan 2010) |
3 |
New Revision: 15229 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py |
7 |
main/branches/2.1.7/pym/portage/versions.py |
8 |
Log: |
9 |
Revert vercmp() behavior so 12.2b > 12.2.5 which was accidentally changed in |
10 |
r2309 (between portage-2.0.x and portage-2.1). Thanks to Brian Harring for |
11 |
reporting in bug #287848, comment #3. (trunk r15161) |
12 |
|
13 |
Modified: main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py |
14 |
=================================================================== |
15 |
--- main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py 2010-01-29 18:44:05 UTC (rev 15228) |
16 |
+++ main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py 2010-01-29 18:44:31 UTC (rev 15229) |
17 |
@@ -17,7 +17,8 @@ |
18 |
("1.0-r1", "1.0"), |
19 |
("999999999999999999999999999999", "999999999999999999999999999998"), |
20 |
("1.0.0", "1.0"), |
21 |
- ("12.2.5", "12.2b"), |
22 |
+ ("1.0b", "1.0.0"), |
23 |
+ ("12.2b", "12.2.5"), |
24 |
] |
25 |
for test in tests: |
26 |
self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) ) |
27 |
@@ -35,7 +36,8 @@ |
28 |
("1.0-r0", "1.0-r1"), |
29 |
("1.0", "1.0-r1"), |
30 |
("1.0", "1.0.0"), |
31 |
- ("12.2b", "12.2.5"), |
32 |
+ ("1.0.0", "1.0b"), |
33 |
+ ("12.2.5", "12.2b"), |
34 |
] |
35 |
for test in tests: |
36 |
self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1])) |
37 |
|
38 |
Modified: main/branches/2.1.7/pym/portage/versions.py |
39 |
=================================================================== |
40 |
--- main/branches/2.1.7/pym/portage/versions.py 2010-01-29 18:44:05 UTC (rev 15228) |
41 |
+++ main/branches/2.1.7/pym/portage/versions.py 2010-01-29 18:44:31 UTC (rev 15229) |
42 |
@@ -103,6 +103,17 @@ |
43 |
if len(match1.group(3)) or len(match2.group(3)): |
44 |
vlist1 = match1.group(3)[1:].split(".") |
45 |
vlist2 = match2.group(3)[1:].split(".") |
46 |
+ |
47 |
+ # and now the final letter |
48 |
+ if match1.group(5): |
49 |
+ vlist1.append(str(ord(match1.group(5)))) |
50 |
+ else: |
51 |
+ vlist1.append('0') |
52 |
+ if match2.group(5): |
53 |
+ vlist2.append(str(ord(match2.group(5)))) |
54 |
+ else: |
55 |
+ vlist2.append('0') |
56 |
+ |
57 |
for i in range(0, max(len(vlist1), len(vlist2))): |
58 |
# Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it |
59 |
# would be ambiguous if two versions that aren't literally equal |
60 |
@@ -131,12 +142,6 @@ |
61 |
list1.append(int(vlist1[i].ljust(max_len, "0"))) |
62 |
list2.append(int(vlist2[i].ljust(max_len, "0"))) |
63 |
|
64 |
- # and now the final letter |
65 |
- if len(match1.group(5)): |
66 |
- list1.append(ord(match1.group(5))) |
67 |
- if len(match2.group(5)): |
68 |
- list2.append(ord(match2.group(5))) |
69 |
- |
70 |
for i in range(0, max(len(list1), len(list2))): |
71 |
if len(list1) <= i: |
72 |
vercmp_cache[mykey] = -1 |