Merged from trunk -r14306:14313
authorFabian Groffen <grobian@gentoo.org>
Mon, 21 Sep 2009 17:43:04 +0000 (17:43 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 21 Sep 2009 17:43:04 +0000 (17:43 -0000)
   | 14307   | Fix typos in http.client imports.                            |
   | zmedico |                                                              |

   | 14308   | Remove virtuals from the cache because they're unused since  |
   | zmedico | portage-2.1.6 and it won't hurt older portage.               |

   | 14309   | Fix redundant Atom construtor call in                        |
   | zmedico | _show_unsatisfied_dep().                                     |

   | 14310   | Tread blockers as invalid.                                   |
   | zmedico |                                                              |

   | 14311   | Fix AtomArg constructor calls to pass in Atom instances, so  |
   | zmedico | the constructor never has to construct one.                  |

   | 14312   | When generating config.prevmaskdict, only call the Atom      |
   | zmedico | constructor when necessary.                                  |

   | 14313   | Make Atom.__init__ call the base class constructor, though   |
   | zmedico | it doesn't seem to matter.                                   |

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

pym/_emerge/AtomArg.py
pym/_emerge/BlockerCache.py
pym/_emerge/depgraph.py
pym/_emerge/is_valid_package_atom.py
pym/portage/__init__.py
pym/portage/dep.py
pym/portage/getbinpkg.py

index 6178be2665eaf7ae9ff617ce49e4a860f08ac8dd..71cc22273a7aabda9a50768d0ceb119a2e162634 100644 (file)
@@ -17,7 +17,4 @@ class AtomArg(DependencyArg):
        def __init__(self, atom=None, **kwargs):
                DependencyArg.__init__(self, **kwargs)
                self.atom = atom
-               if not isinstance(self.atom, portage.dep.Atom):
-                       self.atom = portage.dep.Atom(self.atom)
                self.set = (self.atom, )
-
index 7b0db0ecef9189e47300f4d11dcaf289eeb2dc8a..9962ffdd578f67d06c9e0a56d3896c9aeef8e019 100644 (file)
@@ -18,7 +18,6 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
        emerge.  The cache is invalidated whenever it is detected that something
        has changed that might alter the results of dep_check() calls:
                1) the set of installed packages (including COUNTER) has changed
-               2) the old-style virtuals have changed
        """
 
        # Number of uncached packages to trigger cache update, since
@@ -35,7 +34,6 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
 
        def __init__(self, myroot, vardb):
                self._vardb = vardb
-               self._virtuals = vardb.settings.getvirtuals()
                self._cache_filename = os.path.join(myroot,
                        portage.CACHE_PATH, "vdb_blockers.pickle")
                self._cache_version = "1"
@@ -113,7 +111,6 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
                if not cache_valid:
                        self._cache_data = {"version":self._cache_version}
                        self._cache_data["blockers"] = {}
-                       self._cache_data["virtuals"] = self._virtuals
                self._modified.clear()
 
        def flush(self):
@@ -129,7 +126,6 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
                {
                        version : "1",
                        "blockers" : {cpv1:(counter,(atom1, atom2...)), cpv2...},
-                       "virtuals" : vardb.settings.getvirtuals()
                }
                """
                if len(self._modified) >= self._cache_threshold and \
index ab342929ecfbebd24b754ae76083c38ab1ee53a2..a527b071d838c136abf69487ee0dba019232d411 100644 (file)
@@ -1278,8 +1278,8 @@ class depgraph(object):
 
                deps = []
                for cat in categories:
-                       deps.append(insert_category_into_atom(
-                               atom_without_category, cat))
+                       deps.append(Atom(insert_category_into_atom(
+                               atom_without_category, cat)))
                return deps
 
        def _have_new_virt(self, root, atom_cp):
@@ -1441,15 +1441,14 @@ class depgraph(object):
                                #   2) It takes away freedom from the resolver to choose other
                                #      possible expansions when necessary.
                                if "/" in x:
-                                       args.append(AtomArg(arg=x, atom=x,
+                                       args.append(AtomArg(arg=x, atom=Atom(x),
                                                root_config=root_config))
                                        continue
                                expanded_atoms = self._dep_expand(root_config, x)
                                installed_cp_set = set()
                                for atom in expanded_atoms:
-                                       atom_cp = portage.dep_getkey(atom)
-                                       if vardb.cp_list(atom_cp):
-                                               installed_cp_set.add(atom_cp)
+                                       if vardb.cp_list(atom.cp):
+                                               installed_cp_set.add(atom.cp)
 
                                if len(installed_cp_set) > 1:
                                        non_virtual_cps = set()
@@ -1462,7 +1461,7 @@ class depgraph(object):
                                if len(expanded_atoms) > 1 and len(installed_cp_set) == 1:
                                        installed_cp = iter(installed_cp_set).next()
                                        expanded_atoms = [atom for atom in expanded_atoms \
-                                               if portage.dep_getkey(atom) == installed_cp]
+                                               if atom.cp == installed_cp]
 
                                if len(expanded_atoms) > 1:
                                        print()
@@ -1473,15 +1472,14 @@ class depgraph(object):
                                if expanded_atoms:
                                        atom = expanded_atoms[0]
                                else:
-                                       null_atom = insert_category_into_atom(x, "null")
-                                       null_cp = portage.dep_getkey(null_atom)
-                                       cat, atom_pn = portage.catsplit(null_cp)
+                                       null_atom = Atom(insert_category_into_atom(x, "null"))
+                                       cat, atom_pn = portage.catsplit(null_atom.cp)
                                        virts_p = root_config.settings.get_virts_p().get(atom_pn)
                                        if virts_p:
                                                # Allow the depgraph to choose which virtual.
-                                               atom = insert_category_into_atom(x, "virtual")
+                                               atom = Atom(null_atom.replace('null/', 'virtual/', 1))
                                        else:
-                                               atom = insert_category_into_atom(x, "null")
+                                               null_atom
 
                                args.append(AtomArg(arg=x, atom=atom,
                                        root_config=root_config))
@@ -1514,9 +1512,9 @@ class depgraph(object):
                                if not slot:
                                        # portage now masks packages with missing slot, but it's
                                        # possible that one was installed by an older version
-                                       atom = portage.cpv_getkey(cpv)
+                                       atom = Atom(portage.cpv_getkey(cpv))
                                else:
-                                       atom = "%s:%s" % (portage.cpv_getkey(cpv), slot)
+                                       atom = Atom("%s:%s" % (portage.cpv_getkey(cpv), slot))
                                args.append(AtomArg(arg=atom, atom=atom,
                                        root_config=root_config))
 
@@ -1911,7 +1909,6 @@ class depgraph(object):
                return selected_atoms
 
        def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None):
