Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15335 - in main/branches/prefix: bin pym/_emerge pym/portage pym/portage/dbapi
Date: Wed, 10 Feb 2010 18:49:42
Message-Id: E1NfHcx-0003kN-Rm@stork.gentoo.org
1 Author: grobian
2 Date: 2010-02-10 18:49:31 +0000 (Wed, 10 Feb 2010)
3 New Revision: 15335
4
5 Modified:
6 main/branches/prefix/bin/egencache
7 main/branches/prefix/bin/emaint
8 main/branches/prefix/bin/glsa-check
9 main/branches/prefix/bin/repoman
10 main/branches/prefix/pym/_emerge/create_world_atom.py
11 main/branches/prefix/pym/_emerge/emergelog.py
12 main/branches/prefix/pym/_emerge/main.py
13 main/branches/prefix/pym/portage/__init__.py
14 main/branches/prefix/pym/portage/dbapi/bintree.py
15 main/branches/prefix/pym/portage/dbapi/porttree.py
16 main/branches/prefix/pym/portage/glsa.py
17 Log:
18 Merged from trunk -r15320:15333
19
20 | 15321 | Bug #303445 - Fix getmaskingreason() to reset comment state |
21 | zmedico | when looping to the next package.mask file. |
22
23 | 15322 | Bug #303401 - Fix emerge.log disabling code that's been |
24 | zmedico | broken since portage-2.1.7 when the _emerge module got split |
25 | | up. |
26
27 | 15323 | Add an optional 'categories' parameter to |
28 | zmedico | portdbapi.cp_all(), for listing a subset of categories. |
29 | | Thanks to dol-sen for the suggestion. |
30
31 | 15324 | Fix deprecated reference to portdbapi.mysettings. |
32 | zmedico | |
33
34 | 15325 | Add a portdbapi.getRepositoryName() method which is the |
35 | zmedico | inverse of getRepositoryPath(). |
36
37 | 15326 | Import portage.StringIO for ImportError handling. |
38 | zmedico | |
39
40 | 15327 | Skip atom validation in WorldHandler since WorldSelectedSet |
41 | zmedico | handles this already, and use Atom.cp instead of |
42 | | dep_getkey(). |
43
44 | 15328 | Make Glsa constructor raise GlsaFormatException when a |
45 | zmedico | package name attribute is invalid. |
46
47 | 15329 | Use cpv_getkey() instead of dep_getkey() where appropriate. |
48 | zmedico | |
49
50 | 15330 | Use Atom.cp instead of dep_getkey(), and use cpv_getkey() |
51 | zmedico | instead of dep_getkey() where appropriate. |
52
53 | 15331 | Use Atom.cp instead of dep_getkey(). |
54 | zmedico | |
55
56 | 15332 | Bug #298479 - Filter $USER from the ebuild environment since |
57 | zmedico | it's inaccurate with FEATURES=userpriv. |
58
59 | 15333 | Bug #303211 - Discard invalid SIZE metadata when using the |
60 | zmedico | old binhost protocol. |
61
62
63 Modified: main/branches/prefix/bin/egencache
64 ===================================================================
65 --- main/branches/prefix/bin/egencache 2010-02-10 18:46:43 UTC (rev 15334)
66 +++ main/branches/prefix/bin/egencache 2010-02-10 18:49:31 UTC (rev 15335)
67 @@ -144,7 +144,7 @@
68 consumer=self._metadata_callback,
69 max_jobs=max_jobs, max_load=max_load)
70 self.returncode = os.EX_OK
71 - metadbmodule = portdb.mysettings.load_best_module("portdbapi.metadbmodule")
72 + metadbmodule = portdb.settings.load_best_module("portdbapi.metadbmodule")
73 self._trg_cache = metadbmodule(portdb.porttrees[0],
74 "metadata/cache", portage.auxdbkeys[:])
75 if rsync:
76
77 Modified: main/branches/prefix/bin/emaint
78 ===================================================================
79 --- main/branches/prefix/bin/emaint 2010-02-10 18:46:43 UTC (rev 15334)
80 +++ main/branches/prefix/bin/emaint 2010-02-10 18:49:31 UTC (rev 15335)
81 @@ -53,7 +53,7 @@
82 if onProgress:
83 onProgress(maxval, 0)
84 for i, atom in enumerate(world_atoms):
85 - if not portage.isvalidatom(atom):
86 + if not isinstance(atom, portage.dep.Atom):
87 if atom.startswith(SETPREFIX):
88 s = atom[len(SETPREFIX):]
89 if s in sets:
90 @@ -65,12 +65,11 @@
91 if onProgress:
92 onProgress(maxval, i+1)
93 continue
94 - cp = portage.dep_getkey(atom)
95 okay = True
96 if not vardb.match(atom):
97 self.not_installed.append(atom)
98 okay = False
99 - if portage.catsplit(cp)[0] not in categories:
100 + if portage.catsplit(atom.cp)[0] not in categories:
101 self.invalid_category.append(atom)
102 okay = False
103 if okay:
104
105 Modified: main/branches/prefix/bin/glsa-check
106 ===================================================================
107 --- main/branches/prefix/bin/glsa-check 2010-02-10 18:46:43 UTC (rev 15334)
108 +++ main/branches/prefix/bin/glsa-check 2010-02-10 18:49:31 UTC (rev 15335)
109 @@ -180,7 +180,7 @@
110 fd1.write("... ")
111 else:
112 for pkg in myglsa.packages:
113 - mylist = vardb.match(portage.dep_getkey(str(pkg)))
114 + mylist = vardb.match(pkg)
115 if len(mylist) > 0:
116 pkg = color(" ".join(mylist))
117 fd1.write(" " + pkg + " ")
118 @@ -230,12 +230,12 @@
119 sys.stdout.write("The following updates will be performed for this GLSA:\n")
120 for pkg in mergelist:
121 oldver = None
122 - for x in vardb.match(portage.dep_getkey(pkg)):
123 + for x in vardb.match(portage.cpv_getkey(pkg)):
124 if vardb.aux_get(x, ["SLOT"]) == portdb.aux_get(pkg, ["SLOT"]):
125 oldver = x
126 if oldver == None:
127 raise ValueError("could not find old version for package %s" % pkg)
128 - oldver = oldver[len(portage.dep_getkey(oldver))+1:]
129 + oldver = oldver[len(portage.cpv_getkey(oldver))+1:]
130 sys.stdout.write(" " + pkg + " (" + oldver + ")\n")
131 else:
132 sys.stdout.write("Nothing to do for this GLSA\n")
133
134 Modified: main/branches/prefix/bin/repoman
135 ===================================================================
136 --- main/branches/prefix/bin/repoman 2010-02-10 18:46:43 UTC (rev 15334)
137 +++ main/branches/prefix/bin/repoman 2010-02-10 18:49:31 UTC (rev 15335)
138 @@ -32,7 +32,6 @@
139 except ImportError:
140 from urllib import urlopen as urllib_request_urlopen
141
142 -from io import StringIO
143 from itertools import chain
144 from stat import S_ISDIR, ST_CTIME
145
146 @@ -53,6 +52,7 @@
147 from portage import os
148 from portage import _encodings
149 from portage import _unicode_encode
150 +from portage import StringIO
151
152 from repoman.checks import run_checks
153 from repoman import utilities
154 @@ -677,7 +677,7 @@
155 global_pmasklines = portage.util.stack_lists(global_pmasklines, incremental=1)
156 global_pmaskdict = {}
157 for x in global_pmasklines:
158 - global_pmaskdict.setdefault(portage.dep_getkey(x), []).append(x)
159 + global_pmaskdict.setdefault(x.cp, []).append(x)
160 del global_pmasklines
161
162 def has_global_mask(pkg):
163 @@ -1396,14 +1396,25 @@
164 "%s: '%s' found in thirdpartymirrors" % \
165 (relative_path, mirror))
166
167 + provide = portage.flatten(portage.dep.use_reduce(
168 + portage.dep.paren_reduce(pkg.metadata['PROVIDE']), matchall=1))
169 + provide_cps = []
170 +
171 # The Package class automatically evaluates USE conditionals.
172 - for myprovide in portage.flatten(portage.dep.use_reduce(
173 - portage.dep.paren_reduce(pkg.metadata['PROVIDE']), matchall=1)):
174 - prov_cp = portage.dep_getkey(myprovide)
175 + for myprovide in provide:
176 + try:
177 + myprovide = portage.dep.Atom(myprovide)
178 + except portage.exception.InvalidAtom:
179 + stats["PROVIDE.syntax"] = stats["PROVIDE.syntax"] + 1
180 + fails["PROVIDE.syntax"].append("%s: %s" % \
181 + (relative_path, myprovide))
182 + continue
183 + prov_cp = myprovide.cp
184 + provide_cps.append(prov_cp)
185 if prov_cp != myprovide:
186 stats["virtual.versioned"]+=1
187 fails["virtual.versioned"].append(x+"/"+y+".ebuild: "+myprovide)
188 - prov_pkg = portage.dep_getkey(
189 + prov_pkg = portage.cpv_getkey(
190 portage.best(portdb.xmatch("match-all", prov_cp)))
191 if prov_cp == prov_pkg:
192 stats["virtual.exists"]+=1
193 @@ -1584,12 +1595,12 @@
194 if mytype == "DEPEND" and \
195 not is_blocker and \
196 not inherited_java_eclass and \
197 - portage.dep_getkey(atom) == "virtual/jdk":
198 + atom.cp == "virtual/jdk":
199 stats['java.eclassesnotused'] += 1
200 fails['java.eclassesnotused'].append(relative_path)
201 elif mytype in ("PDEPEND", "RDEPEND"):
202 if not is_blocker and \
203 - portage.dep_getkey(atom) in suspect_rdepend:
204 + atom.cp in suspect_rdepend:
205 stats[mytype + '.suspect'] += 1
206 fails[mytype + '.suspect'].append(
207 relative_path + ": '%s'" % atom)
208 @@ -1781,8 +1792,7 @@
209 # just in case, prevent config.reset() from nuking these.
210 dep_settings.backup_changes("ACCEPT_KEYWORDS")
211
212 - for myprovide in myaux["PROVIDE"].split():
213 - prov_cp = portage.dep_getkey(myprovide)
214 + for prov_cp in provide_cps:
215 if prov_cp not in dep_settings.getvirtuals():
216 stats["virtual.unavailable"]+=1
217 fails["virtual.unavailable"].append("%s: %s(%s) %s" % \
218
219 Modified: main/branches/prefix/pym/_emerge/create_world_atom.py
220 ===================================================================
221 --- main/branches/prefix/pym/_emerge/create_world_atom.py 2010-02-10 18:46:43 UTC (rev 15334)
222 +++ main/branches/prefix/pym/_emerge/create_world_atom.py 2010-02-10 18:49:31 UTC (rev 15335)
223 @@ -15,7 +15,7 @@
224 arg_atom = args_set.findAtomForPackage(pkg)
225 if not arg_atom:
226 return None
227 - cp = portage.dep_getkey(arg_atom)
228 + cp = arg_atom.cp
229 new_world_atom = cp
230 sets = root_config.sets
231 portdb = root_config.trees["porttree"].dbapi
232 @@ -76,15 +76,14 @@
233 # can't be safely excluded from world if they are slotted.
234 system_atom = sets["system"].findAtomForPackage(pkg)
235 if system_atom:
236 - if not portage.dep_getkey(system_atom).startswith("virtual/"):
237 + if not system_atom.cp.startswith("virtual/"):
238 return None
239 # System virtuals aren't safe to exclude from world since they can
240 # match multiple old-style virtuals but only one of them will be
241 # pulled in by update or depclean.
242 - providers = portdb.settings.getvirtuals().get(
243 - portage.dep_getkey(system_atom))
244 + providers = portdb.settings.getvirtuals().get(system_atom.cp)
245 if providers and len(providers) == 1 and \
246 - portage.dep_getkey(providers[0]) == cp:
247 + providers[0].cp == arg_atom.cp:
248 return None
249 return new_world_atom
250
251
252 Modified: main/branches/prefix/pym/_emerge/emergelog.py
253 ===================================================================
254 --- main/branches/prefix/pym/_emerge/emergelog.py 2010-02-10 18:46:43 UTC (rev 15334)
255 +++ main/branches/prefix/pym/_emerge/emergelog.py 2010-02-10 18:49:31 UTC (rev 15335)
256 @@ -16,9 +16,13 @@
257 from portage.const import EPREFIX
258
259 _emerge_log_dir = EPREFIX + '/var/log'
260 +_disable = False
261
262 def emergelog(xterm_titles, mystr, short_msg=None):
263
264 + if _disable:
265 + return
266 +
267 mystr = portage._unicode_decode(mystr)
268
269 if short_msg is not None:
270
271 Modified: main/branches/prefix/pym/_emerge/main.py
272 ===================================================================
273 --- main/branches/prefix/pym/_emerge/main.py 2010-02-10 18:46:43 UTC (rev 15334)
274 +++ main/branches/prefix/pym/_emerge/main.py 2010-02-10 18:49:31 UTC (rev 15335)
275 @@ -41,6 +41,7 @@
276 action_regen, action_search, action_uninstall, action_info, action_build, \
277 adjust_configs, chk_updated_cfg_files, display_missing_pkg_set, \
278 display_news_notification, getportageversion, load_emerge_config
279 +import _emerge
280 from _emerge.emergelog import emergelog
281 from _emerge._flush_elog_mod_echo import _flush_elog_mod_echo
282 from _emerge.is_valid_package_atom import is_valid_package_atom
283 @@ -1396,9 +1397,7 @@
284 operations. This helps minimize parallel emerge.log entries that can
285 confuse log parsers. We especially want it disabled during
286 parallel-fetch, which uses --resume --fetchonly."""
287 - global emergelog
288 - def emergelog(*pargs, **kargs):
289 - pass
290 + _emerge.emergelog._disable = True
291
292 else:
293 if 'EMERGE_LOG_DIR' in settings:
294
295 Modified: main/branches/prefix/pym/portage/__init__.py
296 ===================================================================
297 --- main/branches/prefix/pym/portage/__init__.py 2010-02-10 18:46:43 UTC (rev 15334)
298 +++ main/branches/prefix/pym/portage/__init__.py 2010-02-10 18:49:31 UTC (rev 15335)
299 @@ -1488,7 +1488,7 @@
300
301 # misc variables inherited from the calling environment
302 _environ_filter += [
303 - "INFOPATH", "MANPATH",
304 + "INFOPATH", "MANPATH", "USER",
305 "HOST", "GROUP", "LOGNAME", "MAIL", "REMOTEHOST",
306 "SECURITYSESSIONID",
307 "TERMINFO", "TERM_PROGRAM", "TERM_PROGRAM_VERSION",
308 @@ -8593,10 +8593,9 @@
309 if mycp in settings.pmaskdict:
310 for x in settings.pmaskdict[mycp]:
311 if match_from_list(x, cpv_slot_list):
312 - comment = ""
313 - l = "\n"
314 - comment_valid = -1
315 for pmask in pmasklists:
316 + comment = ""
317 + comment_valid = -1
318 pmask_filename = os.path.join(pmask[0], "package.mask")
319 for i in range(len(pmask[1])):
320 l = pmask[1][i].strip()
321
322 Modified: main/branches/prefix/pym/portage/dbapi/bintree.py
323 ===================================================================
324 --- main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-10 18:46:43 UTC (rev 15334)
325 +++ main/branches/prefix/pym/portage/dbapi/bintree.py 2010-02-10 18:49:31 UTC (rev 15335)
326 @@ -841,6 +841,17 @@
327 remote_metadata = self.remotepkgs[mypkg]
328 for k, v in remote_metadata.items():
329 remote_metadata[k] = v.strip()
330 +
331 + # Eliminate metadata values with names that digestCheck
332 + # uses, since they are not valid when using the old
333 + # protocol. Typically this is needed for SIZE metadata
334 + # which corresponds to the size of the unpacked files
335 + # rather than the binpkg file size, triggering digest
336 + # verification failures as reported in bug #303211.
337 + remote_metadata.pop('SIZE', None)
338 + for k in portage.checksum.hashfunc_map:
339 + remote_metadata.pop(k, None)
340 +
341 self._remotepkgs[fullpkg] = remote_metadata
342 #print " -- Injected"
343 except SystemExit as e:
344
345 Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
346 ===================================================================
347 --- main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-10 18:46:43 UTC (rev 15334)
348 +++ main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-10 18:49:31 UTC (rev 15335)
349 @@ -452,6 +452,18 @@
350 return self.treemap[repository_id]
351 return None
352
353 + def getRepositoryName(self, canonical_repo_path):
354 + """
355 + This is the inverse of getRepositoryPath().
356 + @param canonical_repo_path: the canonical path of a repository, as
357 + resolved by os.path.realpath()
358 + @type canonical_repo_path: String
359 + @returns: The repo_name for the corresponding repository, or None
360 + if the path does not correspond a known repository
361 + @rtype: String or None
362 + """
363 + return self._repository_map.get(canonical_repo_path)
364 +
365 def getRepositories(self):
366 """
367 This function is required for GLEP 42 compliance; it will return a list of
368 @@ -889,10 +901,12 @@
369 else:
370 return 0
371
372 - def cp_all(self):
373 + def cp_all(self, categories=None):
374 "returns a list of all keys in our tree"
375 d = {}
376 - for x in self.settings.categories:
377 + if categories is None:
378 + categories = self.settings.categories
379 + for x in categories:
380 for oroot in self.porttrees:
381 for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
382 if not self._pkg_dir_name_re.match(y) or \
383
384 Modified: main/branches/prefix/pym/portage/glsa.py
385 ===================================================================
386 --- main/branches/prefix/pym/portage/glsa.py 2010-02-10 18:46:43 UTC (rev 15334)
387 +++ main/branches/prefix/pym/portage/glsa.py 2010-02-10 18:49:31 UTC (rev 15335)
388 @@ -11,6 +11,7 @@
389 import re
390 import xml.dom.minidom
391
392 +import portage
393 from portage import os
394 from portage import _encodings
395 from portage import _unicode_decode
396 @@ -551,6 +552,13 @@
397 self.packages = {}
398 for p in self.affected.getElementsByTagName("package"):
399 name = p.getAttribute("name")
400 + try:
401 + name = portage.dep.Atom(name)
402 + except portage.exception.InvalidAtom:
403 + raise GlsaFormatException(_("invalid package name: %s") % name)
404 + if name != name.cp:
405 + raise GlsaFormatException(_("invalid package name: %s") % name)
406 + name = name.cp
407 if name not in self.packages:
408 self.packages[name] = []
409 tmp = {}