Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r13734 - in main/branches/prefix: bin pym/_emerge pym/portage pym/portage/cache pym/portage/elog pym/portage/env pym/portage/sets pym/repoman
Date: Mon, 29 Jun 2009 19:09:50
Message-Id: E1MLMEc-0001dZ-3C@stork.gentoo.org
1 Author: grobian
2 Date: 2009-06-29 19:09:45 +0000 (Mon, 29 Jun 2009)
3 New Revision: 13734
4
5 Modified:
6 main/branches/prefix/bin/etc-update
7 main/branches/prefix/bin/repoman
8 main/branches/prefix/pym/_emerge/Package.py
9 main/branches/prefix/pym/_emerge/Scheduler.py
10 main/branches/prefix/pym/_emerge/depgraph.py
11 main/branches/prefix/pym/portage/__init__.py
12 main/branches/prefix/pym/portage/cache/metadata_overlay.py
13 main/branches/prefix/pym/portage/elog/__init__.py
14 main/branches/prefix/pym/portage/elog/messages.py
15 main/branches/prefix/pym/portage/elog/mod_echo.py
16 main/branches/prefix/pym/portage/elog/mod_mail.py
17 main/branches/prefix/pym/portage/elog/mod_mail_summary.py
18 main/branches/prefix/pym/portage/elog/mod_save_summary.py
19 main/branches/prefix/pym/portage/env/loaders.py
20 main/branches/prefix/pym/portage/sets/__init__.py
21 main/branches/prefix/pym/portage/sets/dbapi.py
22 main/branches/prefix/pym/portage/sets/files.py
23 main/branches/prefix/pym/portage/sets/libs.py
24 main/branches/prefix/pym/repoman/checks.py
25 Log:
26 Merged from trunk -r13717:13733
27
28 | 13723 | make sure etc-update sorts updates in the order (1) leading |
29 | SpankMan | dir path (2) filename (3) cfg update |
30
31 | 13724 | Bug #236786 - Warn about 'test?' USE conditionals in |
32 | zmedico | RDEPEND. Thanks to Markus Meier <maekke@g.o> for |
33 | | this patch. |
34
35 | 13725 | Check for redundant blank lines. Thanks to Markus Meier |
36 | zmedico | <maekke@g.o> for this patch. |
37
38 | 13726 | Make Package.invalid suitable for use by repoman. |
39 | zmedico | |
40
41 | 13728 | Use Package.invalid to generate *.syntax repoman errors for |
42 | zmedico | LICENSE, PROPERTIES, PROVIDE, and RESTRICT. |
43
44 | 13729 | Fix Package.metadata USE conditional evaluation so that |
45 | zmedico | it's delayed until after config.setcpv() has calculated |
46 | | PORTAGE_USE. Thanks to Arfrever for reporting. |
47
48 | 13730 | Bug #253467 - Fix regression in config._env_blacklist |
49 | zmedico | handling. |
50
51 | 13731 | Fix constructor to avoid TypeError when the "perms" keyword |
52 | zmedico | parameter is given. |
53
54 | 13732 | Add missing resume_depgraph import, and remove unused |
55 | zmedico | imports. |
56
57 | 13733 | Prepare 41 messages to localization. |
58 | arfrever | |
59
60
61 Modified: main/branches/prefix/bin/etc-update
62 ===================================================================
63 --- main/branches/prefix/bin/etc-update 2009-06-29 11:23:09 UTC (rev 13733)
64 +++ main/branches/prefix/bin/etc-update 2009-06-29 19:09:45 UTC (rev 13734)
65 @@ -63,8 +63,8 @@
66 # The below set -f turns off file name globbing in the ${find_opts} expansion.
67 for file in $(set -f ; find ${path}/ ${find_opts} \
68 ! -name '.*~' ! -iname '.*.bak' -print |
69 - sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" |
70 - sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'); do
71 + sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\1%\2\%\3:" |
72 + sort -t'%' -k2,2 -k4,4 -k3,3 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'); do
73
74 rpath=$(echo "${file/\/\///}" | sed -e "s:/[^/]*$::")
75 rfile=$(echo "${file/\/\///}" | sed -e "s:^.*/::")
76
77 Modified: main/branches/prefix/bin/repoman
78 ===================================================================
79 --- main/branches/prefix/bin/repoman 2009-06-29 11:23:09 UTC (rev 13733)
80 +++ main/branches/prefix/bin/repoman 2009-06-29 19:09:45 UTC (rev 13734)
81 @@ -1199,6 +1199,14 @@
82 continue
83
84 pkg = pkgs[y]
85 +
86 + if pkg.invalid:
87 + for k, msgs in pkg.invalid.iteritems():
88 + for msg in msgs:
89 + stats[k] = stats[k] + 1
90 + fails[k].append("%s %s" % (relative_path, msg))
91 + continue
92 +
93 myaux = pkg.metadata
94 eapi = myaux["EAPI"]
95 inherited = pkg.inherited
96 @@ -1232,21 +1240,9 @@
97 "%s: '%s' found in thirdpartymirrors" % \
98 (relative_path, mirror))
99
100 - # Test for negative logic and bad words in the RESTRICT var.
101 - #for x in myaux[allvars.index("RESTRICT")].split():
102 - # if x.startswith("no"):
103 - # print "Bad RESTRICT value: %s" % x
104 - try:
105 - portage.dep.use_reduce(
106 - portage.dep.paren_reduce(myaux["PROVIDE"]), matchall=1)
107 - except portage.exception.InvalidDependString, e:
108 - stats["PROVIDE.syntax"] = stats["PROVIDE.syntax"] + 1
109 - fails["PROVIDE.syntax"].append(mykey+".ebuild PROVIDE: "+str(e))
110 - del e
111 - continue
112 -
113 # The Package class automatically evaluates USE conditionals.
114 - for myprovide in myaux["PROVIDE"].split():
115 + for myprovide in portage.flatten(portage.dep.use_reduce(
116 + portage.dep.paren_reduce(pkg.metadata['PROVIDE']), matchall=1)):
117 prov_cp = portage.dep_getkey(myprovide)
118 if prov_cp != myprovide:
119 stats["virtual.versioned"]+=1
120 @@ -1404,7 +1400,11 @@
121 if mytype in ("DEPEND", "RDEPEND", "PDEPEND"):
122 for token in mydepstr.split():
123 if token in operator_tokens or \
124 - token.endswith("?"):
125 + token[-1:] == "?":
126 + if token == "test?" and mytype == "RDEPEND":
127 + stats['RDEPEND.suspect'] += 1
128 + fails['RDEPEND.suspect'].append(relative_path + \
129 + ": 'test?' USE conditional in RDEPEND")
130 continue
131 try:
132 atom = portage.dep.Atom(token)
133
134 Modified: main/branches/prefix/pym/_emerge/Package.py
135 ===================================================================
136 --- main/branches/prefix/pym/_emerge/Package.py 2009-06-29 11:23:09 UTC (rev 13733)
137 +++ main/branches/prefix/pym/_emerge/Package.py 2009-06-29 19:09:45 UTC (rev 13734)
138 @@ -54,10 +54,14 @@
139 self.cpv_split = portage.catpkgsplit(self.cpv)
140 self.pv_split = self.cpv_split[1:]
141
142 - def _invalid_metadata(self, msg):
143 + def _invalid_metadata(self, msg_type, msg):
144 if self.invalid is None:
145 - self.invalid = []
146 - self.invalid.append(msg)
147 + self.invalid = {}
148 + msgs = self.invalid.get(msg_type)
149 + if msgs is None:
150 + msgs = []
151 + self.invalid[msg_type] = msgs
152 + msgs.append(msg)
153
154 class _use_class(object):
155
156 @@ -185,14 +189,10 @@
157 def __getitem__(self, k):
158 v = _PackageMetadataWrapperBase.__getitem__(self, k)
159 if k in self._use_conditional_keys:
160 - if '?' in v:
161 + if self._pkg.root_config.settings.local_config and '?' in v:
162 try:
163 - if self._pkg.root_config.settings.local_config:
164 - v = paren_enclose(paren_normalize(use_reduce(
165 - paren_reduce(v), uselist=self._pkg.use.enabled)))
166 - else:
167 - v = paren_enclose(paren_normalize(use_reduce(
168 - paren_reduce(v), matchall=1)))
169 + v = paren_enclose(paren_normalize(use_reduce(
170 + paren_reduce(v), uselist=self._pkg.use.enabled)))
171 except portage.exception.InvalidDependString:
172 # This error should already have been registered via
173 # self._pkg._invalid_metadata().
174 @@ -219,7 +219,7 @@
175 try:
176 use_reduce(paren_reduce(v), matchall=1)
177 except portage.exception.InvalidDependString, e:
178 - self._pkg._invalid_metadata("%s: %s" % (k, e))
179 + self._pkg._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
180
181 def _set_inherited(self, k, v):
182 if isinstance(v, basestring):
183
184 Modified: main/branches/prefix/pym/_emerge/Scheduler.py
185 ===================================================================
186 --- main/branches/prefix/pym/_emerge/Scheduler.py 2009-06-29 11:23:09 UTC (rev 13733)
187 +++ main/branches/prefix/pym/_emerge/Scheduler.py 2009-06-29 19:09:45 UTC (rev 13734)
188 @@ -33,7 +33,7 @@
189 from _emerge.create_depgraph_params import create_depgraph_params
190 from _emerge.create_world_atom import create_world_atom
191 from _emerge.DepPriority import DepPriority
192 -from _emerge.depgraph import depgraph
193 +from _emerge.depgraph import depgraph, resume_depgraph
194 from _emerge.EbuildFetcher import EbuildFetcher
195 from _emerge.EbuildPhase import EbuildPhase
196 from _emerge.emergelog import emergelog, _emerge_log_dir
197 @@ -47,7 +47,6 @@
198 from _emerge.RootConfig import RootConfig
199 from _emerge.SlotObject import SlotObject
200 from _emerge.SequentialTaskQueue import SequentialTaskQueue
201 -from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
202
203 class Scheduler(PollScheduler):
204
205 @@ -323,8 +322,6 @@
206 return background
207
208 def _get_interactive_tasks(self):
209 - from portage import flatten
210 - from portage.dep import use_reduce, paren_reduce
211 interactive_tasks = []
212 for task in self._mergelist:
213 if not (isinstance(task, Package) and \
214
215 Modified: main/branches/prefix/pym/_emerge/depgraph.py
216 ===================================================================
217 --- main/branches/prefix/pym/_emerge/depgraph.py 2009-06-29 11:23:09 UTC (rev 13733)
218 +++ main/branches/prefix/pym/_emerge/depgraph.py 2009-06-29 19:09:45 UTC (rev 13734)
219 @@ -4900,8 +4900,9 @@
220 mreasons.append("CHOST: %s" % \
221 pkg.metadata["CHOST"])
222 if pkg.invalid:
223 - for msg in pkg.invalid:
224 - mreasons.append("invalid: %s" % (msg,))
225 + for msg_type, msgs in pkg.invalid.iteritems():
226 + for msg in msgs:
227 + mreasons.append("invalid: %s" % (msg,))
228
229 if pkg.built and not pkg.installed:
230 if not "EPREFIX" in pkg.metadata or not pkg.metadata["EPREFIX"]:
231
232 Modified: main/branches/prefix/pym/portage/__init__.py
233 ===================================================================
234 --- main/branches/prefix/pym/portage/__init__.py 2009-06-29 11:23:09 UTC (rev 13733)
235 +++ main/branches/prefix/pym/portage/__init__.py 2009-06-29 19:09:45 UTC (rev 13734)
236 @@ -1605,6 +1605,7 @@
237 for blacklisted in self._env_blacklist:
238 for cfg in self.lookuplist:
239 cfg.pop(blacklisted, None)
240 + self.backupenv.pop(blacklisted, None)
241 del blacklisted, cfg
242
243 self["PORTAGE_CONFIGROOT"] = config_root
244 @@ -2265,9 +2266,12 @@
245 if mydb:
246 if not hasattr(mydb, "aux_get"):
247 for k in aux_keys:
248 - v = mydb.get(k)
249 - if v is not None:
250 - pkg_configdict[k] = v
251 + if k in mydb:
252 + # Make these lazy, since __getitem__ triggers
253 + # evaluation of USE conditionals which can't
254 + # occur until PORTAGE_USE is calculated below.
255 + pkg_configdict.addLazySingleton(k,
256 + mydb.__getitem__, k)
257 else:
258 for k, v in izip(aux_keys, mydb.aux_get(self.mycpv, aux_keys)):
259 pkg_configdict[k] = v
260
261 Modified: main/branches/prefix/pym/portage/cache/metadata_overlay.py
262 ===================================================================
263 --- main/branches/prefix/pym/portage/cache/metadata_overlay.py 2009-06-29 11:23:09 UTC (rev 13733)
264 +++ main/branches/prefix/pym/portage/cache/metadata_overlay.py 2009-06-29 19:09:45 UTC (rev 13734)
265 @@ -16,6 +16,7 @@
266 *args, **config):
267 super_config = config.copy()
268 super_config.pop("gid", None)
269 + super_config.pop("perms", None)
270 super(database, self).__init__(location, label, auxdbkeys,
271 *args, **super_config)
272 self.db_rw = db_rw(location, label, auxdbkeys, **config)
273
274 Modified: main/branches/prefix/pym/portage/elog/__init__.py
275 ===================================================================
276 --- main/branches/prefix/pym/portage/elog/__init__.py 2009-06-29 11:23:09 UTC (rev 13733)
277 +++ main/branches/prefix/pym/portage/elog/__init__.py 2009-06-29 19:09:45 UTC (rev 13734)
278 @@ -13,6 +13,7 @@
279 from portage.process import atexit_register
280 from portage.elog.messages import collect_ebuild_messages, collect_messages
281 from portage.elog.filtering import filter_loglevels
282 +from portage.localization import _
283
284 import os
285
286 @@ -157,8 +158,8 @@
287 _elog_atexit_handlers.append(m.finalize)
288 atexit_register(m.finalize)
289 except (ImportError, AttributeError), e:
290 - writemsg("!!! Error while importing logging modules " + \
291 - "while loading \"mod_%s\":\n" % str(s))
292 + writemsg(_("!!! Error while importing logging modules "
293 + "while loading \"mod_%s\":\n") % str(s))
294 writemsg("%s\n" % str(e), noiselevel=-1)
295 except PortageException, e:
296 writemsg("%s\n" % str(e), noiselevel=-1)
297
298 Modified: main/branches/prefix/pym/portage/elog/messages.py
299 ===================================================================
300 --- main/branches/prefix/pym/portage/elog/messages.py 2009-06-29 11:23:09 UTC (rev 13733)
301 +++ main/branches/prefix/pym/portage/elog/messages.py 2009-06-29 19:09:45 UTC (rev 13734)
302 @@ -10,6 +10,7 @@
303 )
304
305 from portage.const import EBUILD_PHASES
306 +from portage.localization import _
307
308 import os
309 import sys
310 @@ -32,7 +33,7 @@
311 for msgfunction in mylogfiles:
312 filename = os.path.join(path, msgfunction)
313 if msgfunction not in EBUILD_PHASES:
314 - writemsg("!!! can't process invalid log file: %s\n" % filename,
315 + writemsg(_("!!! can't process invalid log file: %s\n") % filename,
316 noiselevel=-1)
317 continue
318 if not msgfunction in logentries:
319 @@ -45,8 +46,8 @@
320 try:
321 msgtype, msg = l.split(" ", 1)
322 except ValueError:
323 - writemsg("!!! malformed entry in " + \
324 - "log file: '%s'\n" % filename, noiselevel=-1)
325 + writemsg(_("!!! malformed entry in "
326 + "log file: '%s'\n") % filename, noiselevel=-1)
327 continue
328
329 if lastmsgtype is None:
330
331 Modified: main/branches/prefix/pym/portage/elog/mod_echo.py
332 ===================================================================
333 --- main/branches/prefix/pym/portage/elog/mod_echo.py 2009-06-29 11:23:09 UTC (rev 13733)
334 +++ main/branches/prefix/pym/portage/elog/mod_echo.py 2009-06-29 19:09:45 UTC (rev 13734)
335 @@ -5,6 +5,7 @@
336
337 from portage.output import EOutput, colorize
338 from portage.const import EBUILD_PHASES
339 +from portage.localization import _
340
341 _items = []
342 def process(mysettings, key, logentries, fulltext):
343 @@ -18,12 +19,13 @@
344 global _items
345 printer = EOutput()
346 for mysettings, key, logentries in _items:
347 - root_msg = ""
348 - if mysettings["ROOT"] != "/":
349 - root_msg = " merged to %s" % mysettings["ROOT"]
350 print
351 - printer.einfo("Messages for package %s%s:" % \
352 - (colorize("INFORM", key), root_msg))
353 + if mysettings["ROOT"] == "/":
354 + printer.einfo(_("Messages for package %s:") %
355 + colorize("INFORM", key))
356 + else:
357 + printer.einfo(_("Messages for package %(pkg)s merged to %(root)s:") %
358 + {"pkg": colorize("INFORM", key), "root": mysettings["ROOT"]})
359 print
360 for phase in EBUILD_PHASES:
361 if phase not in logentries:
362
363 Modified: main/branches/prefix/pym/portage/elog/mod_mail.py
364 ===================================================================
365 --- main/branches/prefix/pym/portage/elog/mod_mail.py 2009-06-29 11:23:09 UTC (rev 13733)
366 +++ main/branches/prefix/pym/portage/elog/mod_mail.py 2009-06-29 19:09:45 UTC (rev 13734)
367 @@ -5,6 +5,7 @@
368
369 import portage.mail, socket
370 from portage.exception import PortageException
371 +from portage.localization import _
372 from portage.util import writemsg
373
374 def process(mysettings, key, logentries, fulltext):
375 @@ -20,17 +21,17 @@
376 mysubject = mysubject.replace("${HOST}", socket.getfqdn())
377
378 # look at the phases listed in our logentries to figure out what action was performed
379 - action = "merged"
380 + action = _("merged")
381 for phase in logentries.keys():
382 # if we found a *rm phase assume that the package was unmerged
383 if phase in ["postrm", "prerm"]:
384 - action = "unmerged"
385 + action = _("unmerged")
386 # if we think that the package was unmerged, make sure there was no unexpected
387 # phase recorded to avoid misinformation
388 - if action == "unmerged":
389 + if action == _("unmerged"):
390 for phase in logentries.keys():
391 if phase not in ["postrm", "prerm", "other"]:
392 - action = "unknown"
393 + action = _("unknown")
394
395 mysubject = mysubject.replace("${ACTION}", action)
396
397
398 Modified: main/branches/prefix/pym/portage/elog/mod_mail_summary.py
399 ===================================================================
400 --- main/branches/prefix/pym/portage/elog/mod_mail_summary.py 2009-06-29 11:23:09 UTC (rev 13733)
401 +++ main/branches/prefix/pym/portage/elog/mod_mail_summary.py 2009-06-29 19:09:45 UTC (rev 13734)
402 @@ -5,14 +5,15 @@
403
404 import portage.mail, socket, os, time
405 from portage.exception import PortageException
406 +from portage.localization import _
407 from portage.util import writemsg
408 from email.MIMEText import MIMEText as TextMessage
409
410 _items = {}
411 def process(mysettings, key, logentries, fulltext):
412 global _items
413 - header = ">>> Messages generated for package %s by process %d on %s:\n\n" % \
414 - (key, os.getpid(), time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time())))
415 + header = _(">>> Messages generated for package %(pkg)s by process %(pid)d on %(time)s:\n\n") % \
416 + {"pkg": key, "pid": os.getpid(), "time": time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time()))}
417 config_root = mysettings["PORTAGE_CONFIGROOT"]
418 mysettings, items = _items.setdefault(config_root, (mysettings, {}))
419 items[key] = header + fulltext
420 @@ -30,9 +31,9 @@
421 if len(items) == 0:
422 return
423 elif len(items) == 1:
424 - count = "one package"
425 + count = _("one package")
426 else:
427 - count = "multiple packages"
428 + count = _("multiple packages")
429 if "PORTAGE_ELOG_MAILURI" in mysettings:
430 myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0]
431 else:
432 @@ -44,8 +45,8 @@
433 mysubject = mysubject.replace("${PACKAGE}", count)
434 mysubject = mysubject.replace("${HOST}", socket.getfqdn())
435
436 - mybody = "elog messages for the following packages generated by " + \
437 - "process %d on host %s:\n" % (os.getpid(), socket.getfqdn())
438 + mybody = _("elog messages for the following packages generated by "
439 + "process %(pid)d on host %(host)s:\n") % {"pid": os.getpid(), "host": socket.getfqdn()}
440 for key in items:
441 mybody += "- %s\n" % key
442
443
444 Modified: main/branches/prefix/pym/portage/elog/mod_save_summary.py
445 ===================================================================
446 --- main/branches/prefix/pym/portage/elog/mod_save_summary.py 2009-06-29 11:23:09 UTC (rev 13733)
447 +++ main/branches/prefix/pym/portage/elog/mod_save_summary.py 2009-06-29 19:09:45 UTC (rev 13734)
448 @@ -5,6 +5,7 @@
449
450 import os, time
451 from portage.data import portage_uid, portage_gid
452 +from portage.localization import _
453 from portage.util import ensure_dirs, apply_permissions
454 from portage.const import EPREFIX
455
456 @@ -19,8 +20,8 @@
457 elogfilename = elogdir+"/summary.log"
458 elogfile = open(elogfilename, "a")
459 apply_permissions(elogfilename, mode=060, mask=0)
460 - elogfile.write(">>> Messages generated by process %d on %s for package %s:\n\n" % \
461 - (os.getpid(), time.strftime("%Y-%m-%d %H:%M:%S %Z", time.localtime(time.time())), key))
462 + elogfile.write(_(">>> Messages generated by process %(pid)d on %(time)s for package %(pkg)s:\n\n") %
463 + {"pid": os.getpid(), "time": time.strftime("%Y-%m-%d %H:%M:%S %Z", time.localtime(time.time())), "pkg": key})
464 elogfile.write(fulltext)
465 elogfile.write("\n")
466 elogfile.close()
467
468 Modified: main/branches/prefix/pym/portage/env/loaders.py
469 ===================================================================
470 --- main/branches/prefix/pym/portage/env/loaders.py 2009-06-29 11:23:09 UTC (rev 13733)
471 +++ main/branches/prefix/pym/portage/env/loaders.py 2009-06-29 19:09:45 UTC (rev 13734)
472 @@ -5,6 +5,7 @@
473
474 import os
475 import stat
476 +from portage.localization import _
477
478 class LoaderError(Exception):
479
480 @@ -181,13 +182,13 @@
481 split = line.split()
482 if not len(split):
483 errors.setdefault(self.fname, []).append(
484 - "Malformed data at line: %s, data: %s"
485 + _("Malformed data at line: %s, data: %s")
486 % (line_num + 1, line))
487 return
488 key = split[0]
489 if not self._validate(key):
490 errors.setdefault(self.fname, []).append(
491 - "Validation failed at line: %s, data %s"
492 + _("Validation failed at line: %s, data %s")
493 % (line_num + 1, key))
494 return
495 data[key] = None
496 @@ -222,19 +223,19 @@
497 split = line.split()
498 if len(split) < 1:
499 errors.setdefault(self.fname, []).append(
500 - "Malformed data at line: %s, data: %s"
501 + _("Malformed data at line: %s, data: %s")
502 % (line_num + 1, line))
503 return
504 key = split[0]
505 value = split[1:]
506 if not self._validate(key):
507 errors.setdefault(self.fname, []).append(
508 - "Key validation failed at line: %s, data %s"
509 + _("Key validation failed at line: %s, data %s")
510 % (line_num + 1, key))
511 return
512 if not self._valueValidate(value):
513 errors.setdefault(self.fname, []).append(
514 - "Value validation failed at line: %s, data %s"
515 + _("Value validation failed at line: %s, data %s")
516 % (line_num + 1, value))
517 return
518 if key in data:
519 @@ -276,24 +277,24 @@
520 split = line.split('=', 1)
521 if len(split) < 2:
522 errors.setdefault(self.fname, []).append(
523 - "Malformed data at line: %s, data %s"
524 + _("Malformed data at line: %s, data %s")
525 % (line_num + 1, line))
526 return
527 key = split[0].strip()
528 value = split[1].strip()
529 if not key:
530 errors.setdefault(self.fname, []).append(
531 - "Malformed key at line: %s, key %s"
532 + _("Malformed key at line: %s, key %s")
533 % (line_num + 1, key))
534 return
535 if not self._validate(key):
536 errors.setdefault(self.fname, []).append(
537 - "Key validation failed at line: %s, data %s"
538 + _("Key validation failed at line: %s, data %s")
539 % (line_num + 1, key))
540 return
541 if not self._valueValidate(value):
542 errors.setdefault(self.fname, []).append(
543 - "Value validation failed at line: %s, data %s"
544 + _("Value validation failed at line: %s, data %s")
545 % (line_num + 1, value))
546 return
547 if key in data:
548
549 Modified: main/branches/prefix/pym/portage/sets/__init__.py
550 ===================================================================
551 --- main/branches/prefix/pym/portage/sets/__init__.py 2009-06-29 11:23:09 UTC (rev 13733)
552 +++ main/branches/prefix/pym/portage/sets/__init__.py 2009-06-29 19:09:45 UTC (rev 13734)
553 @@ -10,6 +10,7 @@
554 from portage import load_mod
555 from portage.const import USER_CONFIG_PATH, GLOBAL_CONFIG_PATH
556 from portage.exception import PackageSetNotFound
557 +from portage.localization import _
558
559 SETPREFIX = "@"
560
561 @@ -21,7 +22,7 @@
562 elif options[name].lower() in ("0", "no", "off", "false"):
563 return False
564 else:
565 - raise SetConfigError("invalid value '%s' for option '%s'" % (options[name], name))
566 + raise SetConfigError(_("invalid value '%(value)s' for option '%(option)s'") % {"value": options[name], "option": name})
567
568 class SetConfigError(Exception):
569 pass
570 @@ -56,7 +57,8 @@
571 section = self.psets[setname].creator
572 if parser.has_option(section, "multiset") and \
573 parser.getboolean(section, "multiset"):
574 - self.errors.append("Invalid request to reconfigure set '%s' generated by multiset section '%s'" % (setname, section))
575 + self.errors.append(_("Invalid request to reconfigure set '%(set)s' generated "
576 + "by multiset section '%(section)s'") % {"set": setname, "section": section})
577 return
578 for k, v in options.items():
579 parser.set(section, k, v)
580 @@ -80,7 +82,8 @@
581 try:
582 setclass = load_mod("portage.sets."+classname)
583 except (ImportError, AttributeError):
584 - self.errors.append("Could not import '%s' for section '%s'" % (classname, sname))
585 + self.errors.append(_("Could not import '%(class)s' for section "
586 + "'%(section)s'") % {"class": classname, "section": sname})
587 continue
588 # prepare option dict for the current section
589 optdict = {}
590 @@ -95,18 +98,19 @@
591 try:
592 newsets = setclass.multiBuilder(optdict, self.settings, self.trees)
593 except SetConfigError, e:
594 - self.errors.append("Configuration error in section '%s': %s" % (sname, str(e)))
595 + self.errors.append(_("Configuration error in section '%s': %s") % (sname, str(e)))
596 continue
597 for x in newsets:
598 if x in self.psets and not update:
599 - self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (x, self.psets[x].creator, sname))
600 + self.errors.append(_("Redefinition of set '%s' (sections: '%s', '%s')") % (x, self.psets[x].creator, sname))
601 newsets[x].creator = sname
602 if parser.has_option(sname, "world-candidate") and \
603 not parser.getboolean(sname, "world-candidate"):
604 newsets[x].world_candidate = False
605 self.psets.update(newsets)
606 else:
607 - self.errors.append("Section '%s' is configured as multiset, but '%s' doesn't support that configuration" % (sname, classname))
608 + self.errors.append(_("Section '%(section)s' is configured as multiset, but '%(class)s' "
609 + "doesn't support that configuration") % {"section": sname, "class": classname})
610 continue
611 else:
612 try:
613 @@ -114,7 +118,7 @@
614 except NoOptionError:
615 setname = sname
616 if setname in self.psets and not update:
617 - self.errors.append("Redefinition of set '%s' (sections: '%s', '%s')" % (setname, self.psets[setname].creator, sname))
618 + self.errors.append(_("Redefinition of set '%s' (sections: '%s', '%s')") % (setname, self.psets[setname].creator, sname))
619 if hasattr(setclass, "singleBuilder"):
620 try:
621 self.psets[setname] = setclass.singleBuilder(optdict, self.settings, self.trees)
622 @@ -123,10 +127,11 @@
623 not parser.getboolean(sname, "world-candidate"):
624 self.psets[setname].world_candidate = False
625 except SetConfigError, e:
626 - self.errors.append("Configuration error in section '%s': %s" % (sname, str(e)))
627 + self.errors.append(_("Configuration error in section '%s': %s") % (sname, str(e)))
628 continue
629 else:
630 - self.errors.append("'%s' does not support individual set creation, section '%s' must be configured as multiset" % (classname, sname))
631 + self.errors.append(_("'%(class)s' does not support individual set creation, section '%(section)s' "
632 + "must be configured as multiset") % {"class": classname, "section": sname})
633 continue
634 self._parsed = True
635
636
637 Modified: main/branches/prefix/pym/portage/sets/dbapi.py
638 ===================================================================
639 --- main/branches/prefix/pym/portage/sets/dbapi.py 2009-06-29 11:23:09 UTC (rev 13733)
640 +++ main/branches/prefix/pym/portage/sets/dbapi.py 2009-06-29 19:09:45 UTC (rev 13734)
641 @@ -4,6 +4,7 @@
642
643 from portage.versions import catpkgsplit, catsplit, pkgcmp, best
644 from portage.dep import Atom
645 +from portage.localization import _
646 from portage.sets.base import PackageSet
647 from portage.sets import SetConfigError, get_boolean
648
649 @@ -81,7 +82,7 @@
650
651 def singleBuilder(cls, options, settings, trees):
652 if not "files" in options:
653 - raise SetConfigError("no files given")
654 + raise SetConfigError(_("no files given"))
655
656 import shlex
657 return cls(vardb=trees["vartree"].dbapi,
658 @@ -119,17 +120,17 @@
659
660 variable = options.get("variable")
661 if variable is None:
662 - raise SetConfigError("missing required attribute: 'variable'")
663 + raise SetConfigError(_("missing required attribute: 'variable'"))
664
665 includes = options.get("includes", "")
666 excludes = options.get("excludes", "")
667
668 if not (includes or excludes):
669 - raise SetConfigError("no includes or excludes given")
670 + raise SetConfigError(_("no includes or excludes given"))
671
672 metadatadb = options.get("metadata-source", "vartree")
673 if not metadatadb in trees.keys():
674 - raise SetConfigError("invalid value '%s' for option metadata-source" % metadatadb)
675 + raise SetConfigError(_("invalid value '%s' for option metadata-source") % metadatadb)
676
677 return cls(trees["vartree"].dbapi,
678 metadatadb=trees[metadatadb].dbapi,
679 @@ -198,7 +199,7 @@
680
681 metadatadb = options.get("metadata-source", "porttree")
682 if not metadatadb in trees:
683 - raise SetConfigError(("invalid value '%s' for option " + \
684 + raise SetConfigError(_("invalid value '%s' for option "
685 "metadata-source") % (metadatadb,))
686
687 return cls(trees["vartree"].dbapi,
688 @@ -234,11 +235,11 @@
689
690 def singleBuilder(cls, options, settings, trees):
691 if not "category" in options:
692 - raise SetConfigError("no category given")
693 + raise SetConfigError(_("no category given"))
694
695 category = options["category"]
696 if not category in settings.categories:
697 - raise SetConfigError("invalid category name '%s'" % category)
698 + raise SetConfigError(_("invalid category name '%s'") % category)
699
700 visible = cls._builderGetVisible(options)
701
702 @@ -252,7 +253,7 @@
703 categories = options["categories"].split()
704 invalid = set(categories).difference(settings.categories)
705 if invalid:
706 - raise SetConfigError("invalid categories: %s" % ", ".join(list(invalid)))
707 + raise SetConfigError(_("invalid categories: %s") % ", ".join(list(invalid)))
708 else:
709 categories = settings.categories
710
711 @@ -260,7 +261,7 @@
712 name_pattern = options.get("name_pattern", "$category/*")
713
714 if not "$category" in name_pattern and not "${category}" in name_pattern:
715 - raise SetConfigError("name_pattern doesn't include $category placeholder")
716 + raise SetConfigError(_("name_pattern doesn't include $category placeholder"))
717
718 for cat in categories:
719 myset = CategorySet(cat, trees["porttree"].dbapi, only_visible=visible)
720 @@ -293,11 +294,11 @@
721 def singleBuilder(cls, options, settings, trees):
722 mode = options.get("mode", "older")
723 if str(mode).lower() not in ["newer", "older"]:
724 - raise SetConfigError("invalid 'mode' value %s (use either 'newer' or 'older')" % mode)
725 + raise SetConfigError(_("invalid 'mode' value %s (use either 'newer' or 'older')") % mode)
726 try:
727 age = int(options.get("age", "7"))
728 except ValueError, e:
729 - raise SetConfigError("value of option 'age' is not an integer")
730 + raise SetConfigError(_("value of option 'age' is not an integer"))
731 return AgeSet(vardb=trees["vartree"].dbapi, mode=mode, age=age)
732
733 singleBuilder = classmethod(singleBuilder)
734
735 Modified: main/branches/prefix/pym/portage/sets/files.py
736 ===================================================================
737 --- main/branches/prefix/pym/portage/sets/files.py 2009-06-29 11:23:09 UTC (rev 13733)
738 +++ main/branches/prefix/pym/portage/sets/files.py 2009-06-29 19:09:45 UTC (rev 13734)
739 @@ -8,6 +8,7 @@
740
741 from portage.util import grabfile, write_atomic, ensure_dirs, normalize_path
742 from portage.const import PRIVATE_PATH, USER_CONFIG_PATH, EPREFIX_LSTRIP
743 +from portage.localization import _
744 from portage.locks import lockfile, unlockfile
745 from portage import portage_gid
746 from portage.sets.base import PackageSet, EditablePackageSet
747 @@ -30,7 +31,7 @@
748 self.description = "Package set loaded from file %s" % self._filename
749 self.loader = ItemFileLoader(self._filename, self._validate)
750 if greedy and not dbapi:
751 - self.errors.append("%s configured as greedy set, but no dbapi instance passed in constructor" % self._filename)
752 + self.errors.append(_("%s configured as greedy set, but no dbapi instance passed in constructor") % self._filename)
753 greedy = False
754 self.greedy = greedy
755 self.dbapi = dbapi
756 @@ -94,7 +95,7 @@
757
758 def singleBuilder(self, options, settings, trees):
759 if not "filename" in options:
760 - raise SetConfigError("no filename specified")
761 + raise SetConfigError(_("no filename specified"))
762 greedy = get_boolean(options, "greedy", False)
763 filename = options["filename"]
764 # look for repository path variables
765 @@ -103,7 +104,7 @@
766 try:
767 filename = self._repopath_sub.sub(trees["porttree"].dbapi.treemap[match.groupdict()["reponame"]], filename)
768 except KeyError:
769 - raise SetConfigError("Could not find repository '%s'" % match.groupdict()["reponame"])
770 + raise SetConfigError(_("Could not find repository '%s'") % match.groupdict()["reponame"])
771 return StaticFileSet(filename, greedy=greedy, dbapi=trees["vartree"].dbapi)
772 singleBuilder = classmethod(singleBuilder)
773
774 @@ -112,7 +113,7 @@
775 directory = options.get("directory", os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep), "sets"))
776 name_pattern = options.get("name_pattern", "${name}")
777 if not "$name" in name_pattern and not "${name}" in name_pattern:
778 - raise SetConfigError("name_pattern doesn't include ${name} placeholder")
779 + raise SetConfigError(_("name_pattern doesn't include ${name} placeholder"))
780 greedy = get_boolean(options, "greedy", False)
781 # look for repository path variables
782 match = self._repopath_match.match(directory)
783 @@ -120,7 +121,7 @@
784 try:
785 directory = self._repopath_sub.sub(trees["porttree"].dbapi.treemap[match.groupdict()["reponame"]], directory)
786 except KeyError:
787 - raise SetConfigError("Could not find repository '%s'" % match.groupdict()["reponame"])
788 + raise SetConfigError(_("Could not find repository '%s'") % match.groupdict()["reponame"])
789 if os.path.isdir(directory):
790 directory = normalize_path(directory)
791 for parent, dirs, files in os.walk(directory):
792 @@ -155,7 +156,7 @@
793
794 def singleBuilder(self, options, settings, trees):
795 if not "filename" in options:
796 - raise SetConfigError("no filename specified")
797 + raise SetConfigError(_("no filename specified"))
798 return ConfigFileSet(options["filename"])
799 singleBuilder = classmethod(singleBuilder)
800
801 @@ -164,7 +165,7 @@
802 directory = options.get("directory", os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH.lstrip(os.sep)))
803 name_pattern = options.get("name_pattern", "sets/package_$suffix")
804 if not "$suffix" in name_pattern and not "${suffix}" in name_pattern:
805 - raise SetConfigError("name_pattern doesn't include $suffix placeholder")
806 + raise SetConfigError(_("name_pattern doesn't include $suffix placeholder"))
807 for suffix in ["keywords", "use", "mask", "unmask"]:
808 myname = name_pattern.replace("$suffix", suffix)
809 myname = myname.replace("${suffix}", suffix)
810
811 Modified: main/branches/prefix/pym/portage/sets/libs.py
812 ===================================================================
813 --- main/branches/prefix/pym/portage/sets/libs.py 2009-06-29 11:23:09 UTC (rev 13733)
814 +++ main/branches/prefix/pym/portage/sets/libs.py 2009-06-29 19:09:45 UTC (rev 13734)
815 @@ -2,6 +2,7 @@
816 # Distributed under the terms of the GNU General Public License v2
817 # $Id$
818
819 +from portage.localization import _
820 from portage.sets.base import PackageSet
821 from portage.sets import get_boolean
822 from portage.versions import catpkgsplit
823 @@ -49,7 +50,7 @@
824 import shlex
825 files = tuple(shlex.split(options.get("files", "")))
826 if not files:
827 - raise SetConfigError("no files given")
828 + raise SetConfigError(_("no files given"))
829 debug = get_boolean(options, "debug", False)
830 return LibraryFileConsumerSet(trees["vartree"].dbapi,
831 files, debug=debug)
832
833 Modified: main/branches/prefix/pym/repoman/checks.py
834 ===================================================================
835 --- main/branches/prefix/pym/repoman/checks.py 2009-06-29 11:23:09 UTC (rev 13733)
836 +++ main/branches/prefix/pym/repoman/checks.py 2009-06-29 19:09:45 UTC (rev 13734)
837 @@ -82,6 +82,25 @@
838 if self.trailing_whitespace.match(line) is None:
839 return errors.TRAILING_WHITESPACE_ERROR
840
841 +class EbuildBlankLine(LineCheck):
842 + repoman_check_name = 'ebuild.minorsyn'
843 + blank_line = re.compile(r'^$')
844 +
845 + def new(self, pkg):
846 + self.line_is_blank = False
847 +
848 + def check(self, num, line):
849 + if self.line_is_blank and self.blank_line.match(line):
850 + return 'Useless blank line on line: %d'
851 + if self.blank_line.match(line):
852 + self.line_is_blank = True
853 + else:
854 + self.line_is_blank = False
855 +
856 + def end(self):
857 + if self.line_is_blank:
858 + yield 'Useless blank line on last line'
859 +
860 class EbuildQuote(LineCheck):
861 """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
862
863 @@ -471,7 +490,7 @@
864
865
866 _constant_checks = tuple((c() for c in (
867 - EbuildHeader, EbuildWhitespace, EbuildQuote,
868 + EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote,
869 EbuildAssignment, EbuildUselessDodoc,
870 EbuildUselessCdS, EbuildNestedDie,
871 EbuildPatches, EbuildQuotedA, EapiDefinition,