-               atom = portage.dep.Atom(atom)
                atom_set = InternalPackageSet(initial_atoms=(atom,))
                xinfo = '"%s"' % atom
                if arg:
@@ -4807,7 +4804,9 @@ class depgraph(object):
                                args.append(SetArg(arg=x, set=expanded_set,
                                        root_config=root_config))
                        else:
-                               if not portage.isvalidatom(x):
+                               try:
+                                       x = Atom(x)
+                               except portage.exception.InvalidAtom:
                                        continue
                                args.append(AtomArg(arg=x, atom=x,
                                        root_config=root_config))
@@ -4977,15 +4976,14 @@ class _dep_check_composite_db(portage.dbapi):
                if expanded_atoms:
                        atom = expanded_atoms[0]
                else:
-                       null_atom = insert_category_into_atom(atom, "null")
-                       null_cp = portage.dep_getkey(null_atom)
-                       cat, atom_pn = portage.catsplit(null_cp)
+                       null_atom = Atom(insert_category_into_atom(atom, "null"))
+                       cat, atom_pn = portage.catsplit(null_atom.cp)
                        virts_p = root_config.settings.get_virts_p().get(atom_pn)
                        if virts_p:
                                # Allow the resolver to choose which virtual.
-                               atom = insert_category_into_atom(atom, "virtual")
+                               atom = Atom(null_atom.replace('null/', 'virtual/', 1))
                        else:
-                               atom = insert_category_into_atom(atom, "null")
+                               atom = null_atom
                return atom
 
        def aux_get(self, cpv, wants):
index 11920be30115af23e12232ff40ec8a19b2af32b4..6295667a5f9657b569a4268b1b8a067bd556ba7b 100644 (file)
@@ -10,4 +10,4 @@ def is_valid_package_atom(x):
                alphanum = re.search(r'\w', x)
                if alphanum:
                        x = x[:alphanum.start()] + "cat/" + x[alphanum.start():]
-       return portage.isvalidatom(x)
+       return portage.isvalidatom(x, allow_blockers=False)
index 191e5385dc21eb0a0d2567a4b93a9292831fb43b..420cdcd801cfeb2563357f99b018c9ed978e28eb 100644 (file)
@@ -1732,7 +1732,9 @@ class config(object):
                        # revmaskdict
                        self.prevmaskdict={}
                        for x in self.packages:
-                               x = portage.dep.Atom(x.lstrip('*'))
+                               # Negative atoms are filtered by the above stack_lists() call.
+                               if not isinstance(x, dep.Atom):
+                                       x = dep.Atom(x.lstrip('*'))
                                self.prevmaskdict.setdefault(x.cp, []).append(x)
 
                        self._pkeywords_list = []
index 68e6c6b2222981a7b4dcf9e93ce3c9ea3d855836..ebdf1ea839066c361b0a1ede32b2f7d88df5aeae 100644 (file)
@@ -519,6 +519,8 @@ class Atom(_atom_base):
                        raise TypeError(_("Expected %s, got %s") % \
                                (_atom_base, type(s)))
 
+               _atom_base.__init__(s)
+
                if "!" == s[:1]:
                        blocker = self._blocker(forbid_overlap=("!" == s[1:2]))
                        if blocker.overlap.forbid:
index 939ab641c99a9005f1f5d54d8a9dcb7995c4d82c..0ef5f0d52cc000d521a600f6048df7aa49a2173c 100644 (file)
@@ -41,14 +41,14 @@ except ImportError as e:
 try:
        try:
                from http.client import HTTPConnection as http_client_HTTPConnection
-               from http.client import HTTPSConnection as http_client_HTTPConnection
-               from http.client import BadStatusLine as http_client_HTTPConnection
-               from http.client import ResponseNotReady as http_client_HTTPConnection
+               from http.client import HTTPSConnection as http_client_HTTPSConnection
+               from http.client import BadStatusLine as http_client_BadStatusLine
+               from http.client import ResponseNotReady as http_client_ResponseNotReady
        except ImportError:
                from httplib import HTTPConnection as http_client_HTTPConnection
-               from httplib import HTTPSConnection as http_client_HTTPConnection
-               from httplib import BadStatusLine as http_client_HTTPConnection
-               from httplib import ResponseNotReady as http_client_HTTPConnection
+               from httplib import HTTPSConnection as http_client_HTTPSConnection
+               from httplib import BadStatusLine as http_client_BadStatusLine
+               from httplib import ResponseNotReady as http_client_ResponseNotReady
 except ImportError as e:
        sys.stderr.write(colorize("BAD","!!! CANNOT IMPORT HTTP.CLIENT: ")+str(e)+"\n")