Merged from trunk -r12543:12552
authorFabian Groffen <grobian@gentoo.org>
Fri, 30 Jan 2009 21:23:15 +0000 (21:23 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 30 Jan 2009 21:23:15 +0000 (21:23 -0000)
   | 12544   | Fix interaction between ignorelist and ignorecvs parameters  |
   | zmedico | inside cacheddir(). Thanks to Christian Ruppert for          |
   |         | reporting.                                                   |

   | 12545   | Make listdir(ignorecvs=True) ignore .git directories. Thanks |
   | zmedico | to Christian Ruppert for the suggestion.                     |

   | 12546   | Make depgraph._add_dep() ignore fewer dependencies when not  |
   | zmedico | in --deep mode, by making it so that it will always account  |
   |         | for dependencies on packages that are already installed.     |

   | 12547   | Inside depgraph.loadResumeCommand(), when appropriate,       |
   | zmedico | complete the graph before analyzing any unsatisfied deps     |
   |         | that may exist.                                              |

   | 12548   | Inside depgraph.loadResumeCommand(), always enable deep      |
   | zmedico | traversal of dependencies. This is necessary for correct     |
   |         | --keep-going or --resume operation in case a package from a  |
   |         | group of circularly dependent packages fails.                |

   | 12549   | Inside depgraph._add_dep(), drop unnecessary build-time deps |
   | zmedico | if there is no package available to satisfy it.              |

   | 12550   | Fix typo in previous commit.                                 |
   | zmedico |                                                              |

   | 12551   | Add an ignore_priority parameter to digraph.parent_nodes().  |
   | zmedico |                                                              |

   | 12552   | Inside depgraph._dep_expand(), filter use dbapi.cp_list() to |
   | zmedico | filter out any results from dbapi.cp_all() that happen to    |
   |         | not contain any ebuilds. Thanks to Jeremy Olexa              |
   |         | <darkside@g.o> for reporting.                                |

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

pym/_emerge/__init__.py
pym/portage/__init__.py

index 07026beb8a8e8b0547439257024d0d02a0ae8c03..8f10cd3ce8fb9614d44ceee61b93a3a504fcb87a 100644 (file)
@@ -4847,6 +4847,10 @@ class depgraph(object):
                dep_pkg, existing_node = self._select_package(dep.root, dep.atom,
                        onlydeps=dep.onlydeps)
                if not dep_pkg:
+                       if dep.priority.satisfied:
+                               # This could be an unecessary build-time dep
+                               # pulled in by --with-bdeps=y.
+                               return 1
                        if allow_unsatisfied:
                                self._unsatisfied_deps.append(dep)
                                return 1
@@ -4859,6 +4863,7 @@ class depgraph(object):
                # discarded dependencies reduce the amount of information
                # available for optimization of merge order.
                if dep.priority.satisfied and \
+                       not dep_pkg.installed and \
                        not (existing_node or empty or deep or update):
                        myarg = None
                        if dep.root == self.target_root:
@@ -5201,9 +5206,9 @@ class depgraph(object):
                        atom_without_category, "null"))
                cat, atom_pn = portage.catsplit(null_cp)
 
+               dbs = self._filtered_trees[root_config.root]["dbs"]
                cp_set = set()
-               for db, pkg_type, built, installed, db_keys in \
-                       self._filtered_trees[root_config.root]["dbs"]:
+               for db, pkg_type, built, installed, db_keys in dbs:
                        cp_set.update(db.cp_all())
                for cp in list(cp_set):
                        cat, pn = portage.catsplit(cp)
@@ -5211,6 +5216,13 @@ class depgraph(object):
                                cp_set.discard(cp)
                deps = []
                for cp in cp_set:
+                       have_pkg = False
+                       for db, pkg_type, built, installed, db_keys in dbs:
+                               if db.cp_list(cp):
+                                       have_pkg = True
+                                       break
+                       if not have_pkg:
+                               continue
                        cat, pn = portage.catsplit(cp)
                        deps.append(insert_category_into_atom(
                                atom_without_category, cat))
