1 |
Author: grobian |
2 |
Date: 2009-08-24 09:50:34 +0000 (Mon, 24 Aug 2009) |
3 |
New Revision: 14148 |
4 |
|
5 |
Modified: |
6 |
main/branches/prefix/bin/repoman |
7 |
main/branches/prefix/man/repoman.1 |
8 |
main/branches/prefix/pym/portage/dbapi/bintree.py |
9 |
main/branches/prefix/pym/portage/dbapi/vartree.py |
10 |
main/branches/prefix/pym/portage/output.py |
11 |
main/branches/prefix/pym/portage/update.py |
12 |
main/branches/prefix/pym/portage/xpak.py |
13 |
Log: |
14 |
Merged from trunk -r14131:14140 |
15 |
|
16 |
| 14132 | Add a LIVEVCS.unmasked category for ebuilds that have | |
17 |
| zmedico | non-empty KEYWORDS and are not masked in the global | |
18 |
| | package.mask. Thanks to Diego E. Petten?\195?\178 for the | |
19 |
| | suggestion. | |
20 |
|
21 |
| 14133 | Bug #282306 - Inside dblink._match_contents(), fall back to | |
22 |
| zmedico | utf_8 encoding if a path cannot be encoded under the user's | |
23 |
| | chosen encoding. This should fix the traceback shown in bug | |
24 |
| | #281199, comment #26. | |
25 |
|
26 |
| 14134 | Bug #282505 - Fix unicode handling for package moves in | |
27 |
| zmedico | binary packages. | |
28 |
|
29 |
| 14140 | remove FIXME, since zmedico fixed it | |
30 |
| grobian | | |
31 |
|
32 |
|
33 |
Modified: main/branches/prefix/bin/repoman |
34 |
=================================================================== |
35 |
--- main/branches/prefix/bin/repoman 2009-08-24 09:49:02 UTC (rev 14147) |
36 |
+++ main/branches/prefix/bin/repoman 2009-08-24 09:50:34 UTC (rev 14148) |
37 |
@@ -300,6 +300,7 @@ |
38 |
"variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set", |
39 |
"variable.readonly":"Assigning a readonly variable", |
40 |
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.", |
41 |
+ "LIVEVCS.unmasked":"This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask.", |
42 |
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file", |
43 |
"IUSE.undefined":"This ebuild does not define IUSE (style guideline says to define IUSE even when empty)", |
44 |
"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.", |
45 |
@@ -362,7 +363,8 @@ |
46 |
"virtual.unavailable", |
47 |
"usage.obsolete", |
48 |
"upstream.workaround", |
49 |
-"LIVEVCS.stable" |
50 |
+"LIVEVCS.stable", |
51 |
+"LIVEVCS.unmasked", |
52 |
)) |
53 |
|
54 |
non_ascii_re = re.compile(r'[^\x00-\x7f]') |
55 |
@@ -570,6 +572,7 @@ |
56 |
kwlist = set() |
57 |
liclist = set() |
58 |
uselist = set() |
59 |
+global_pmasklines = [] |
60 |
|
61 |
for path in portdb.porttrees: |
62 |
try: |
63 |
@@ -600,6 +603,9 @@ |
64 |
if x: |
65 |
uselist.add(use_prefix + x[0]) |
66 |
|
67 |
+ global_pmasklines.append(portage.util.grabfile_package( |
68 |
+ os.path.join(path, 'profiles', 'package.mask'), recursive=1)) |
69 |
+ |
70 |
desc_path = os.path.join(path, 'profiles', 'profiles.desc') |
71 |
try: |
72 |
desc_file = codecs.open(_unicode_encode(desc_path, |
73 |
@@ -635,6 +641,21 @@ |
74 |
repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist)) |
75 |
repoman_settings.backup_changes('PORTAGE_ARCHLIST') |
76 |
|
77 |
+global_pmasklines = portage.util.stack_lists(global_pmasklines, incremental=1) |
78 |
+global_pmaskdict = {} |
79 |
+for x in global_pmasklines: |
80 |
+ global_pmaskdict.setdefault(portage.dep_getkey(x), []).append(x) |
81 |
+del global_pmasklines |
82 |
+ |
83 |
+def has_global_mask(pkg): |
84 |
+ mask_atoms = global_pmaskdict.get(pkg.cp) |
85 |
+ if mask_atoms: |
86 |
+ pkg_list = [pkg] |
87 |
+ for x in mask_atoms: |
88 |
+ if portage.dep.match_from_list(x, pkg_list): |
89 |
+ return x |
90 |
+ return None |
91 |
+ |
92 |
# Ensure that profile sub_path attributes are unique. Process in reverse order |
93 |
# so that profiles with duplicate sub_path from overlays will override |
94 |
# profiles with the same sub_path from parent repos. |
95 |
@@ -1347,6 +1368,10 @@ |
96 |
bad_stable_keywords) |
97 |
del bad_stable_keywords |
98 |
|
99 |
+ if keywords and not has_global_mask(pkg): |
100 |
+ stats["LIVEVCS.unmasked"] += 1 |
101 |
+ fails["LIVEVCS.unmasked"].append(relative_path) |
102 |
+ |
103 |
if options.ignore_arches: |
104 |
arches = [[repoman_settings["ARCH"], repoman_settings["ARCH"], |
105 |
repoman_settings["ACCEPT_KEYWORDS"].split()]] |
106 |
|
107 |
Modified: main/branches/prefix/man/repoman.1 |
108 |
=================================================================== |
109 |
--- main/branches/prefix/man/repoman.1 2009-08-24 09:49:02 UTC (rev 14147) |
110 |
+++ main/branches/prefix/man/repoman.1 2009-08-24 09:50:34 UTC (rev 14148) |
111 |
@@ -149,6 +149,10 @@ |
112 |
.B LIVEVCS.stable |
113 |
Ebuild is a live ebuild (cvs, git, darcs, svn, etc) checkout with stable keywords. |
114 |
.TP |
115 |
+.B LIVEVCS.unmasked |
116 |
+Ebuild is a live ebuild (cvs, git, darcs, svn, etc) checkout but has keywords |
117 |
+and is not masked in the global package.mask. |
118 |
+.TP |
119 |
.B PDEPEND.bad |
120 |
User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds) |
121 |
.TP |
122 |
|
123 |
Modified: main/branches/prefix/pym/portage/dbapi/bintree.py |
124 |
=================================================================== |
125 |
--- main/branches/prefix/pym/portage/dbapi/bintree.py 2009-08-24 09:49:02 UTC (rev 14147) |
126 |
+++ main/branches/prefix/pym/portage/dbapi/bintree.py 2009-08-24 09:50:34 UTC (rev 14148) |
127 |
@@ -266,13 +266,21 @@ |
128 |
mydata = mytbz2.get_data() |
129 |
updated_items = update_dbentries([mylist], mydata) |
130 |
mydata.update(updated_items) |
131 |
- mydata["PF"] = mynewpkg + "\n" |
132 |
- mydata["CATEGORY"] = mynewcat+"\n" |
133 |
+ mydata[_unicode_encode('PF', |
134 |
+ encoding=_encodings['repo.content'])] = \ |
135 |
+ _unicode_encode(mynewpkg + "\n", |
136 |
+ encoding=_encodings['repo.content']) |
137 |
+ mydata[_unicode_encode('CATEGORY', |
138 |
+ encoding=_encodings['repo.content'])] = \ |
139 |
+ _unicode_encode(mynewcat + "\n", |
140 |
+ encoding=_encodings['repo.content']) |
141 |
if mynewpkg != myoldpkg: |
142 |
- ebuild_data = mydata.get(myoldpkg+".ebuild") |
143 |
+ ebuild_data = mydata.pop(_unicode_encode(myoldpkg + '.ebuild', |
144 |
+ encoding=_encodings['repo.content']), None) |
145 |
if ebuild_data is not None: |
146 |
- mydata[mynewpkg+".ebuild"] = ebuild_data |
147 |
- del mydata[myoldpkg+".ebuild"] |
148 |
+ mydata[_unicode_encode(mynewpkg + '.ebuild', |
149 |
+ encoding=_encodings['repo.content'])] = ebuild_data |
150 |
+ |
151 |
mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata)) |
152 |
|
153 |
self.dbapi.cpv_remove(mycpv) |
154 |
|
155 |
Modified: main/branches/prefix/pym/portage/dbapi/vartree.py |
156 |
=================================================================== |
157 |
--- main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:49:02 UTC (rev 14147) |
158 |
+++ main/branches/prefix/pym/portage/dbapi/vartree.py 2009-08-24 09:50:34 UTC (rev 14148) |
159 |
@@ -3339,23 +3339,65 @@ |
160 |
if the file is not owned by this package. |
161 |
""" |
162 |
|
163 |
- os = _os_merge |
164 |
- |
165 |
filename = _unicode_decode(filename, |
166 |
encoding=_encodings['content'], errors='strict') |
167 |
|
168 |
destroot = _unicode_decode(destroot, |
169 |
encoding=_encodings['content'], errors='strict') |
170 |
|
171 |
+ # The given filename argument might have a different encoding than the |
172 |
+ # the filenames contained in the contents, so use separate wrapped os |
173 |
+ # modules for each. The basename is more likely to contain non-ascii |
174 |
+ # characters than the directory path, so use os_filename_arg for all |
175 |
+ # operations involving the basename of the filename arg. |
176 |
+ os_filename_arg = _os_merge |
177 |
+ os = _os_merge |
178 |
+ |
179 |
+ try: |
180 |
+ _unicode_encode(filename, |
181 |
+ encoding=_encodings['merge'], errors='strict') |
182 |
+ except UnicodeEncodeError: |
183 |
+ # The package appears to have been merged with a |
184 |
+ # different value of sys.getfilesystemencoding(), |
185 |
+ # so fall back to utf_8 if appropriate. |
186 |
+ try: |
187 |
+ _unicode_encode(filename, |
188 |
+ encoding=_encodings['fs'], errors='strict') |
189 |
+ except UnicodeEncodeError: |
190 |
+ pass |
191 |
+ else: |
192 |
+ os_filename_arg = portage.os |
193 |
+ |
194 |
destfile = normalize_path( |
195 |
- os.path.join(destroot, filename.lstrip(os.path.sep))) |
196 |
+ os_filename_arg.path.join(destroot, |
197 |
+ filename.lstrip(os_filename_arg.path.sep))) |
198 |
|
199 |
pkgfiles = self.getcontents() |
200 |
if pkgfiles and destfile in pkgfiles: |
201 |
return destfile |
202 |
if pkgfiles: |
203 |
- basename = os.path.basename(destfile) |
204 |
+ basename = os_filename_arg.path.basename(destfile) |
205 |
if self._contents_basenames is None: |
206 |
+ |
207 |
+ try: |
208 |
+ for x in pkgfiles: |
209 |
+ _unicode_encode(x, |
210 |
+ encoding=_encodings['merge'], |
211 |
+ errors='strict') |
212 |
+ except UnicodeEncodeError: |
213 |
+ # The package appears to have been merged with a |
214 |
+ # different value of sys.getfilesystemencoding(), |
215 |
+ # so fall back to utf_8 if appropriate. |
216 |
+ try: |
217 |
+ for x in pkgfiles: |
218 |
+ _unicode_encode(x, |
219 |
+ encoding=_encodings['fs'], |
220 |
+ errors='strict') |
221 |
+ except UnicodeEncodeError: |
222 |
+ pass |
223 |
+ else: |
224 |
+ os = portage.os |
225 |
+ |
226 |
self._contents_basenames = set( |
227 |
os.path.basename(x) for x in pkgfiles) |
228 |
if basename not in self._contents_basenames: |
229 |
@@ -3366,15 +3408,36 @@ |
230 |
|
231 |
# Use stat rather than lstat since we want to follow |
232 |
# any symlinks to the real parent directory. |
233 |
- parent_path = os.path.dirname(destfile) |
234 |
+ parent_path = os_filename_arg.path.dirname(destfile) |
235 |
try: |
236 |
- parent_stat = os.stat(parent_path) |
237 |
+ parent_stat = os_filename_arg.stat(parent_path) |
238 |
except EnvironmentError, e: |
239 |
if e.errno != errno.ENOENT: |
240 |
raise |
241 |
del e |
242 |
return False |
243 |
if self._contents_inodes is None: |
244 |
+ |
245 |
+ if os is _os_merge: |
246 |
+ try: |
247 |
+ for x in pkgfiles: |
248 |
+ _unicode_encode(x, |
249 |
+ encoding=_encodings['merge'], |
250 |
+ errors='strict') |
251 |
+ except UnicodeEncodeError: |
252 |
+ # The package appears to have been merged with a |
253 |
+ # different value of sys.getfilesystemencoding(), |
254 |
+ # so fall back to utf_8 if appropriate. |
255 |
+ try: |
256 |
+ for x in pkgfiles: |
257 |
+ _unicode_encode(x, |
258 |
+ encoding=_encodings['fs'], |
259 |
+ errors='strict') |
260 |
+ except UnicodeEncodeError: |
261 |
+ pass |
262 |
+ else: |
263 |
+ os = portage.os |
264 |
+ |
265 |
self._contents_inodes = {} |
266 |
parent_paths = set() |
267 |
for x in pkgfiles: |
268 |
@@ -3396,11 +3459,12 @@ |
269 |
self._contents_inodes[inode_key] = p_path_list |
270 |
if p_path not in p_path_list: |
271 |
p_path_list.append(p_path) |
272 |
+ |
273 |
p_path_list = self._contents_inodes.get( |
274 |
(parent_stat.st_dev, parent_stat.st_ino)) |
275 |
if p_path_list: |
276 |
for p_path in p_path_list: |
277 |
- x = os.path.join(p_path, basename) |
278 |
+ x = os_filename_arg.path.join(p_path, basename) |
279 |
if x in pkgfiles: |
280 |
return x |
281 |
|
282 |
|
283 |
Modified: main/branches/prefix/pym/portage/output.py |
284 |
=================================================================== |
285 |
--- main/branches/prefix/pym/portage/output.py 2009-08-24 09:49:02 UTC (rev 14147) |
286 |
+++ main/branches/prefix/pym/portage/output.py 2009-08-24 09:50:34 UTC (rev 14148) |
287 |
@@ -152,11 +152,6 @@ |
288 |
@rtype: dict |
289 |
@return: a dictionary mapping color classes to color codes |
290 |
""" |
291 |
- # FIXME: use config_root iso / (breaks Prefix) |
292 |
- # We can use ObjectProxy to implement lazy initialization of |
293 |
- # codes and _styles, and add an init(config_root="/") function |
294 |
- # that can be called in order adjust the location that color.map |
295 |
- # is read from. |
296 |
global codes, _styles |
297 |
myfile = os.path.join(config_root, COLOR_MAP_FILE) |
298 |
ansi_code_pattern = re.compile("^[0-9;]*m$") |
299 |
|
300 |
Modified: main/branches/prefix/pym/portage/update.py |
301 |
=================================================================== |
302 |
--- main/branches/prefix/pym/portage/update.py 2009-08-24 09:49:02 UTC (rev 14147) |
303 |
+++ main/branches/prefix/pym/portage/update.py 2009-08-24 09:50:34 UTC (rev 14148) |
304 |
@@ -55,12 +55,18 @@ |
305 |
dict containing only the updated items.""" |
306 |
updated_items = {} |
307 |
for k, mycontent in mydata.iteritems(): |
308 |
- if k not in ignored_dbentries: |
309 |
+ k_unicode = _unicode_decode(k, |
310 |
+ encoding=_encodings['repo.content'], errors='replace') |
311 |
+ if k_unicode not in ignored_dbentries: |
312 |
+ mycontent = _unicode_decode(mycontent, |
313 |
+ encoding=_encodings['repo.content'], errors='replace') |
314 |
orig_content = mycontent |
315 |
for update_cmd in update_iter: |
316 |
mycontent = update_dbentry(update_cmd, mycontent) |
317 |
if mycontent != orig_content: |
318 |
- updated_items[k] = mycontent |
319 |
+ updated_items[k] = _unicode_encode(mycontent, |
320 |
+ encoding=_encodings['repo.content'], |
321 |
+ errors='backslashreplace') |
322 |
return updated_items |
323 |
|
324 |
def fixdbentries(update_iter, dbdir): |
325 |
@@ -77,7 +83,7 @@ |
326 |
updated_items = update_dbentries(update_iter, mydata) |
327 |
for myfile, mycontent in updated_items.iteritems(): |
328 |
file_path = os.path.join(dbdir, myfile) |
329 |
- write_atomic(file_path, mycontent) |
330 |
+ write_atomic(file_path, mycontent, encoding=_encodings['repo.content']) |
331 |
return len(updated_items) > 0 |
332 |
|
333 |
def grab_updates(updpath, prev_mtimes=None): |
334 |
|
335 |
Modified: main/branches/prefix/pym/portage/xpak.py |
336 |
=================================================================== |
337 |
--- main/branches/prefix/pym/portage/xpak.py 2009-08-24 09:49:02 UTC (rev 14147) |
338 |
+++ main/branches/prefix/pym/portage/xpak.py 2009-08-24 09:50:34 UTC (rev 14148) |
339 |
@@ -97,6 +97,17 @@ |
340 |
|
341 |
def xpak_mem(mydata): |
342 |
"""Create an xpack segement from a map object.""" |
343 |
+ |
344 |
+ mydata_encoded = {} |
345 |
+ for k, v in mydata.iteritems(): |
346 |
+ k = _unicode_encode(k, |
347 |
+ encoding=_encodings['repo.content'], errors='backslashreplace') |
348 |
+ v = _unicode_encode(v, |
349 |
+ encoding=_encodings['repo.content'], errors='backslashreplace') |
350 |
+ mydata_encoded[k] = v |
351 |
+ mydata = mydata_encoded |
352 |
+ del mydata_encoded |
353 |
+ |
354 |
indexglob = _unicode_encode('') |
355 |
indexpos=0 |
356 |
dataglob = _unicode_encode('') |