Merged from trunk -r15407:15417
authorFabian Groffen <grobian@gentoo.org>
Mon, 22 Feb 2010 13:01:13 +0000 (13:01 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 22 Feb 2010 13:01:13 +0000 (13:01 -0000)
   | 15409   | Add missing newline to the "CONFIG_PROTECT is empty" warning |
   | zmedico | message.                                                     |

   | 15410   | Move portage.cpv_getkey() to the portage.versions module.    |
   | zmedico |                                                              |

   | 15411   | Add a note about --rebuilt-binaries.                         |
   | zmedico |                                                              |

   | 15412   | Handle CacheCorruption from self.db_ro in _setitem,          |
   | zmedico | triggered by INHERITED containing non-existent eclass inside |
   |         | metadata.database._parse_data. Thanks to Vlastimil Babka     |
   |         | <caster@g.o> for reporting.                                  |

   | 15413   | Move portage.flatten to portage.dep.flatten.                 |
   | zmedico |                                                              |

   | 15414   | Show a deprecation warning when digestParseFile() is called. |
   | zmedico |                                                              |

   | 15415   | Show a deprecation warning when pkgmerge() is called.        |
   | zmedico |                                                              |

   | 15416   | Show a deprecation warning when getvirtuals() is called.     |
   | zmedico |                                                              |

   | 15417   | Move the portage.FetchlistDict class to the                  |
   | zmedico | portage.dbapi.porttree module.                               |

svn path=/main/branches/prefix/; revision=15432

RELEASE-NOTES
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/cache/metadata_overlay.py
pym/portage/dbapi/porttree.py
pym/portage/dep.py
pym/portage/versions.py

index b4908beb521ecc07936151a7fa8751df6629c1f7..adff429db20ca5429ed389a0945a9aac3f714407 100644 (file)
@@ -21,6 +21,10 @@ portage-2.2
 * "world" now includes separate "selected" and "system" sets, where the
   "selected" set includes packages listed in /var/lib/portage/world and nested
   sets that may be listed /var/lib/portage/world_sets.
+* The new --rebuilt-binaries option will replace installed packages with binary
+  packages that have been rebuilt. Rebuilds are detected by comparison of
+  BUILD_TIME package metadata. This option is enabled automatically when using
+  binary packages (--usepkg or --getbinpkg) together with --update and --deep.
 
 portage-2.1.7
 ==================================
index 91823d910a8e54560f054a847fd4a1043f3bdcb3..4b146cc964300905fbf421d735dce740a2c9a30e 100644 (file)
@@ -1125,6 +1125,7 @@ def config_protect_check(trees):
                        msg = "!!! CONFIG_PROTECT is empty"
                        if root != "/":
                                msg += " for '%s'" % root
+                       msg += "\n"
                        writemsg_level(msg, level=logging.WARN, noiselevel=-1)
 
 def profile_check(trees, myaction):
index c2c8e142b49c7eaa1e840bd3a09c2709b367b536..98341655986df24734fc39926d8c1ac2ccabf707 100644 (file)
@@ -85,7 +85,7 @@ try:
                        'uid,userland,userpriv_groups,wheelgid',
                'portage.dep',
                'portage.dep:best_match_to_list,dep_getcpv,dep_getkey,' + \
-                       'get_operator,isjustname,isspecific,isvalidatom,' + \
+                       'flatten,get_operator,isjustname,isspecific,isvalidatom,' + \
                        'match_from_list,match_to_list',
                'portage.eclass_cache',
                'portage.env.loaders',
@@ -110,7 +110,8 @@ try:
                        'stack_lists,unique_array,varexpand,writedict,writemsg,' + \
                        'writemsg_stdout,write_atomic',
                'portage.versions',
-               'portage.versions:best,catpkgsplit,catsplit,endversion_keys,' + \
+               'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,' + \
+                       'cpv_getkey@getCPFromCPV,endversion_keys,' + \
                        'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
                'portage.xpak',
        )
@@ -673,17 +674,6 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
 
        return rlist
 
