Make --skipfirst tolerate masked packages by dropping them (similar to
authorZac Medico <zmedico@gentoo.org>
Sun, 1 Jun 2008 01:37:34 +0000 (01:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 1 Jun 2008 01:37:34 +0000 (01:37 -0000)
how it would drop a package that has an unsatisfied dependency).

svn path=/main/trunk/; revision=10526

pym/_emerge/__init__.py

index c0bcdda0de020ca6bfcd93faea463f79240919ce..7294e78cd58f63758c9c3b3d80e5600bafcfca44 100644 (file)
@@ -5269,9 +5269,18 @@ class depgraph(object):
                if not isinstance(mergelist, list):
                        mergelist = []
 
+               favorites = resume_data.get("favorites")
+               args_set = self._sets["args"]
+               if isinstance(favorites, list):
+                       args = self._load_favorites(favorites)
+               else:
+                       args = []
+
+               skipfirst = "--skipfirst" in self.myopts
                fakedb = self.mydbapi
                trees = self.trees
                serialized_tasks = []
+               masked_tasks = []
                for x in mergelist:
                        if not (isinstance(x, list) and len(x) == 4):
                                continue
@@ -5305,8 +5314,13 @@ class depgraph(object):
                        root_config = self.roots[pkg.root]
                        if "merge" == pkg.operation and \
                                not visible(root_config.settings, pkg):
-                               self._unsatisfied_deps_for_display.append(
-                                       ((pkg.root, "="+pkg.cpv), {"myparent":None}))
+                               if skipfirst:
+                                       atom = args_set.findAtomForPackage(pkg)
+                                       masked_tasks.append(Dependency(atom=atom,
+                                               root=pkg.root, parent=pkg))
+                               else:
+                                       self._unsatisfied_deps_for_display.append(
+                                               ((pkg.root, "="+pkg.cpv), {"myparent":None}))
 
                        fakedb[myroot].cpv_inject(pkg)
                        serialized_tasks.append(pkg)
@@ -5321,12 +5335,6 @@ class depgraph(object):
                        self._select_package = self._select_pkg_from_graph
                        self.myparams.add("selective")
 
-                       favorites = resume_data.get("favorites")
-                       if isinstance(favorites, list):
-                               args = self._load_favorites(favorites)
-                       else:
-                               args = []
-
                        for task in serialized_tasks:
                                if isinstance(task, Package) and \
                                        task.operation == "merge":
@@ -5350,13 +5358,13 @@ class depgraph(object):
                        # masked.
                        if not self._create_graph(allow_unsatisfied=True):
                                return False
-                       if self._unsatisfied_deps:
+                       if masked_tasks or self._unsatisfied_deps:
                                # This probably means that a required package
                                # was dropped via --skipfirst. It makes the
                                # resume list invalid, so convert it to a
                                # UnsatisfiedResumeDep exception.
                                raise self.UnsatisfiedResumeDep(
-                                       self._unsatisfied_deps)
+                                       masked_tasks + self._unsatisfied_deps)
                        self._serialized_tasks_cache = None
                        try:
                                self.altlist()