@@ -8518,6 +8530,19 @@ class depgraph(object):
                else:
                        self._select_package = self._select_pkg_from_graph
                        self.myparams.add("selective")
+                       # Always traverse deep dependencies in order to account for
+                       # potentially unsatisfied dependencies of installed packages.
+                       # This is necessary for correct --keep-going or --resume operation
+                       # in case a package from a group of circularly dependent packages
+                       # fails. In this case, a package which has recently been installed
+                       # may have an unsatisfied circular dependency (pulled in by
+                       # PDEPEND, for example). So, even though a package is already
+                       # installed, it may not have all of it's dependencies satisfied, so
+                       # it may not be usable. If such a package is in the subgraph of
+                       # deep depenedencies of a scheduled build, that build needs to
+                       # be cancelled. In order for this type of situation to be
+                       # recognized, deep traversal of dependencies is required.
+                       self.myparams.add("deep")
 
                        favorites = resume_data.get("favorites")
                        args_set = self._sets["args"]
index 98ab4594e9f0010c921e72d94404db6d0df2327a..d95e77b447ea57bf08b228f41fe5d48205a8966e 100644 (file)
@@ -253,16 +253,21 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
        ret_list = []
        ret_ftype = []
        for x in range(0, len(list)):
-               if(ignorecvs and (len(list[x]) > 2) and (list[x][:2]!=".#")):
-                       ret_list.append(list[x])
-                       ret_ftype.append(ftype[x])
-               elif (list[x] not in ignorelist):
+               if list[x] in ignorelist:
+                       pass
+               elif ignorecvs:
+                       if list[x][:2] != ".#":
+                               ret_list.append(list[x])
+                               ret_ftype.append(ftype[x])
+               else:
                        ret_list.append(list[x])
                        ret_ftype.append(ftype[x])
 
        writemsg("cacheddirStats: H:%d/M:%d/S:%d\n" % (cacheHit, cacheMiss, cacheStale),10)
        return ret_list, ret_ftype
 
+_ignorecvs_dirs = ('CVS', 'SCCS', '.svn', '.git')
+
 def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelist=[], followSymlinks=True,
        EmptyOnError=False, dirsonly=False):
        """
@@ -274,7 +279,7 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
        @type recursive: Boolean
        @param filesonly; Only return files, not more directories
        @type filesonly: Boolean
-       @param ignorecvs: Ignore CVS directories ('CVS','.svn','SCCS')
+       @param ignorecvs: Ignore CVS directories ('CVS','SCCS','.svn','.git')
        @type ignorecvs: Boolean
        @param ignorelist: List of filenames/directories to exclude
        @type ignorelist: List
@@ -301,7 +306,8 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
        if recursive:
                x=0
                while x<len(ftype):
-                       if ftype[x]==1 and not (ignorecvs and os.path.basename(list[x]) in ('CVS','.svn','SCCS')):
+                       if ftype[x] == 1 and not \
+                               (ignorecvs and os.path.basename(list[x]) in _ignorecvs_dirs):
                                l,f = cacheddir(mypath+"/"+list[x], ignorecvs, ignorelist, EmptyOnError,
                                        followSymlinks)
 
@@ -454,16 +460,22 @@ class digraph(object):
        def child_nodes(self, node, ignore_priority=None):
                """Return all children of the specified node"""
                if ignore_priority is None:
-                       return self.nodes[node][0].keys()
+                       return list(self.nodes[node][0])
                children = []
                for child, priority in self.nodes[node][0].iteritems():
                        if priority > ignore_priority:
                                children.append(child)
                return children
 
-       def parent_nodes(self, node):
+       def parent_nodes(self, node, ignore_priority=None):
                """Return all parents of the specified node"""
-               return self.nodes[node][1].keys()
+               if ignore_priority is None:
+                       return list(self.nodes[node][1])
+               parents = []
+               for parent, priority in self.nodes[node][1].iteritems():
+                       if priority > ignore_priority:
+                               parents.append(parent)
+               return parents
 
        def leaf_nodes(self, ignore_priority=None):
                """Return all nodes that have no children