diff options
-rw-r--r-- | pym/_emerge/__init__.py | 137 |
1 files changed, 57 insertions, 80 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index acf5e46c1..189396dee 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -5394,41 +5394,11 @@ class depgraph(object): dep_string = portage.dep.paren_enclose(dep_string) - vardb = self.roots[dep_root].trees["vartree"].dbapi - try: - selected_atoms = self._select_atoms(dep_root, - dep_string, myuse=myuse, parent=pkg, strict=strict, - priority=dep_priority) - except portage.exception.InvalidDependString, e: - show_invalid_depstring_notice(jbigkey, dep_string, str(e)) + if not self._add_pkg_dep_string( + pkg, dep_root, dep_priority, dep_string, + allow_unsatisfied): return 0 - if debug: - print "Candidates:", selected_atoms - - for atom in selected_atoms: - try: - - atom = portage.dep.Atom(atom) - - mypriority = dep_priority.copy() - if not atom.blocker and vardb.match(atom): - mypriority.satisfied = True - if not self._add_dep(Dependency(atom=atom, - blocker=atom.blocker, depth=depth, parent=pkg, - priority=mypriority, root=dep_root), - allow_unsatisfied=allow_unsatisfied): - return 0 - - except portage.exception.InvalidAtom, e: - show_invalid_depstring_notice( - pkg, dep_string, str(e)) - del e - if not pkg.installed: - return 0 - - if debug: - print "Exiting...", jbigkey except portage.exception.AmbiguousPackageName, e: pkgs = e.args[0] portage.writemsg("\n\n!!! An atom in the dependencies " + \ @@ -5452,56 +5422,11 @@ class depgraph(object): portage.dep._dep_check_strict = True return 1 - def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct): - """ - Queue disjunctive (virtual and ||) deps in self._dep_disjunctive_stack. - Yields non-disjunctive deps. Raises InvalidDependString when - necessary. - """ - i = 0 - while i < len(dep_struct): - x = dep_struct[i] - if isinstance(x, list): - for y in self._queue_disjunctive_deps( - pkg, dep_root, dep_priority, x): - yield y - elif x == "||": - self._queue_disjunction(pkg, dep_root, dep_priority, - [ x, dep_struct[ i + 1 ] ] ) - i += 1 - else: - try: - x = portage.dep.Atom(x) - except portage.exception.InvalidAtom: - if not pkg.installed: - raise portage.exception.InvalidDependString( - "invalid atom: '%s'" % x) - else: - # Note: Eventually this will check for PROPERTIES=virtual - # or whatever other metadata gets implemented for this - # purpose. - if x.cp.startswith('virtual/'): - self._queue_disjunction( pkg, dep_root, - dep_priority, [ str(x) ] ) - else: - yield str(x) - i += 1 - - def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct): - self._dep_disjunctive_stack.append( - (pkg, dep_root, dep_priority, dep_struct)) - - def _pop_disjunction(self, allow_unsatisfied): - """ - Pop one disjunctive dep from self._dep_disjunctive_stack, and use it to - populate self._dep_stack. - """ - pkg, dep_root, dep_priority, dep_struct = \ - self._dep_disjunctive_stack.pop() + def _add_pkg_dep_string(self, pkg, dep_root, dep_priority, dep_string, + allow_unsatisfied): depth = pkg.depth + 1 debug = "--debug" in self.myopts strict = pkg.type_name != "installed" - dep_string = portage.dep.paren_enclose(dep_struct) if debug: print @@ -5552,6 +5477,58 @@ class depgraph(object): return 1 + def _queue_disjunctive_deps(self, pkg, dep_root, dep_priority, dep_struct): + """ + Queue disjunctive (virtual and ||) deps in self._dep_disjunctive_stack. + Yields non-disjunctive deps. Raises InvalidDependString when + necessary. + """ + i = 0 + while i < len(dep_struct): + x = dep_struct[i] + if isinstance(x, list): + for y in self._queue_disjunctive_deps( + pkg, dep_root, dep_priority, x): + yield y + elif x == "||": + self._queue_disjunction(pkg, dep_root, dep_priority, + [ x, dep_struct[ i + 1 ] ] ) + i += 1 + else: + try: + x = portage.dep.Atom(x) + except portage.exception.InvalidAtom: + if not pkg.installed: + raise portage.exception.InvalidDependString( + "invalid atom: '%s'" % x) + else: + # Note: Eventually this will check for PROPERTIES=virtual + # or whatever other metadata gets implemented for this + # purpose. + if x.cp.startswith('virtual/'): + self._queue_disjunction( pkg, dep_root, + dep_priority, [ str(x) ] ) + else: + yield str(x) + i += 1 + + def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct): + self._dep_disjunctive_stack.append( + (pkg, dep_root, dep_priority, dep_struct)) + + def _pop_disjunction(self, allow_unsatisfied): + """ + Pop one disjunctive dep from self._dep_disjunctive_stack, and use it to + populate self._dep_stack. + """ + pkg, dep_root, dep_priority, dep_struct = \ + self._dep_disjunctive_stack.pop() + dep_string = portage.dep.paren_enclose(dep_struct) + if not self._add_pkg_dep_string( + pkg, dep_root, dep_priority, dep_string, allow_unsatisfied): + return 0 + return 1 + def _priority(self, **kwargs): if "remove" in self.myparams: priority_constructor = UnmergeDepPriority |