Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15230 - in main/branches/2.1.7/pym/portage: . tests/versions
Date: Fri, 29 Jan 2010 18:44:56
Message-Id: E1Navpn-0005hy-Hu@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-01-29 18:44:47 +0000 (Fri, 29 Jan 2010)
3 New Revision: 15230
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 Fix vercmp so 1b > 1 and add corresponding tests. (trunk r15162)
10
11 Modified: main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py
12 ===================================================================
13 --- main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py 2010-01-29 18:44:31 UTC (rev 15229)
14 +++ main/branches/2.1.7/pym/portage/tests/versions/test_vercmp.py 2010-01-29 18:44:47 UTC (rev 15230)
15 @@ -18,6 +18,7 @@
16 ("999999999999999999999999999999", "999999999999999999999999999998"),
17 ("1.0.0", "1.0"),
18 ("1.0b", "1.0.0"),
19 + ("1b", "1"),
20 ("12.2b", "12.2.5"),
21 ]
22 for test in tests:
23 @@ -37,6 +38,7 @@
24 ("1.0", "1.0-r1"),
25 ("1.0", "1.0.0"),
26 ("1.0.0", "1.0b"),
27 + ("1", "1b"),
28 ("12.2.5", "12.2b"),
29 ]
30 for test in tests:
31 @@ -63,6 +65,7 @@
32 ("1.0", "1.0-r1"),
33 ("1.0-r1", "1.0"),
34 ("1.0", "1.0.0"),
35 + ("1b", "1"),
36 ("12.2b", "12.2"),
37 ]
38 for test in tests:
39
40 Modified: main/branches/2.1.7/pym/portage/versions.py
41 ===================================================================
42 --- main/branches/2.1.7/pym/portage/versions.py 2010-01-29 18:44:31 UTC (rev 15229)
43 +++ main/branches/2.1.7/pym/portage/versions.py 2010-01-29 18:44:47 UTC (rev 15230)
44 @@ -100,10 +100,14 @@
45 list2 = [int(match2.group(2))]
46
47 # this part would greatly benefit from a fixed-length version pattern
48 - if len(match1.group(3)) or len(match2.group(3)):
49 + if match1.group(3) or match2.group(3):
50 vlist1 = match1.group(3)[1:].split(".")
51 vlist2 = match2.group(3)[1:].split(".")
52 + else:
53 + vlist1 = []
54 + vlist2 = []
55
56 + if match1.group(5) or match2.group(5):
57 # and now the final letter
58 if match1.group(5):
59 vlist1.append(str(ord(match1.group(5))))
60 @@ -114,6 +118,8 @@
61 else:
62 vlist2.append('0')
63
64 + if vlist1 or vlist2:
65 +
66 for i in range(0, max(len(vlist1), len(vlist2))):
67 # Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it
68 # would be ambiguous if two versions that aren't literally equal