Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15170 - in main/branches/prefix: bin/ebuild-helpers man pym/_emerge pym/portage pym/portage/tests/versions
Date: Tue, 05 Jan 2010 19:23:48
Message-Id: E1NSF0L-0002Jk-OV@stork.gentoo.org
1 Author: grobian
2 Date: 2010-01-05 19:23:45 +0000 (Tue, 05 Jan 2010)
3 New Revision: 15170
4
5 Modified:
6 main/branches/prefix/bin/ebuild-helpers/doins
7 main/branches/prefix/man/ebuild.5
8 main/branches/prefix/pym/_emerge/JobStatusDisplay.py
9 main/branches/prefix/pym/portage/__init__.py
10 main/branches/prefix/pym/portage/tests/versions/test_vercmp.py
11 main/branches/prefix/pym/portage/versions.py
12 Log:
13 Merged from trunk -r15154:15166
14
15 | 15155 | Add some tests related to bug #287848. |
16 | zmedico | |
17
18 | 15156 | Use get_term_size() to adjust to current terminal width. |
19 | zmedico | Thanks to Dror Levin <spatz@g.0> for the initial patch. |
20
21 | 15157 | Document doins -r option. |
22 | zmedico | |
23
24 | 15158 | Bug #299248 - Fix doins return code handling to make sure it |
25 | zmedico | always fails when appropriate. Thanks to Jonathan Callen |
26 | | <abcd@g.o> for the initial patch. |
27
28 | 15159 | Bug #298310 - Make sure the _selinux attribute is correctly |
29 | zmedico | reinitialized after reload(portage) is called. |
30
31 | 15160 | Add test cases for implicit .0 at end of version. |
32 | zmedico | |
33
34 | 15161 | Revert vercmp() behavior so 12.2b > 12.2.5 which was |
35 | zmedico | accidentally changed in r2309 (between portage-2.0.x and |
36 | | portage-2.1). Thanks to Brian Harring for reporting in bug |
37 | | #287848, comment #3. |
38
39 | 15162 | Fix vercmp so 1b > 1 and add corresponding tests. |
40 | zmedico | |
41
42 | 15163 | Add test cases for cvs versions. |
43 | zmedico | |
44
45 | 15164 | Add some more cases for versions with letter suffixes. |
46 | zmedico | |
47
48 | 15165 | More cases. |
49 | zmedico | |
50
51 | 15166 | Revert r15161 so 12.2.5 is greater than 12.2b once again. |
52 | zmedico | Depending on how you look at, it may seem counter-intuitive. |
53 | | However, if you really think about it, it seems like it's |
54 | | probably safe to assume that 12.2.5 > 12.2b is the behavior |
55 | | that is intended by anyone who would use versions such as |
56 | | these. |
57
58
59 Modified: main/branches/prefix/bin/ebuild-helpers/doins
60 ===================================================================
61 --- main/branches/prefix/bin/ebuild-helpers/doins 2010-01-05 19:15:39 UTC (rev 15169)
62 +++ main/branches/prefix/bin/ebuild-helpers/doins 2010-01-05 19:23:45 UTC (rev 15170)
63 @@ -71,12 +71,20 @@
64 }
65
66 _xdoins() {
67 + local -i success=0 failed=0
68 while read -d $'\0' x ; do
69 _doins "$x" "${x%/*}"
70 + if [[ $? -eq 0 ]] ; then
71 + ((success|=1))
72 + else
73 + ((failed|=1))
74 + fi
75 done
76 + [[ $failed -ne 0 || $success -eq 0 ]] && return 1 || return 0
77 }
78
79 success=0
80 +failed=0
81
82 for x in "$@" ; do
83 if [[ $PRESERVE_SYMLINKS = n && -d $x ]] || \
84 @@ -108,15 +116,24 @@
85 fi
86 find "$x_orig" -type d -exec dodir "${INSDESTTREE}/{}" \;
87 find "$x_orig" \( -type f -or -type l \) -print0 | _xdoins
88 + if [[ ${PIPESTATUS[1]} -eq 0 ]] ; then
89 + ((success|=1))
90 + else
91 + ((failed|=1))
92 + fi
93 if [[ $x != $x_orig ]] ; then
94 popd >/dev/null
95 mv "$TMP/1/$x_orig" "$x"
96 fi
97 while popd >/dev/null 2>&1 ; do true ; done
98 - ((success|=1))
99 else
100 - _doins "${x}" && ((success|=1))
101 + _doins "${x}"
102 + if [[ $? -eq 0 ]] ; then
103 + ((success|=1))
104 + else
105 + ((failed|=1))
106 + fi
107 fi
108 done
109 rm -rf "$TMP"
110 -[ $success -gt 0 ] && exit 0 || exit 1
111 +[[ $failed -ne 0 || $success -eq 0 ]] && exit 1 || exit 0
112
113 Modified: main/branches/prefix/man/ebuild.5
114 ===================================================================
115 --- main/branches/prefix/man/ebuild.5 2010-01-05 19:15:39 UTC (rev 15169)
116 +++ main/branches/prefix/man/ebuild.5 2010-01-05 19:23:45 UTC (rev 15170)
117 @@ -1017,9 +1017,10 @@
118 Can be used to define options for the install function used in
119 \fBdoins\fR. The default is \fI\-m0644\fR.
120 .TP
121 -\fBdoins\fR \fI<file> [list of more files]\fR
122 +\fBdoins\fR \fI[-r] <file> [list of more files]\fR
123 Installs files into the path controlled by \fBinsinto\fR. This function
124 uses \fBinstall\fR(1). Creates all necessary dirs.
125 +Setting -r sets recursive.
126 .TP
127 \fBexeinto\fR \fI[path]\fR
128 Sets the destination path for the \fBdoexe\fR function.
129
130 Modified: main/branches/prefix/pym/_emerge/JobStatusDisplay.py
131 ===================================================================
132 --- main/branches/prefix/pym/_emerge/JobStatusDisplay.py 2010-01-05 19:15:39 UTC (rev 15169)
133 +++ main/branches/prefix/pym/_emerge/JobStatusDisplay.py 2010-01-05 19:23:45 UTC (rev 15170)
134 @@ -22,7 +22,6 @@
135 class JobStatusDisplay(object):
136
137 _bound_properties = ("curval", "failed", "running")
138 - _jobs_column_width = 48
139
140 # Don't update the display unless at least this much
141 # time has passed, in units of seconds.
142 @@ -48,7 +47,12 @@
143 object.__setattr__(self, "_changed", False)
144 object.__setattr__(self, "_displayed", False)
145 object.__setattr__(self, "_last_display_time", 0)
146 - object.__setattr__(self, "width", 80)
147 +
148 + width = portage.output.get_term_size()[1]
149 + if width <= 0 or width > 80:
150 + width = 80
151 + object.__setattr__(self, "width", width)
152 + object.__setattr__(self, "_jobs_column_width", width - 32)
153 self.reset()
154
155 isatty = hasattr(self.out, "isatty") and self.out.isatty()
156
157 Modified: main/branches/prefix/pym/portage/__init__.py
158 ===================================================================
159 --- main/branches/prefix/pym/portage/__init__.py 2010-01-05 19:15:39 UTC (rev 15169)
160 +++ main/branches/prefix/pym/portage/__init__.py 2010-01-05 19:23:45 UTC (rev 15170)
161 @@ -294,6 +294,9 @@
162 _selinux_merge = None
163 try:
164 import portage._selinux
165 + # Make sure the _selinux attribute is correctly reinitialized after
166 + # reload(portage) is called. See bug #298310.
167 + _selinux = sys.modules['portage._selinux']
168 selinux = _unicode_module_wrapper(_selinux,
169 encoding=_encodings['fs'])
170 _selinux_merge = _unicode_module_wrapper(_selinux,
171
172 Modified: main/branches/prefix/pym/portage/tests/versions/test_vercmp.py
173 ===================================================================
174 --- main/branches/prefix/pym/portage/tests/versions/test_vercmp.py 2010-01-05 19:15:39 UTC (rev 15169)
175 +++ main/branches/prefix/pym/portage/tests/versions/test_vercmp.py 2010-01-05 19:23:45 UTC (rev 15170)
176 @@ -15,7 +15,15 @@
177 tests = [ ( "6.0", "5.0"), ("5.0","5"),
178 ("1.0-r1", "1.0-r0"),
179 ("1.0-r1", "1.0"),
180 - ("999999999999999999999999999999", "999999999999999999999999999998"),]
181 + ("cvs.9999", "9999"),
182 + ("999999999999999999999999999999", "999999999999999999999999999998"),
183 + ("1.0.0", "1.0"),
184 + ("1.0.0", "1.0b"),
185 + ("1b", "1"),
186 + ("1b_p1", "1_p1"),
187 + ("1.1b", "1.1"),
188 + ("12.2.5", "12.2b"),
189 + ]
190 for test in tests:
191 self.failIf( vercmp( test[0], test[1] ) <= 0, msg="%s < %s? Wrong!" % (test[0],test[1]) )
192
193 @@ -27,10 +35,18 @@
194 ("1.0_alpha2", "1.0_p2"),("1.0_alpha1", "1.0_beta1"),("1.0_beta3","1.0_rc3"),
195 ("1.001000000000000000001", "1.001000000000000000002"),
196 ("1.00100000000", "1.0010000000000000001"),
197 + ("9999", "cvs.9999"),
198 ("999999999999999999999999999998", "999999999999999999999999999999"),
199 ("1.01", "1.1"),
200 ("1.0-r0", "1.0-r1"),
201 - ("1.0", "1.0-r1")]
202 + ("1.0", "1.0-r1"),
203 + ("1.0", "1.0.0"),
204 + ("1.0b", "1.0.0"),
205 + ("1_p1", "1b_p1"),
206 + ("1", "1b"),
207 + ("1.1", "1.1b"),
208 + ("12.2b", "12.2.5"),
209 + ]
210 for test in tests:
211 self.failIf( vercmp( test[0], test[1]) >= 0, msg="%s > %s? Wrong!" % (test[0],test[1]))
212
213 @@ -50,9 +66,16 @@
214
215 tests = [ ("1","2"),("1.0_alpha","1.0_pre"),("1.0_beta","1.0_alpha"),
216 ("0", "0.0"),
217 + ("cvs.9999", "9999"),
218 ("1.0-r0", "1.0-r1"),
219 ("1.0-r1", "1.0-r0"),
220 ("1.0", "1.0-r1"),
221 - ("1.0-r1", "1.0")]
222 + ("1.0-r1", "1.0"),
223 + ("1.0", "1.0.0"),
224 + ("1_p1", "1b_p1"),
225 + ("1b", "1"),
226 + ("1.1b", "1.1"),
227 + ("12.2b", "12.2"),
228 + ]
229 for test in tests:
230 self.failIf( vercmp( test[0], test[1]) == 0, msg="%s == %s? Wrong!" % (test[0],test[1]))
231
232 Modified: main/branches/prefix/pym/portage/versions.py
233 ===================================================================
234 --- main/branches/prefix/pym/portage/versions.py 2010-01-05 19:15:39 UTC (rev 15169)
235 +++ main/branches/prefix/pym/portage/versions.py 2010-01-05 19:23:45 UTC (rev 15170)
236 @@ -101,9 +101,10 @@
237 list2 = [int(match2.group(2))]
238
239 # this part would greatly benefit from a fixed-length version pattern
240 - if len(match1.group(3)) or len(match2.group(3)):
241 + if match1.group(3) or match2.group(3):
242 vlist1 = match1.group(3)[1:].split(".")
243 vlist2 = match2.group(3)[1:].split(".")
244 +
245 for i in range(0, max(len(vlist1), len(vlist2))):
246 # Implcit .0 is given a value of -1, so that 1.0.0 > 1.0, since it
247 # would be ambiguous if two versions that aren't literally equal
248 @@ -133,6 +134,11 @@
249 list2.append(int(vlist2[i].ljust(max_len, "0")))
250
251 # and now the final letter
252 + # NOTE: Behavior changed in r2309 (between portage-2.0.x and portage-2.1).
253 + # The new behavior is 12.2.5 > 12.2b which, depending on how you look at,
254 + # may seem counter-intuitive. However, if you really think about it, it
255 + # seems like it's probably safe to assume that this is the behavior that
256 + # is intended by anyone who would use versions such as these.
257 if len(match1.group(5)):
258 list1.append(ord(match1.group(5)))
259 if len(match2.group(5)):