-def flatten(mytokens):
-       """this function now turns a [1,[2,3]] list into
-       a [1,2,3] list and returns it."""
-       newlist=[]
-       for x in mytokens:
-               if isinstance(x, list):
-                       newlist.extend(flatten(x))
-               else:
-                       newlist.append(x)
-       return newlist
-
 #beautiful directed graph object
 
 class digraph(object):
@@ -3552,6 +3542,12 @@ class config(object):
                self.already_in_regenerate = 0
 
        def get_virts_p(self, myroot=None):
+
+               if myroot is not None:
+                       warnings.warn("The 'myroot' parameter for " + \
+                               "portage.config.get_virts_p() is deprecated",
+                               DeprecationWarning, stacklevel=2)
+
                if self.virts_p:
                        return self.virts_p
                virts = self.getvirtuals()
@@ -3565,6 +3561,12 @@ class config(object):
        def getvirtuals(self, myroot=None):
                """myroot is now ignored because, due to caching, it has always been
                broken for all but the first call."""
+
+               if myroot is not None:
+                       warnings.warn("The 'myroot' parameter for " + \
+                               "portage.config.getvirtuals() is deprecated",
+                               DeprecationWarning, stacklevel=2)
+
                myroot = self["ROOT"]
                if self.virtuals:
                        return self.virtuals
@@ -5495,6 +5497,9 @@ def digestParseFile(myfilename, mysettings=None):
        DEPRECATED: this function is now only a compability wrapper for
                    portage.manifest.Manifest()."""
 
+       warnings.warn("portage.digestParseFile() is deprecated",
+               DeprecationWarning, stacklevel=2)
+
        mysplit = myfilename.split(os.sep)
        if mysplit[-2] == "files" and mysplit[-1].startswith("digest-"):
                pkgdir = os.sep + os.sep.join(mysplit[:-2]).strip(os.sep)
@@ -8471,27 +8476,6 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
                                        return None
        return deplist
 
-def cpv_getkey(mycpv):
-       """Calls pkgsplit on a cpv and returns only the cp."""
-       mysplit = versions.catpkgsplit(mycpv)
-       if mysplit is not None:
-               return mysplit[0] + '/' + mysplit[1]
-
-       warnings.warn("portage.cpv_getkey() called with invalid cpv: '%s'" \
-               % (mycpv,), DeprecationWarning, stacklevel=2)
-
-       myslash = mycpv.split("/", 1)
-       mysplit = versions._pkgsplit(myslash[-1])
-       if mysplit is None:
-               return None
-       mylen=len(myslash)
-       if mylen==2:
-               return myslash[0]+"/"+mysplit[0]
-       else:
-               return mysplit[0]
-
-getCPFromCPV = cpv_getkey
-
 def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
        """Given a string (packagename or virtual) expand it into a valid
        cat/package string. Virtuals use the mydb to determine which provided
@@ -8501,8 +8485,8 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
        mysplit = versions._pkgsplit(myslash[-1])
        if settings is None:
                settings = globals()["settings"]
-       virts = settings.getvirtuals("/")
-       virts_p = settings.get_virts_p("/")
+       virts = settings.getvirtuals()
+       virts_p = settings.get_virts_p()
        if len(myslash)>2:
                # this is illegal case.
                mysplit=[]
@@ -8803,49 +8787,18 @@ from portage.dbapi import dbapi
 from portage.dbapi.virtual import fakedbapi
 from portage.dbapi.bintree import bindbapi, binarytree
 from portage.dbapi.vartree import vardbapi, vartree, dblink
