Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15432 - in main/branches/prefix: . pym/_emerge pym/portage pym/portage/cache pym/portage/dbapi
Date: Mon, 22 Feb 2010 13:01:21
Message-Id: E1NjXuU-0002FK-8w@stork.gentoo.org
1 Author: grobian
2 Date: 2010-02-22 13:01:13 +0000 (Mon, 22 Feb 2010)
3 New Revision: 15432
4
5 Modified:
6 main/branches/prefix/RELEASE-NOTES
7 main/branches/prefix/pym/_emerge/main.py
8 main/branches/prefix/pym/portage/__init__.py
9 main/branches/prefix/pym/portage/cache/metadata_overlay.py
10 main/branches/prefix/pym/portage/dbapi/porttree.py
11 main/branches/prefix/pym/portage/dep.py
12 main/branches/prefix/pym/portage/versions.py
13 Log:
14 Merged from trunk -r15407:15417
15
16 | 15409 | Add missing newline to the "CONFIG_PROTECT is empty" warning |
17 | zmedico | message. |
18
19 | 15410 | Move portage.cpv_getkey() to the portage.versions module. |
20 | zmedico | |
21
22 | 15411 | Add a note about --rebuilt-binaries. |
23 | zmedico | |
24
25 | 15412 | Handle CacheCorruption from self.db_ro in _setitem, |
26 | zmedico | triggered by INHERITED containing non-existent eclass inside |
27 | | metadata.database._parse_data. Thanks to Vlastimil Babka |
28 | | <caster@g.o> for reporting. |
29
30 | 15413 | Move portage.flatten to portage.dep.flatten. |
31 | zmedico | |
32
33 | 15414 | Show a deprecation warning when digestParseFile() is called. |
34 | zmedico | |
35
36 | 15415 | Show a deprecation warning when pkgmerge() is called. |
37 | zmedico | |
38
39 | 15416 | Show a deprecation warning when getvirtuals() is called. |
40 | zmedico | |
41
42 | 15417 | Move the portage.FetchlistDict class to the |
43 | zmedico | portage.dbapi.porttree module. |
44
45
46 Modified: main/branches/prefix/RELEASE-NOTES
47 ===================================================================
48 --- main/branches/prefix/RELEASE-NOTES 2010-02-22 12:58:01 UTC (rev 15431)
49 +++ main/branches/prefix/RELEASE-NOTES 2010-02-22 13:01:13 UTC (rev 15432)
50 @@ -21,6 +21,10 @@
51 * "world" now includes separate "selected" and "system" sets, where the
52 "selected" set includes packages listed in /var/lib/portage/world and nested
53 sets that may be listed /var/lib/portage/world_sets.
54 +* The new --rebuilt-binaries option will replace installed packages with binary
55 + packages that have been rebuilt. Rebuilds are detected by comparison of
56 + BUILD_TIME package metadata. This option is enabled automatically when using
57 + binary packages (--usepkg or --getbinpkg) together with --update and --deep.
58
59 portage-2.1.7
60 ==================================
61
62 Modified: main/branches/prefix/pym/_emerge/main.py
63 ===================================================================
64 --- main/branches/prefix/pym/_emerge/main.py 2010-02-22 12:58:01 UTC (rev 15431)
65 +++ main/branches/prefix/pym/_emerge/main.py 2010-02-22 13:01:13 UTC (rev 15432)
66 @@ -1125,6 +1125,7 @@
67 msg = "!!! CONFIG_PROTECT is empty"
68 if root != "/":
69 msg += " for '%s'" % root
70 + msg += "\n"
71 writemsg_level(msg, level=logging.WARN, noiselevel=-1)
72
73 def profile_check(trees, myaction):
74
75 Modified: main/branches/prefix/pym/portage/__init__.py
76 ===================================================================
77 --- main/branches/prefix/pym/portage/__init__.py 2010-02-22 12:58:01 UTC (rev 15431)
78 +++ main/branches/prefix/pym/portage/__init__.py 2010-02-22 13:01:13 UTC (rev 15432)
79 @@ -85,7 +85,7 @@
80 'uid,userland,userpriv_groups,wheelgid',
81 'portage.dep',
82 'portage.dep:best_match_to_list,dep_getcpv,dep_getkey,' + \
83 - 'get_operator,isjustname,isspecific,isvalidatom,' + \
84 + 'flatten,get_operator,isjustname,isspecific,isvalidatom,' + \
85 'match_from_list,match_to_list',
86 'portage.eclass_cache',
87 'portage.env.loaders',
88 @@ -110,7 +110,8 @@
89 'stack_lists,unique_array,varexpand,writedict,writemsg,' + \
90 'writemsg_stdout,write_atomic',
91 'portage.versions',
92 - 'portage.versions:best,catpkgsplit,catsplit,endversion_keys,' + \
93 + 'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,' + \
94 + 'cpv_getkey@getCPFromCPV,endversion_keys,' + \
95 'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
96 'portage.xpak',
97 )
98 @@ -673,17 +674,6 @@
99
100 return rlist
101
102 -def flatten(mytokens):
103 - """this function now turns a [1,[2,3]] list into
104 - a [1,2,3] list and returns it."""
105 - newlist=[]
106 - for x in mytokens:
107 - if isinstance(x, list):
108 - newlist.extend(flatten(x))
109 - else:
110 - newlist.append(x)
111 - return newlist
112 -
113 #beautiful directed graph object
114
115 class digraph(object):
116 @@ -3552,6 +3542,12 @@
117 self.already_in_regenerate = 0
118
119 def get_virts_p(self, myroot=None):
120 +
121 + if myroot is not None:
122 + warnings.warn("The 'myroot' parameter for " + \
123 + "portage.config.get_virts_p() is deprecated",
124 + DeprecationWarning, stacklevel=2)
125 +
126 if self.virts_p:
127 return self.virts_p
128 virts = self.getvirtuals()
129 @@ -3565,6 +3561,12 @@
130 def getvirtuals(self, myroot=None):
131 """myroot is now ignored because, due to caching, it has always been
132 broken for all but the first call."""
133 +
134 + if myroot is not None:
135 + warnings.warn("The 'myroot' parameter for " + \
136 + "portage.config.getvirtuals() is deprecated",
137 + DeprecationWarning, stacklevel=2)
138 +
139 myroot = self["ROOT"]
140 if self.virtuals:
141 return self.virtuals
142 @@ -5495,6 +5497,9 @@
143 DEPRECATED: this function is now only a compability wrapper for
144 portage.manifest.Manifest()."""
145
146 + warnings.warn("portage.digestParseFile() is deprecated",
147 + DeprecationWarning, stacklevel=2)
148 +
149 mysplit = myfilename.split(os.sep)
150 if mysplit[-2] == "files" and mysplit[-1].startswith("digest-"):
151 pkgdir = os.sep + os.sep.join(mysplit[:-2]).strip(os.sep)
152 @@ -8471,27 +8476,6 @@
153 return None
154 return deplist
155
156 -def cpv_getkey(mycpv):
157 - """Calls pkgsplit on a cpv and returns only the cp."""
158 - mysplit = versions.catpkgsplit(mycpv)
159 - if mysplit is not None:
160 - return mysplit[0] + '/' + mysplit[1]
161 -
162 - warnings.warn("portage.cpv_getkey() called with invalid cpv: '%s'" \
163 - % (mycpv,), DeprecationWarning, stacklevel=2)
164 -
165 - myslash = mycpv.split("/", 1)
166 - mysplit = versions._pkgsplit(myslash[-1])
167 - if mysplit is None:
168 - return None
169 - mylen=len(myslash)
170 - if mylen==2:
171 - return myslash[0]+"/"+mysplit[0]
172 - else:
173 - return mysplit[0]
174 -
175 -getCPFromCPV = cpv_getkey
176 -
177 def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
178 """Given a string (packagename or virtual) expand it into a valid
179 cat/package string. Virtuals use the mydb to determine which provided
180 @@ -8501,8 +8485,8 @@
181 mysplit = versions._pkgsplit(myslash[-1])
182 if settings is None:
183 settings = globals()["settings"]
184 - virts = settings.getvirtuals("/")
185 - virts_p = settings.get_virts_p("/")
186 + virts = settings.getvirtuals()
187 + virts_p = settings.get_virts_p()
188 if len(myslash)>2:
189 # this is illegal case.
190 mysplit=[]
191 @@ -8803,49 +8787,18 @@
192 from portage.dbapi.virtual import fakedbapi
193 from portage.dbapi.bintree import bindbapi, binarytree
194 from portage.dbapi.vartree import vardbapi, vartree, dblink
195 -from portage.dbapi.porttree import close_portdbapi_caches, portdbapi, portagetree
196 +from portage.dbapi.porttree import FetchlistDict, \
197 + close_portdbapi_caches, portagetree, portdbapi
198
199 -class FetchlistDict(portage.cache.mappings.Mapping):
200 - """This provide a mapping interface to retrieve fetch lists. It's used
201 - to allow portage.manifest.Manifest to access fetch lists via a standard
202 - mapping interface rather than use the dbapi directly."""
203 - def __init__(self, pkgdir, settings, mydbapi):
204 - """pkgdir is a directory containing ebuilds and settings is passed into
205 - portdbapi.getfetchlist for __getitem__ calls."""
206 - self.pkgdir = pkgdir
207 - self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
208 - self.settings = settings
209 - self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
210 - self.portdb = mydbapi
211 - def __getitem__(self, pkg_key):
212 - """Returns the complete fetch list for a given package."""
213 - return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
214 - def __contains__(self, cpv):
215 - return cpv in self.__iter__()
216 - def has_key(self, pkg_key):
217 - """Returns true if the given package exists within pkgdir."""
218 - return pkg_key in self
219 -
220 - def __iter__(self):
221 - return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
222 -
223 - def __len__(self):
224 - """This needs to be implemented in order to avoid
225 - infinite recursion in some cases."""
226 - return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
227 -
228 - def keys(self):
229 - """Returns keys for all packages within pkgdir"""
230 - return self.portdb.cp_list(self.cp, mytree=self.mytree)
231 -
232 - if sys.hexversion >= 0x3000000:
233 - keys = __iter__
234 -
235 def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None,
236 vartree=None, prev_mtimes=None, blockers=None):
237 """will merge a .tbz2 file, returning a list of runtime dependencies
238 that must be satisfied, or None if there was a merge error. This
239 code assumes the package exists."""
240 +
241 + warnings.warn("portage.pkgmerge() is deprecated",
242 + DeprecationWarning, stacklevel=2)
243 +
244 global db
245 if mydbapi is None:
246 mydbapi = db[myroot]["bintree"].dbapi
247 @@ -9025,9 +8978,14 @@
248
249 # gets virtual package settings
250 def getvirtuals(myroot):
251 + """
252 + Calls portage.settings.getvirtuals().
253 + @deprecated: Use portage.settings.getvirtuals().
254 + """
255 global settings
256 - writemsg("--- DEPRECATED call to getvirtual\n")
257 - return settings.getvirtuals(myroot)
258 + warnings.warn("portage.getvirtuals() is deprecated",
259 + DeprecationWarning, stacklevel=2)
260 + return settings.getvirtuals()
261
262 def commit_mtimedb(mydict=None, filename=None):
263 if mydict is None:
264
265 Modified: main/branches/prefix/pym/portage/cache/metadata_overlay.py
266 ===================================================================
267 --- main/branches/prefix/pym/portage/cache/metadata_overlay.py 2010-02-22 12:58:01 UTC (rev 15431)
268 +++ main/branches/prefix/pym/portage/cache/metadata_overlay.py 2010-02-22 13:01:13 UTC (rev 15432)
269 @@ -48,7 +48,10 @@
270 return value
271
272 def _setitem(self, name, values):
273 - value_ro = self.db_ro.get(name, None)
274 + try:
275 + value_ro = self.db_ro.get(name)
276 + except CacheCorruption:
277 + value_ro = None
278 if value_ro is not None and \
279 self._are_values_identical(value_ro, values):
280 # we have matching values in the underlying db_ro
281
282 Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
283 ===================================================================
284 --- main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-22 12:58:01 UTC (rev 15431)
285 +++ main/branches/prefix/pym/portage/dbapi/porttree.py 2010-02-22 13:01:13 UTC (rev 15432)
286 @@ -4,7 +4,9 @@
287
288 from __future__ import print_function
289
290 -__all__ = ["portdbapi", "close_portdbapi_caches", "portagetree"]
291 +__all__ = [
292 + "close_portdbapi_caches", "FetchlistDict", "portagetree", "portdbapi"
293 +]
294
295 import portage
296 portage.proxy.lazyimport.lazyimport(globals(),
297 @@ -1240,3 +1242,44 @@
298 except Exception as e:
299 pass
300 return myslot
301 +
302 +class FetchlistDict(portage.cache.mappings.Mapping):
303 + """
304 + This provide a mapping interface to retrieve fetch lists. It's used
305 + to allow portage.manifest.Manifest to access fetch lists via a standard
306 + mapping interface rather than use the dbapi directly.
307 + """
308 + def __init__(self, pkgdir, settings, mydbapi):
309 + """pkgdir is a directory containing ebuilds and settings is passed into
310 + portdbapi.getfetchlist for __getitem__ calls."""
311 + self.pkgdir = pkgdir
312 + self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
313 + self.settings = settings
314 + self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
315 + self.portdb = mydbapi
316 +
317 + def __getitem__(self, pkg_key):
318 + """Returns the complete fetch list for a given package."""
319 + return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
320 +
321 + def __contains__(self, cpv):
322 + return cpv in self.__iter__()
323 +
324 + def has_key(self, pkg_key):
325 + """Returns true if the given package exists within pkgdir."""
326 + return pkg_key in self
327 +
328 + def __iter__(self):
329 + return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
330 +
331 + def __len__(self):
332 + """This needs to be implemented in order to avoid
333 + infinite recursion in some cases."""
334 + return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
335 +
336 + def keys(self):
337 + """Returns keys for all packages within pkgdir"""
338 + return self.portdb.cp_list(self.cp, mytree=self.mytree)
339 +
340 + if sys.hexversion >= 0x3000000:
341 + keys = __iter__
342
343 Modified: main/branches/prefix/pym/portage/dep.py
344 ===================================================================
345 --- main/branches/prefix/pym/portage/dep.py 2010-02-22 12:58:01 UTC (rev 15431)
346 +++ main/branches/prefix/pym/portage/dep.py 2010-02-22 13:01:13 UTC (rev 15432)
347 @@ -3,6 +3,16 @@
348 # Distributed under the terms of the GNU General Public License v2
349 # $Id$
350
351 +__all__ = [
352 + 'Atom', 'best_match_to_list', 'cpvequal',
353 + 'dep_getcpv', 'dep_getkey', 'dep_getslot',
354 + 'dep_getusedeps', 'dep_opconvert', 'flatten',
355 + 'get_operator', 'isjustname', 'isspecific',
356 + 'isvalidatom', 'match_from_list', 'match_to_list',
357 + 'paren_enclose', 'paren_normalize', 'paren_reduce',
358 + 'remove_slot', 'strip_empty', 'use_reduce'
359 +]
360 +
361 # DEPEND SYNTAX:
362 #
363 # 'use?' only affects the immediately following word!
364 @@ -343,6 +353,28 @@
365 x += 1
366 return retlist
367
368 +def flatten(mylist):
369 + """
370 + Recursively traverse nested lists and return a single list containing
371 + all non-list elements that are found.
372 +
373 + Example usage:
374 + >>> flatten([1, [2, 3, [4]]])
375 + [1, 2, 3, 4]
376 +
377 + @param mylist: A list containing nested lists and non-list elements.
378 + @type mylist: List
379 + @rtype: List
380 + @return: A single list containing only non-list elements.
381 + """
382 + newlist = []
383 + for x in mylist:
384 + if isinstance(x, list):
385 + newlist.extend(flatten(x))
386 + else:
387 + newlist.append(x)
388 + return newlist
389 +
390 class _use_dep(object):
391
392 __slots__ = ("__weakref__", "conditional",
393
394 Modified: main/branches/prefix/pym/portage/versions.py
395 ===================================================================
396 --- main/branches/prefix/pym/portage/versions.py 2010-02-22 12:58:01 UTC (rev 15431)
397 +++ main/branches/prefix/pym/portage/versions.py 2010-02-22 13:01:13 UTC (rev 15432)
398 @@ -3,7 +3,14 @@
399 # Distributed under the terms of the GNU General Public License v2
400 # $Id$
401
402 +__all__ = [
403 + 'best', 'catpkgsplit', 'catsplit',
404 + 'cpv_getkey', 'pkgcmp', 'pkgsplit',
405 + 'ververify', 'vercmp'
406 +]
407 +
408 import re
409 +import warnings
410
411
412 # \w is [a-zA-Z0-9_]
413 @@ -334,6 +341,26 @@
414 else:
415 return (cat + '/' + pn, ver, rev)
416
417 +def cpv_getkey(mycpv):
418 + """Calls catpkgsplit on a cpv and returns only the cp."""
419 + mysplit = catpkgsplit(mycpv)
420 + if mysplit is not None:
421 + return mysplit[0] + '/' + mysplit[1]
422 +
423 + warnings.warn("portage.versions.cpv_getkey() " + \
424 + "called with invalid cpv: '%s'" % (mycpv,),
425 + DeprecationWarning, stacklevel=2)
426 +
427 + myslash = mycpv.split("/", 1)
428 + mysplit = _pkgsplit(myslash[-1])
429 + if mysplit is None:
430 + return None
431 + mylen = len(myslash)
432 + if mylen == 2:
433 + return myslash[0] + "/" + mysplit[0]
434 + else:
435 + return mysplit[0]
436 +
437 def catsplit(mydep):
438 return mydep.split("/", 1)