depgraph: fix distorted display of virtuals
authorZac Medico <zmedico@gentoo.org>
Sat, 12 Feb 2011 00:09:22 +0000 (16:09 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 14 Feb 2011 04:25:08 +0000 (20:25 -0800)
As mentioned in bug #353933, comment #4, special new-style virtual
atoms generated/distorted by _expand_new_virtuals() can prevent
extract_affecting_use() from working properly. This is fixed by
saving the original atoms so that the depgraph can map them back
into place at the appropriate step in dependency evaluation.

pym/_emerge/depgraph.py
pym/portage/dep/dep_check.py

index 004103c0dd2bced0c31753bae495174799ee68c6..fc84be6fe67f52b792804cd02f4f06158e9753bf 100644 (file)
@@ -1259,6 +1259,12 @@ class depgraph(object):
                for atom, child in self._minimize_children(
                        pkg, dep_priority, root_config, selected_atoms[pkg]):
 
+                       # If this was a specially generated virtual atom
+                       # from dep_check, map it back to the original, in
+                       # order to avoid distortion in places like display
+                       # or conflict resolution code.
+                       atom = getattr(atom, '_orig_atom', atom)
+
                        if ignore_blockers and atom.blocker:
                                # For --with-bdeps, ignore build-time only blockers
                                # that originate from built packages.
@@ -1309,6 +1315,13 @@ class depgraph(object):
 
                        for atom, child in self._minimize_children(
                                pkg, self._priority(runtime=True), root_config, atoms):
+
+                               # If this was a specially generated virtual atom
+                               # from dep_check, map it back to the original, in
+                               # order to avoid distortion in places like display
+                               # or conflict resolution code.
+                               atom = getattr(atom, '_orig_atom', atom)
+
                                # This is a GLEP 37 virtual, so its deps are all runtime.
                                mypriority = self._priority(runtime=True)
                                if not atom.blocker:
index 6d2d99d354e6b2104933553644211ca90903727a..ed85be61840bf75d2223abc745ad728971799e0d 100644 (file)
@@ -135,6 +135,12 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                                                pkg_use_enabled(parent))
                        else:
                                virt_atom = Atom(virt_atom)
+
+                       # Allow the depgraph to map this atom back to the
+                       # original, in order to avoid distortion in places
+                       # like display or conflict resolution code.
+                       virt_atom.__dict__['_orig_atom'] = x
+
                        # According to GLEP 37, RDEPEND is the only dependency
                        # type that is valid for new-style virtuals. Repoman
                        # should enforce this.