-from portage.dbapi.porttree import close_portdbapi_caches, portdbapi, portagetree
-
-class FetchlistDict(portage.cache.mappings.Mapping):
-       """This provide a mapping interface to retrieve fetch lists.  It's used
-       to allow portage.manifest.Manifest to access fetch lists via a standard
-       mapping interface rather than use the dbapi directly."""
-       def __init__(self, pkgdir, settings, mydbapi):
-               """pkgdir is a directory containing ebuilds and settings is passed into
-               portdbapi.getfetchlist for __getitem__ calls."""
-               self.pkgdir = pkgdir
-               self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
-               self.settings = settings
-               self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
-               self.portdb = mydbapi
-       def __getitem__(self, pkg_key):
-               """Returns the complete fetch list for a given package."""
-               return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
-       def __contains__(self, cpv):
-               return cpv in self.__iter__()
-       def has_key(self, pkg_key):
-               """Returns true if the given package exists within pkgdir."""
-               return pkg_key in self
-
-       def __iter__(self):
-               return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
-
-       def __len__(self):
-               """This needs to be implemented in order to avoid
-               infinite recursion in some cases."""
-               return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
-
-       def keys(self):
-               """Returns keys for all packages within pkgdir"""
-               return self.portdb.cp_list(self.cp, mytree=self.mytree)
-
-       if sys.hexversion >= 0x3000000:
-               keys = __iter__
+from portage.dbapi.porttree import FetchlistDict, \
+       close_portdbapi_caches, portagetree, portdbapi
 
 def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None,
        vartree=None, prev_mtimes=None, blockers=None):
        """will merge a .tbz2 file, returning a list of runtime dependencies
                that must be satisfied, or None if there was a merge error.     This
                code assumes the package exists."""
+
+       warnings.warn("portage.pkgmerge() is deprecated",
+               DeprecationWarning, stacklevel=2)
+
        global db
        if mydbapi is None:
                mydbapi = db[myroot]["bintree"].dbapi
@@ -9025,9 +8978,14 @@ def deprecated_profile_check(settings=None):
 
 # gets virtual package settings
 def getvirtuals(myroot):
+       """
+       Calls portage.settings.getvirtuals().
+       @deprecated: Use portage.settings.getvirtuals().
+       """
        global settings
-       writemsg("--- DEPRECATED call to getvirtual\n")
-       return settings.getvirtuals(myroot)
+       warnings.warn("portage.getvirtuals() is deprecated",
+               DeprecationWarning, stacklevel=2)
+       return settings.getvirtuals()
 
 def commit_mtimedb(mydict=None, filename=None):
        if mydict is None:
index 84c5a9741ef5c6bea7009636a734567b827b1d5f..7b4f70a9cae986e9d569969a1a17b871c8d970b4 100644 (file)
@@ -48,7 +48,10 @@ class database(template.database):
                        return value
 
        def _setitem(self, name, values):
-               value_ro = self.db_ro.get(name, None)
+               try:
+                       value_ro = self.db_ro.get(name)
+               except CacheCorruption:
+                       value_ro = None
                if value_ro is not None and \
                        self._are_values_identical(value_ro, values):
                        # we have matching values in the underlying db_ro
index 7cae96796fe7c668c9a919bb143aeabb4bf4ef6b..93f3b411bd6a030b051a65a869b424c4ae427e8c 100644 (file)
@@ -4,7 +4,9 @@
 
 from __future__ import print_function
 
-__all__ = ["portdbapi", "close_portdbapi_caches", "portagetree"]
+__all__ = [
+       "close_portdbapi_caches", "FetchlistDict", "portagetree", "portdbapi"
+]
 
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -1240,3 +1242,44 @@ class portagetree(object):
                except Exception as e:
                        pass
                return myslot
+
+class FetchlistDict(portage.cache.mappings.Mapping):
+       """
+       This provide a mapping interface to retrieve fetch lists. It's used
+       to allow portage.manifest.Manifest to access fetch lists via a standard
+       mapping interface rather than use the dbapi directly.
+       """
+       def __init__(self, pkgdir, settings, mydbapi):
+               """pkgdir is a directory containing ebuilds and settings is passed into
+               portdbapi.getfetchlist for __getitem__ calls."""
+               self.pkgdir = pkgdir
+               self.cp = os.sep.join(pkgdir.split(os.sep)[-2:])
+               self.settings = settings
+               self.mytree = os.path.realpath(os.path.dirname(os.path.dirname(pkgdir)))
+               self.portdb = mydbapi
+
+       def __getitem__(self, pkg_key):
+               """Returns the complete fetch list for a given package."""
+               return list(self.portdb.getFetchMap(pkg_key, mytree=self.mytree))
+
+       def __contains__(self, cpv):
+               return cpv in self.__iter__()
+
+       def has_key(self, pkg_key):
+               """Returns true if the given package exists within pkgdir."""
+               return pkg_key in self
+
+       def __iter__(self):
+               return iter(self.portdb.cp_list(self.cp, mytree=self.mytree))
+
+       def __len__(self):
+               """This needs to be implemented in order to avoid
+               infinite recursion in some cases."""
+               return len(self.portdb.cp_list(self.cp, mytree=self.mytree))
+
+       def keys(self):
+               """Returns keys for all packages within pkgdir"""
+               return self.portdb.cp_list(self.cp, mytree=self.mytree)
+
+       if sys.hexversion >= 0x3000000:
+               keys = __iter__
index e2eeb6d5bf34b6b2386880df95be1e036669a224..282fe749d96aba6b4d1c8230171a7b0e5e5b5232 100644 (file)
@@ -3,6 +3,16 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+__all__ = [
+       'Atom', 'best_match_to_list', 'cpvequal',
+       'dep_getcpv', 'dep_getkey', 'dep_getslot',
+       'dep_getusedeps', 'dep_opconvert', 'flatten',
+       'get_operator', 'isjustname', 'isspecific',
+       'isvalidatom', 'match_from_list', 'match_to_list',
+       'paren_enclose', 'paren_normalize', 'paren_reduce',
+       'remove_slot', 'strip_empty', 'use_reduce'
+]
+
 # DEPEND SYNTAX:
 #
 # 'use?' only affects the immediately following word!
@@ -343,6 +353,28 @@ def dep_opconvert(deplist):
                x += 1
        return retlist
 
+def flatten(mylist):
+       """
+       Recursively traverse nested lists and return a single list containing
+       all non-list elements that are found.
+
+       Example usage:
+               >>> flatten([1, [2, 3, [4]]])
+               [1, 2, 3, 4]
+
+       @param mylist: A list containing nested lists and non-list elements.
+       @type mylist: List
+       @rtype: List
+       @return: A single list containing only non-list elements.
+       """
+       newlist = []
+       for x in mylist:
+               if isinstance(x, list):
+                       newlist.extend(flatten(x))
+               else:
+                       newlist.append(x)
+       return newlist
+
 class _use_dep(object):
 
        __slots__ = ("__weakref__", "conditional",
index 99ec90069259443e4215636a684db6e2193b7392..c070b89246b7969ad19f4883c8b71a6ec73abe0e 100644 (file)
@@ -3,7 +3,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+__all__ = [
+       'best', 'catpkgsplit', 'catsplit',
+       'cpv_getkey', 'pkgcmp',  'pkgsplit',
+       'ververify', 'vercmp'
+]
+
 import re
+import warnings
 
 
 # \w is [a-zA-Z0-9_]
@@ -334,6 +341,26 @@ def pkgsplit(mypkg, silent=1):
        else:
                return (cat + '/' + pn, ver, rev)
 
+def cpv_getkey(mycpv):
+       """Calls catpkgsplit on a cpv and returns only the cp."""
+       mysplit = catpkgsplit(mycpv)
+       if mysplit is not None:
+               return mysplit[0] + '/' + mysplit[1]
+
+       warnings.warn("portage.versions.cpv_getkey() " + \
+               "called with invalid cpv: '%s'" % (mycpv,),
+               DeprecationWarning, stacklevel=2)
+
+       myslash = mycpv.split("/", 1)
+       mysplit = _pkgsplit(myslash[-1])
+       if mysplit is None:
+               return None
+       mylen = len(myslash)
+       if mylen == 2:
+               return myslash[0] + "/" + mysplit[0]
+       else:
+               return mysplit[0]
+
 def catsplit(mydep):
         return mydep.split("/", 1)